本文整理汇总了PHP中MS_Model_Member::allow_registration方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Member::allow_registration方法的具体用法?PHP MS_Model_Member::allow_registration怎么用?PHP MS_Model_Member::allow_registration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MS_Model_Member
的用法示例。
在下文中一共展示了MS_Model_Member::allow_registration方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: auto_setup_settings
/**
* Auto setup settings.
*
* Fires after a membership setup is completed.
* This hook is executed every time a new membership is created.
*
* Related Action Hooks:
* - ms_controller_membership_setup_completed
*
* @since 1.0.0
*
* @param MS_Model_Membership $membership
*/
public function auto_setup_settings($membership)
{
$settings = $this->get_model();
// Create special pages.
MS_Model_Pages::create_missing_pages();
$pg_prot_cont = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_PROTECTED_CONTENT);
$pg_acco = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_ACCOUNT);
$pg_regi = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_REGISTER);
$pg_regi_comp = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_REG_COMPLETE);
$pg_memb = MS_Model_Pages::get_page(MS_Model_Pages::MS_PAGE_MEMBERSHIPS);
// Publish special pages.
// Tip: Only pages must be published that are added to the menu.
wp_publish_post($pg_acco->ID);
if (!$membership->private) {
wp_publish_post($pg_memb->ID);
wp_publish_post($pg_regi->ID);
}
// Create new WordPress menu-items.
MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_ACCOUNT);
if (!$membership->private) {
MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_MEMBERSHIPS);
MS_Model_Pages::create_menu(MS_Model_Pages::MS_PAGE_REGISTER);
}
// Enable Membership2.
$settings->plugin_enabled = true;
$settings->save();
// Enable the "Allow user registration" setting of WordPress
MS_Model_Member::allow_registration();
}