当前位置: 首页>>代码示例>>PHP>>正文


PHP MS_Model_Membership::get_signup_membership_list方法代码示例

本文整理汇总了PHP中MS_Model_Membership::get_signup_membership_list方法的典型用法代码示例。如果您正苦于以下问题:PHP MS_Model_Membership::get_signup_membership_list方法的具体用法?PHP MS_Model_Membership::get_signup_membership_list怎么用?PHP MS_Model_Membership::get_signup_membership_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MS_Model_Membership的用法示例。


在下文中一共展示了MS_Model_Membership::get_signup_membership_list方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: membership_signup

 /**
  * Membership signup callback function.
  *
  * @since  1.0.0
  *
  * @param mixed[] $atts Shortcode attributes.
  */
 public function membership_signup($atts)
 {
     MS_Helper_Shortcode::did_shortcode(MS_Helper_Shortcode::SCODE_SIGNUP);
     $data = apply_filters('ms_controller_shortcode_membership_signup_atts', shortcode_atts(array(MS_Helper_Membership::MEMBERSHIP_ACTION_SIGNUP . '_text' => __('Signup', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_MOVE . '_text' => __('Change', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_CANCEL . '_text' => __('Cancel', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_RENEW . '_text' => __('Renew', 'membership2'), MS_Helper_Membership::MEMBERSHIP_ACTION_PAY . '_text' => __('Complete Payment', 'membership2')), $atts));
     $member = MS_Model_Member::get_current_member();
     $data['member'] = $member;
     $data['subscriptions'] = array();
     $exclude = array();
     if ($member->is_valid()) {
         // Get member's memberships, including pending relationships.
         $data['subscriptions'] = MS_Model_Relationship::get_subscriptions(array('user_id' => $data['member']->id, 'status' => 'valid'));
         foreach ($data['subscriptions'] as $key => $subscription) {
             $exclude[] = $subscription->membership_id;
             if (!$member->can_subscribe_to($subscription->membership_id)) {
                 unset($data['subscriptions'][$key]);
             }
         }
     }
     $memberships = MS_Model_Membership::get_signup_membership_list(null, $exclude);
     $data['memberships'] = $memberships;
     $move_from_ids = array();
     // When Multiple memberships is not enabled, a member should move to another membership.
     if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
         // Membership Relationship status which can move to another one
         $valid_status = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_ACTIVE, MS_Model_Relationship::STATUS_EXPIRED);
         foreach ($data['member']->subscriptions as $subscription) {
             if ($subscription->is_system()) {
                 continue;
             }
             if (in_array($subscription->status, $valid_status)) {
                 $move_from_ids[] = $subscription->membership_id;
             }
         }
         foreach ($data['memberships'] as $key => $membership) {
             $data['memberships'][$key]->_move_from = $move_from_ids;
         }
     } else {
         foreach ($data['memberships'] as $key => $membership) {
             $move_from_ids = $member->cancel_ids_on_subscription($membership->id);
             $data['memberships'][$key]->_move_from = $move_from_ids;
         }
     }
     $data['action'] = MS_Helper_Membership::MEMBERSHIP_ACTION_SIGNUP;
     $data['step'] = MS_Controller_Frontend::STEP_PAYMENT_TABLE;
     $view = MS_Factory::create('MS_View_Shortcode_MembershipSignup');
     $view->data = apply_filters('ms_view_shortcode_membershipsignup_data', $data, $this);
     return $view->to_html();
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:55,代码来源:class-ms-controller-shortcode.php


注:本文中的MS_Model_Membership::get_signup_membership_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。