Drupal 将用户信息传递到 Privatemsg 模块 - *付费

发布于 2024-10-21 14:31:18 字数 1102 浏览 1 评论 0原文

我正在将内联注册模块(http://drupal.org/project/inline_registration)与 Privatemsg 模块(http://drupal.org/project/privatemsg)集成。

问题是将新创建的用户信息传递给 Privatemsg 函数,以便该消息由新用户创作。

提供付费解决方案 http://www. freelancer.com/projects/PHP-Drupal/Drupal-Inline-Registration-Bug-Fix.html。定制的模块代码也包含在那里。

感谢您的帮助。

/**

* 提交内嵌注册表的例程。 */ 函数 inline_registration_submit($form, &$form_state) { $status_save = $form_state['values']['status']; 取消设置($form_state['values']['uid']); 取消设置($form_state['值']['状态']);

user_register_submit($form, $form_state);

$form_state['values']['name'] = $form_state['user']->name; $form_state['values']['uid'] = $form_state['user']->uid; // $form_state['privatemsg']['author']['#value'] = $form_state['user']; $form_state['values']['status'] = $status_save; }

<代码>/** * privatemsg 的表单函数。 */ $form['privatemsg']['author'] = array( '#type'=> '价值', '#value'=> $用户, );

Im in the process of integrating the Inline Registration module (http://drupal.org/project/inline_registration) with the Privatemsg module(http://drupal.org/project/privatemsg).

Issue is with passing newly created user info to Privatemsg function so that the message is authored by new user.

Offering a paid solution at http://www.freelancer.com/projects/PHP-Drupal/Drupal-Inline-Registration-Bug-Fix.html. Customized module code included there as well.

Thanks for the help.

/**

* Submit routine for inline registration form.
*/
function inline_registration_submit($form, &$form_state) {
$status_save = $form_state['values']['status'];
unset($form_state['values']['uid']);
unset($form_state['values']['status']);

user_register_submit($form, $form_state);

$form_state['values']['name'] = $form_state['user']->name;
$form_state['values']['uid'] = $form_state['user']->uid;
// $form_state['privatemsg']['author']['#value'] = $form_state['user'];
$form_state['values']['status'] = $status_save;
}

/**
* Form function for privatemsg.
*/
$form['privatemsg']['author'] = array(
'#type' => 'value',
'#value' => $user,
);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傾旎 2024-10-28 14:31:18

Privatemsg 在 中构建消息数组/对象 (D7) privatemsg_new_validate()。然后将其保存在 $form_state['validate_built_message'] 中。因此,您需要添加在链接的函数之后运行的第二个验证函数,并将构建的消息数组更改为您想要的任何内容。

不太确定您到底想在哪里执行此操作,因为新表单和回复表单都受到明确的保护,以防止匿名访问。

Privatemsg builds the message array/object (D7) in privatemsg_new_validate(). That is then saved in $form_state['validate_built_message']. So you need to add a second validate function that runs after the linked one and change the built message array to whatever you want.

Not really sure where exactly you want to do that, because both the new and reply form is explicitly protected against anonymous access.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文