Hello,
I am new to coppermine and hoping someone can help me out a little. I am trying to add a simple yes/no radio button to the registration page. I have read some other post on editing the registration page but they are adding alot more items then I need (Looks complicated)
I am hoping there is a "fairly" simple way to do this. I have some coding experience but not a ton.
I am running cpg1.5.34 with only 2 plugins (forums and download link)
Thank you in advance.
So I was doing so more digging through some of the files and came across the following:
in register.php there is a section for radio buttons.
case 'radio':
// added the radio option for possible future use. The array definition would have to look like this:
// array('radio', 'user_var', 'Text label', 'option 1','option 2'),
// enabling this option requires changes in profile.php and usermgr.php as well
if ($superCage->post->keyExists($element[1])) {
$value = $superCage->post->getAlnum($element[1]);
} else {
$value = '';
}
if ($element[2]) {
echo <<< EOT
<tr>
<td width="40%" class="{$row_style}" height="25">
{$element[2]}
</td>
<td width="60%" class="{$row_style}" valign="top">
<input type="radio" name="{$element[1]}" id="{$element[1]}1" value="{$element[3]}" class="radio" />
<label for="{$element[1]}1" class="clickable_option">{$element[3]}</label>
<input type="radio" name="{$element[1]}" id="{$element[1]}2" value="{$element[4]}" class="radio" />
<label for="{$element[1]}2" class="clickable_option">{$element[4]}</label>
</td>
</tr>
So I added the following around line 120 in register.php
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $icon_array['username'] . $lang_register_php['username'], 25),
!empty($CONFIG['global_registration_pw']) ? array('password', 'global_registration_pw', $icon_array['password'] . $lang_register_php['global_registration_pw'], 25) : '',
array('password', 'password', $icon_array['password'] . $lang_register_php['password']),
array('password', 'password_verification', $icon_array['password'] . $lang_register_php['password_again']),
array('input', 'email', $icon_array['email'] . $lang_register_php['email'], 255),
//Sharing
array('radio', 'sharing', 'Share', 'Yes','No'),
array('label', $lang_register_php['optional_info'])
I also added 'sharing' into my english.php
Now the next part I am a little unsure of. In the radio code it says
Quoteenabling this option requires changes in profile.php and usermgr.php as well
But I don't really know what and where I should be adding to those files.
Any ideas or thought?
Thanks again in advance.
Hello,
Ok I am starting to make a little bit of progress. I final got it to show up and be sent in email to admin when complete but the last thing I am trying to do is basic add a popup or small window that has information in it like the help question mark on the admin page.
I want it to appear after the text "Sharing" and before the radio button. Any Idea?
$form_data = array(
array('label', $lang_register_php['required_info']),
array('input', 'username', $icon_array['username'] . $lang_register_php['username'], 25),
!empty($CONFIG['global_registration_pw']) ? array('password', 'global_registration_pw', $icon_array['password'] . $lang_register_php['global_registration_pw'], 25) : '',
array('password', 'password', $icon_array['password'] . $lang_register_php['password']),
array('password', 'password_verification', $icon_array['password'] . $lang_register_php['password_again']),
array('input', 'email', $icon_array['email'] . $lang_register_php['email'], 255),
//Sharing
array('radio', 'user_var', $icon_array['coin'] . 'Sharing', 'Yes','No'), //I want it to appear after the text "Sharing" and before the radio button.
//S END
array('label', $lang_register_php['optional_info'])
);
You mostly seem to be having a dialog in this thread with yourself ;)
Why don't you share the *total* picture of what it is you are trying to do. It seems like you are trying to ask the user, upon registration, whether they want to be sharing something. It is possible that what you are trying to achieve is already doable by others means without the method that you are trying to implement.
Yes Ron4mac, I am basically having a conversation with myself hoping that at some point someone will join in and help me.
Me end goal is it:
When someone is filling out the registration form they have the option (via radio button) to either have there work shared(download-able) or not.
I am not to worried about the setup after the registration. It is getting a radio button plus a pop-up which has the text in it describing what it means to have there work shared. (The same concept as the help icon on the admin side of things).
I hope this makes things a little clearer.
Thanks,
So all you currently need help with is to add the help box popup next to your radio button?
Quote from: Αndré on March 31, 2015, 10:20:08 AM
So all you currently need help with is to add the help box popup next to your radio button?
Yes, That is the last thing I need for my radio button.
Thanks,
Use something like this:
array('radio', 'user_var', $icon_array['coin'] . 'Sharing '.cpg_display_help('f=empty.htm&h=lang_common[captcha_help_title]&t=lang_common[captcha_help]', 470, 245), 'Yes','No'),
I used the example language data from the captcha help box. It's not possible to use custom text since cpg1.5.34, so you need to add the text you want to display to the language file(s) (at least
english.php) and access the language string in the "h" and "t" parameter (have a look at the example to get an idea how it works, should be obvious):
Quote from: Αndré on October 22, 2014, 01:09:54 PM
Fixed XSS issue in SVN revision 8751. Since cpg1.5.34 it's not possible to pass custom text to help.php. Instead, you can just pass available language strings or parts of the documentation.