create drupal user FROM OUTSIDE DRUPAL PHP FILE

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″ />
<title>Test Bootstrap</title>
</head>

<body>
<?php
define(“DRUPAL_ROOT”,     “/home1/onezerl5/public_html/theinstantsolutions/projects/drupaltest_7″);
require_once DRUPAL_ROOT . ‘/includes/bootstrap.inc’;
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$password_drupal = ‘000999’;
$fields_drupal = array(
‘name’ => ‘dilshad’,
‘mail’ => ‘hkfdewanhkf@gmail.com’,
‘pass’ => $password_drupal,
‘status’ => 1,
‘init’ => ’email address’,
‘roles’ => array(
DRUPAL_AUTHENTICATED_RID => ‘authenticated user’,
),
);
$account_drupal = user_save(”, $fields_drupal);
$account_drupal->password = $fields_drupal[‘pass’];
drupal_mail(‘user’, ‘register_no_approval_required’,$fields_drupal[‘mail’], NULL, array(‘account’ => $account_drupal), variable_get(‘site_mail’, ‘noreply@example.com’));
?>
</body>
</html>

Was this article helpful?

Related Articles