Joomla 3.0 Register user with php script -


i've searched , found way juser when try script says include file can't found , doesn't exist on server. don't know if different joomla 3.0 asking help. here's script tried:

<?php    define( '_jexec', 1 );    define('jpath_base', dirname(__file__) );    define( 'ds', directory_separator );    /* required files */    require_once ( jpath_base .ds.'includes'.ds.'defines.php' );    require_once ( jpath_base .ds.'includes'.ds.'framework.php' );     $app = jfactory::getapplication('site');    $app->initialise();    require_once jpath_root.ds.'components'.ds.'com_users'.ds.'models'.ds.'registration.php';    require_once jpath_root.ds.'libraries'.ds.'joomla'.ds.'application'.ds.'component'.ds.'helper.php';    $model = new usersmodelregistration();    jimport('joomla.mail.helper');    jimport('joomla.user.helper');     $username = 'jimporttest';    $name = 'j port2';    $email = 'test @ mail.com';    $password = 'test';    $data = array( 'username' => $username,              'name' => $name,              'email1' => $email,              'password1' => $password, // first password field              'password2' => $password, // confirm password field              'block' => 0 );    echo $model->register($data); ?> 

you have use jpath_base in require_once clause (you using jpath_base_root not defined). in joomla 3.0 helper.php not in position.

try code:

<?php          define( '_jexec', 1 );          define('jpath_base', dirname(__file__) );          define( 'ds', directory_separator );          /* required files */          require_once ( jpath_base .ds.'includes'.ds.'defines.php' );          require_once ( jpath_base .ds.'includes'.ds.'framework.php' );           $app = jfactory::getapplication('site');          $app->initialise();          require_once(jpath_base.ds.'components'.ds.'com_users'.ds.'models'.ds.'registration.php';         //not necessary         //require_once(jpath_base.ds.'libraries'.ds.'joomla'.ds.'application'.ds.'component'.ds.'helper.php';          $model = new usersmodelregistration();          jimport('joomla.mail.helper');          jimport('joomla.user.helper');           $username = 'jimporttest';          $name = 'j port2';          $email = 'test @ mail.com';          $password = 'test';          $data = array( 'username' => $username,          'name' => $name,          'email1' => $email,          'password1' => $password, // first password field          'password2' => $password, // confirm password field          'block' => 0 );           echo $model->register($data);   ?> 

i've tried in joomla 3.0 installation , works.

andrea


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -