htmlで単純な「アカウントを作成」フォームを作成しました。これは、ダブルオプトインメソッドのためにいくつかのJavaでインタースパイされています。また、このフォームをJoomlaで作成し、アカウントの作成ボタンをクリックしてログインすることもできます。Joomla 2.5の新規登録ユーザーphpスクリプト(dblオプトインJava)
ダブルオプトイン機能はうまく動作しますが、joomla 2.5の新しいユーザースクリプトは動作しません。エラーは発生しませんが、ユーザーは登録されません。私は、新しいユーザーを生成するためにstackoverflowに見つかったPHPスクリプト(下記参照)を配置しようとしましたが、それは動作していません。
この2つのタイプのスクリプトを1つのフォームで一緒に実行できますか?もしそうなら、どこが間違っていますか?ありがとう!
require_once (JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE .DS.'includes'.DS.'framework.php');
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
//Check for request forgeries, we comment this out since tokens are not generated in the html page
//JRequest::checkToken() or jexit('Invalid Token');
//Get required system objects
$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(Not needed)
$usersConfig = &JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration') == '0')
{
JError::raiseError(403, JText::_('Access Forbidden'));
return;
}
//Initialize new usertype setting
$newUsertype = $usersConfig->get('new_usertype');
if (!$newUsertype)
{
$newUsertype = 'Registered';
}
//Bind the post array to the user object
if (!$user->bind(JRequest::get('post'), 'usertype'))
{
JError::raiseError(500, $user->getError());
}
//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(Not needed)
$useractivation = $usersConfig->get('useractivation');
if ($useractivation == '1')
{
jimport('joomla.user.helper');
$user->set('activation', md5(JUserHelper::genRandomPassword()));
$user->set('block', '1');
}
//Save the details of the user
$user->save();
小さな修正後の影響を受け、グループキーテーブルを保持している#__usergroups、他の「ブロックしないでくださいユーザーは "$ data ['block'] = 0 – Maksee
"アクティベーションハッシュを設定してください(アクティベーション電子メールを送信することを忘れないでください) " **コードでアクティベーション電子メールを送信するにはどうしたらいいですか?** – dawoodman71