- 管理员/组件/ com_virtuemart/classses/ps_shopper.php
之前需要 “返回true” 行与函数add()下面的代码添加:
/* ** * ** * ** * ** * ** * ** * ** * ** * *** ** * ** * ** * ** * ** * ** * ** * **/ $ pwd = $ _POST ['password'];
$db = JFactory::getDBO();
$query = "SELECT id, name, email, username"
. "\n FROM #__users"
. "\n ORDER by id DESC LIMIT 1"
;
$db->setQuery($query);
$rows = $db->loadObjectList();
$namee = $rows[0]->name;
$emaill = $rows[0]->email;
$usern = $rows[0]->username;
$pwd;
$lid = $rows[0]->id;
$dbv = new ps_DB;
echo $query = "SELECT *"
. "\n FROM #__{vm}_user_info"
. "\n WHERE user_id=$lid"
;
$dbv->setQuery($query);
$fid = $db->loadObjectList();
$field = $fid[0]->extra_field_1;
$user = clone(JFactory::getUser());
$usersConfig = &JComponentHelper::getParams('com_users');
if ($usersConfig->get('allowUserRegistration') == '0') {
JError::raiseError(403, JText::_('Access Forbidden'));
return false;
}
// If user activation is turned on, we need to set the activation information
$useractivation = $usersConfig->get('useractivation');
if ($useractivation == '1')
{
jimport('joomla.user.helper');
$user->set('activation', md5(JUserHelper::genRandomPassword()));
$user->set('block', '1');
}
$component = 'com_user';
$activation_link = $mosConfig_live_site."/index.php?option=$component&task=activate&activation=".$user->get('activation');
$this->_sendMail($namee , $emaill, $usern, $pwd, $activation_link);
/************************************************** Spinz ********************************************/
注意:这里我们为用户邮件创建了用户名和密码的邮件功能。
- 管理员/组件/ com_virtuemart/classses/ps_shopper.php
需要注释的功能register_save() “返回true” 行前行:
// Send the registration email
//$this->_sendMail($name, $email, $username, $password, $activation_link);
注:这里生成的邮件函数我们需要评论该邮件函数,并在第一点中在ps_shopper.php的add()函数中创建另一个邮件函数。
- administrator/components/com_virtuemart/classses/ps_shopper。php
需要在函数_sendmail()的jos_vm_user_info表中使用以下代码获取额外的附加字段(extra_field_1),并将该字段通过邮件发送给用户。
/****************************************************************/
$db = JFactory::getDBO();
$query = "SELECT id, name, email, username"
. "\n FROM #__users"
. "\n ORDER by id DESC LIMIT 1"
;
$db->setQuery($query);
$rows = $db->loadObjectList();
$lid = $rows[0]->id;
$dbv = new ps_DB;
$query = "SELECT *"
. "\n FROM #__{vm}_user_info"
. "\n WHERE user_id=$lid"
;
$dbv->setQuery($query);
$fid = $db->loadObjectList();
$field = $fid[0]->extra_field_1;
$subject = sprintf ($VM_LANG->_('SEND_SUB',false), $name, $mosConfig_sitename);
$subject = vmHtmlEntityDecode($subject, ENT_QUOTES);
if ($mosConfig_useractivation=="1"){
$message = sprintf ($VM_LANG->_('USEND_MSG_ACTIVATE',false), $name, $mosConfig_sitename, $activation_link, $mosConfig_live_site, $username, $pwd, $field);
} else {
$message = sprintf ($VM_LANG->_('PHPSHOP_USER_SEND_REGISTRATION_DETAILS',false), $name, $mosConfig_sitename, $mosConfig_live_site, $username, $pwd, $field);
}
/* ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ** * ***/
注:
初始化变量 “$场” 获得使用查询额外添加的字段值。然后额外的字段值由邮件的消息部分分配(初始化变量$字段,在virtmart中增加一个额外字段的值)。
管理员/组件/ com_virtuemart /语言/普通/英语
替换消息为以下代码:
- 'USEND_MSG_ACTIVATE'=>“%s,您好
感谢您在%s注册。您的帐户已创建并且必须先启用才能使用。 要激活账号点击以下链接或在您的浏览器,它复制粘贴: %S
激活后,您可以使用下面的用户名和密码登录到%s:
用户名 - %S 密码 - %S 度 - %s'的
2.'PHPSHOP_USER_SEND_REGISTRATION_DETAILS '=>' %s您好,
谢谢您%s的注册。您的客户帐户已创建。 您可以使用下面的用户名和密码登录到%s:
用户名 - %S 密码 - %S 度 - %S ' 注:指定由
额外的附加价值语言文件中的字符串%s。
virtuth中包含额外添加字段值的字符串值的消息。
程度显示添加额外的字段