breezingforms

Page 89

[User Guide]

[Crosstec/Breezing Forms]

// Begin create user global $mainframe; JFactory::getLanguage()->load('com_user'); $this->execPieceByName('ff_InitLib'); $user = clone(JFactory::getUser()); $pathway =& $mainframe->getPathway(); $config =& JFactory::getConfig(); $authorize =& JFactory::getACL(); $document =& JFactory::getDocument(); // If user registration is not allowed, show 403 not authorized. $usersConfig = &JComponentHelper::getParams( 'com_users' ); if ($usersConfig->get('allowUserRegistration') == '0') { echo '<script>alert("Access forbidden");history.go(-1);</script>'; return; } else { // Initialize new usertype setting $newUsertype = $usersConfig->get( 'new_usertype' ); if (!$newUsertype) { $newUsertype = 'Registered'; } // Bind the post array to the user object $post = array( 'name' => ff_getSubmit('name'), 'username' => ff_getSubmit('email'), 'email' => ff_getSubmit('email'), 'password' => ff_getSubmit('bfSubsPassword'), 'password2' => ff_getSubmit('bfSubsPassword'), 'task' => 'register_save', 'id' => '0', 'gid' => '0', ); if (!$user->bind( $post, 'usertype' )) { echo '<script>alert("'.addslashes($user->getError()).'");history.go(-1);</script>'; return; } else { // Set some initial user values $user->set('id', 0); $user->set('usertype', ''); $user->set('gid', $authorize->get_group_id( '', $newUsertype, 'ARO' )); $date =& JFactory::getDate(); $user->set('registerDate', $date->toMySQL()); // If user activation is turned on, we need to set the activation information $useractivation = $usersConfig->get( 'useractivation' ); if ($useractivation == '1') { jimport('joomla.user.helper');

Page 87


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.