# Memberpress：如何在注册时将用户添加到组

**URL:** <https://meta.discourse.org/t/memberpress-how-to-add-users-to-groups-upon-sign-up/83478>\
**Category:** WordPress\
**Created:** [2018年三月21日 13:48 UTC](https://meta.discourse.org/t/memberpress-how-to-add-users-to-groups-upon-sign-up/83478 "2018-03-21T13:48:54Z")\
**Posts on this page:** 1\
**Showing post:** 38

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [2020年八月17日 02:25 UTC](https://meta.discourse.org/t/memberpress-how-to-add-users-to-groups-upon-sign-up/83478/38 "2020-08-17T02:25:29Z")

</div>

> [@Dani1](#):
>
> 发生这种情况时，能否请您在此处添加一个链接？谢谢！

当然可以，相关主题链接如下：[https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse-sso/74724。该主题介绍了如何使用](https://meta.discourse.org/t/managing-discourse-group-membership-with-wp-discourse-sso/74724%E3%80%82%E8%AF%A5%E4%B8%BB%E9%A2%98%E4%BB%8B%E7%BB%8D%E4%BA%86%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8) [WP Discourse](https://github.com/discourse/wp-discourse) 的 `add_user_to_discourse_group` 和 `remove_user_from_discourse_group` 函数。假设您的 WordPress 站点已配置为 Discourse 的 SSO 提供商站点，那么您应该使用这些函数来管理 Discourse 上的群组成员资格。

该主题中的示例使用的是 PaidMembershipsPro 插件，但类似的方法应该适用于任何制作精良的 WordPress 会员插件。

我将在该主题中补充一些关于如何使用 `add_groups` 和 `remove_groups` SSO 参数来管理群组成员资格的细节。在大多数情况下，通过在 SSO 载荷中添加这些参数来管理群组成员资格并不是最佳方案，因为这需要用户退出并重新登录 Discourse，其群组成员资格才会更新。

我希望在不久的将来，会出现一种开箱即用的解决方案，将 Discourse 与特定的 WordPress 会员插件进行关联。目前，这只能通过向您的 WordPress 站点添加少量自定义代码来实现。如果您通常不从事此类工作，可能需要聘请开发人员来协助完成。

---

_[View the full topic](https://meta.discourse.org/t/memberpress-how-to-add-users-to-groups-upon-sign-up/83478)._
