Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Modifying the self-registration text

More
6 years 8 months ago - 6 years 8 months ago #156895 by blocka
Replied by blocka on topic Modifying the self-registration text
There is a way to do this using Javascript in the register.pstpl file, by checking the lang= parameter.

Here's what register.pstpl looks like:


<style>
.dynamic-content {
display:none;
}
</style>

<div class='jumbotron'>
<div class="container clearfix">
<h2>{REGISTERMESSAGE1}</h2>
<h3><small class='text-info'>{REGISTERMESSAGE2}</small></h3>
</div>
</div>

<div id="default-content" class="dynamic-content">
Get started – sign up now! It's fast and easy.
</div>
<!-- Dynamic Section 1 -->
<div id="french" class="dynamic-content">
Commencez ici – Inscrivez-vous maintenant! C’est rapide et facile.
</div>
<!-- Dynamic Section 2 -->
<div id="english" class="dynamic-content">
Get started – sign up now! It's fast and easy.
</div>

<script type="text/javascript">
// Parse the URL parameter
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
// Give the parameter a variable name
var dynamicContent = getParameterByName('lang');

$(document).ready(function() {

// Check if the URL parameter is apples
if (dynamicContent == 'fr') {
$('#french').show();
}
// Check if the URL parameter is oranges
else if (dynamicContent == 'en') {
$('#english').show();
}
// Check if the URL parmeter is empty or not defined, display default content
else {
$('#default-content').show();
}
});
</script>


{REGISTERERROR}

<div class="register-form">

<div class="container">

{REGISTERFORM}</div>
</div>
<input type='hidden' class='hidemenubutton'/>
Last edit: 6 years 8 months ago by blocka.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 8 months ago - 6 years 8 months ago #156912 by DenisChenu
Replied by DenisChenu on topic Modifying the self-registration text
You can surely use beforeRegister event and set in a clean way your own message
Code:
$this->getEvent()->set('sMessage','<p>Your own message</p>');

github.com/LimeSurvey/LimeSurvey/blob/ma...rController.php#L112

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 6 years 8 months ago by DenisChenu.
The topic has been locked.
More
6 years 8 months ago #156929 by blocka
Replied by blocka on topic Modifying the self-registration text
That's interesting. I'd need to develop a plugin to do this, right?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 8 months ago #156951 by DenisChenu
Replied by DenisChenu on topic Modifying the self-registration text
Yes, for example

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose