如何在drupal中的独立php页面中添加钩子?
我已经通过curl到drupal站点链接从核心php站点提交了表单值。在这个页面中,我试图将电子邮件、密码直接插入drupal数据库。请帮我解决这个问题如何在drupal中的独立php页面中添加钩子?,php,drupal-7,Php,Drupal 7,我已经通过curl到drupal站点链接从核心php站点提交了表单值。在这个页面中,我试图将电子邮件、密码直接插入drupal数据库。请帮我解决这个问题 // define static var define('DRUPAL_ROOT', getcwd()); // include bootstrap include_once('./includes/bootstrap.inc'); // initialize stu
// define static var
define('DRUPAL_ROOT', getcwd());
// include bootstrap
include_once('./includes/bootstrap.inc');
// initialize stuff
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$email = $_REQUEST['email'];
$password = $_REQUEST['password'];
给你
if($_POST) {
//Bootstraping Drupal
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$account = new stdClass();
$account->name = $_REQUEST['username'];
$account->mail = $_REQUEST['mail'];
$account->init = $_REQUEST['mail'];
$account->pass = user_password($_REQUEST['pass']); // you could use a random characters here too
$account->status = 1;
user_save(Null, $account);
if ($account->uid) {
drupal_set_message('Created new user with id %uid', array('%uid' => $account->uid));
echo 'success';
}
}
试试这个,因为它可以帮你 您希望在内容保存期间使用哪个钩子?你想做什么?保存用户或内容页?我在drupal目录中编写了一个单独的php页面,并试图将该字段保存到用户表drupal数据库中的新记录中。谢谢您的回答。安威,我已经尝试了这个链接