Sean Conway
unread,Aug 3, 2011, 9:18:50 AM8/3/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to joomla-de...@googlegroups.com
i am adding users to joomla from another script, i have it working for the most part but i am getting this:
Fatal error: Class 'JPluginHelper' not found in /libraries/joomla/user/user.php on line 669
if i comment line 669 in user.php no error is given and the user is successfully added.
here is the code i am using to add the user.
[code]
$joomla_install = "/home/smc/public_html/joomlatest";
define( '_JEXEC', 1 );
define('JPATH_BASE', $joomla_install );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
require_once ( JPATH_BASE .DS.'libraries'.DS.'joomla'.DS.'factory.php' );
$mainframe =& JFactory::getApplication('site');
jimport( 'joomla.user.helper' );
$user['fullname'] = $vars["firstname"] ." ". $vars["lastname"];
$user['email'] = $vars["email"];
$user['username'] = $vars["email"];
$password = $vars["password"];
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$password = $crypt.':'.$salt;
$instance = JUser::getInstance();
$config = JComponentHelper::getParams('com_users');
$defaultUserGroup = $config->get('new_usertype', 2);
$acl = JFactory::getACL();
$instance->set('id', 0);
$instance->set('name', $user['fullname']);
$instance->set('username', $user['username']);
$instance->set('password', $password);
$instance->set('email', $user['email']);
$instance->set('usertype', 'deprecated');
$instance->set('groups', array($defaultUserGroup));
if ($instance->save())
{
$newUser =& JFactory::getUser($user['username']);
}
else {
return JError::raiseWarning('SOME_ERROR_CODE', $instance->getError());
}
}
[/code]