registerFunction( 'onBeforeUserRegistration', 'onBeforeUserRegistration', 'getconfirmemailTab' ); } class getconfirmemailTab extends cbTabHandler { /** * Constructor */ function getConfirmEmailTab() { $this->cbTabHandler(); } /** * Retrieves relevant CB Confirm Email parameters and puts in session. This would not be necessary in this case, I just wanted to try out! */ function _putConfirmEmailParameters() { global $mainframe; static $cbconfirmemailparms = array(); if ( count( $cbconfirmemailparms ) == 0 ) { $params = $this->params; // Plugin Parameters with default settings $cbconfirmemailparms['confirmemailRegistration'] = $params->get('confirmemailRegistration', 0); if ( session_id() == '' ) { session_start(); } $_SESSION['cbconfirmemailparams'] = $cbconfirmemailparms; // this is needed to send data to stand-alone php file } } /** * Generates the HTML to display the registration tab/area * @param object tab reflecting the tab database entry * @param object mosUser reflecting the user being displayed (here null) * @param int 1 for front-end, 2 for back-end * @return mixed : either string HTML for tab content, or false if ErrorMSG generated */ function getDisplayRegistration($tab, $user, $ui) { global $mainframe, $_POST; $params = $this->params; if (!$params->get('confirmemailRegistration',1)) { return null; } $dummy = $this->_putConfirmEmailParameters(); $return = "\n"; $return .= " \n"; $return .= " "; $return .= getFieldIcons($ui, true, false, _UE_CONFIRMEMAIL_Desc, _UE_CONFIRMEMAIL_Label . ":") . "\n"; $return .= "\n"; $return .= "\n\n"; return $return; } /** * This function is called before user registration and checks if the email address entered * in the confirmation field matches that entered in the main email field. * If not - then the application fails, a popup message is displayed and the applicant must try again. */ function onBeforeUserRegistration( &$row, &$rowExtras ) { global $mainframe, $_POST, $_PLUGINS; $params = $this->params; if (!$params->get('confirmemailRegistration',1)) { return; } if ( session_id() == "" ) { session_start(); } if ( ! ( $_POST['confirmemail'] == $_POST['email']) ) { $_PLUGINS->raiseError(0); /* $errormessage1 = " Email: " . $_POST['email'] . "Confirm: " . $_POST['confirmemail']; $_PLUGINS->_setErrorMSG( $errormessage1 ); */ $_PLUGINS->_setErrorMSG( _UE_CONFIRMEMAIL_NOT_VALID ); } return true; } } // end class getPassphraseTab. ?>