saveRegistrationTab

18 years 3 weeks ago #9082 by guy
saveRegistrationTab was created by guy
Hi All,

I have created a plugin adding a Game Play rules checkbox to my registration page. This works fine! I have however, been unable to work how to save the users response to the database.

From reading the plugin documentation I am guessing I should use saveRegistrationTab or should the system do it for me?

In the XML file I have created a field under the tabs section. In the TAB class I am showing a checkbox with the same name as the field - what else needs ot be done to link the two?

Thanks,
Guy

XML file is:
<files>
<filename plugin="extra_regofields">extra_regofields.php</filename>
<filename>index.html</filename>
</files>
<params>
<param name="RulesURL" type="text" size="40" default="Game Play Rules" label="Game Rules URL" description="URL of Game Play rules" />
</params>
<tabs>
<tab name="Extra Rego Fields" description="Extra registration fields" class="getExtraRegoTab" fields="0">
<params>
</params>
<fields>
<field title="Accepted Game Play Rules" name="cb_acceptedrules" description="Did you accept the game play rules" type="checkbox" registration="0" profile="0" readonly="1" params="" />
</fields>
</tab>
</tabs>

And the code in the plugin file is (comments removed for brevity):
class getExtraRegoTab extends cbTabHandler {
function getExtraRegoTab() {
$this->cbTabHandler();
}

function getDisplayRegistration($tab, $user, $ui) {
global $my, $mosConfig_absolute_path;

$params=$this->params;
$RulesURL=$params->get('RulesURL');

$return .= "\t<tr><td class='titleCell'>&nbsp;</td><td class='fieldCell' id='newslettersSpacer'>&nbsp;</td></tr>\n";
$return = "\t<tr>\n";
$return .= "\t\t<td class='titleCell'></td>\n";
$return .= "\t\t<td class='fieldCell'>";
$return .= "<input type='checkbox' name='cb_acceptedrules' value='1' mosReq='0' mosLabel='Accept Game Play Rules' />&nbsp;";
$return .= sprintf("Accept %sGame Play Rules%s","<a href='".sefRelToAbs($RulesURL)."' target='_BLANK'> ","</a>");
$return .= "</td>";
$return .= "\t</tr>\n";
$this->_addValidationJS( "\tif (!me.checked) {\n"
."\t errorMSG +=\"You must accept the Game Play rules before registering!\\n\"\n"
.";\n"
."\t iserror=1;\n"
."\t}\n");
return $return;
}

function saveRegistrationTab($tab, $user, $ui, $postdata) {
}

} // end class getExtraRegoTab.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.157 seconds

Facebook Twitter LinkedIn