Created
December 12, 2014 16:07
-
-
Save AdamMadrzejewski/2581730241748da89798 to your computer and use it in GitHub Desktop.
Joomla 3 external registration script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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'); | |
$language = JFactory::getLanguage(); | |
$language->load('com_users', JPATH_SITE); | |
$username = 'adam'; | |
$name = 'adam24'; | |
$email = 'adam@mailinator.com'; | |
$password = 'adam'; | |
$data = array( 'username' => $username, | |
'name' => $name, | |
'email1' => $email, | |
'password1' => $password, // First password field | |
'password2' => $password, // Confirm password field | |
'block' => 0 ); | |
echo $model->register($data); | |
if (version_compare(PHP_VERSION, '5.3.1', '<')) { | |
die('Your host needs to use PHP 5.3.1 or higher to run this version of Joomla!'); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment