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


PHP MS_Model_Member类代码示例

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


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

示例1: find_customer

 /**
  * Get Member's Stripe Customer Object.
  *
  * @since  1.0.0
  * @internal
  *
  * @param MS_Model_Member $member The member.
  */
 public function find_customer($member)
 {
     $customer_id = $member->get_gateway_profile(self::ID, 'customer_id');
     $customer = null;
     if (!empty($customer_id)) {
         $customer = M2_Stripe_Customer::retrieve($customer_id);
         // Seems like the customer was manually deleted on Stripe website.
         if (isset($customer->deleted) && $customer->deleted) {
             $customer = null;
             $member->set_gateway_profile(self::ID, 'customer_id', '');
         }
     }
     return apply_filters('ms_gateway_stripe_find_customer', $customer, $member, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:22,代码来源:class-ms-gateway-stripe-api.php

示例2: to_html

    public function to_html()
    {
        $this->check_simulation();
        // Search for orphaned relationships and delete them.
        MS_Model_Member::clean_db();
        $listview = MS_Factory::create('MS_Helper_ListTable_Member');
        $listview->prepare_items();
        ob_start();
        ?>

		<div class="wrap ms-wrap ms-member-list">
			<?php 
        MS_Helper_Html::settings_header(array('title' => __('Members', MS_TEXT_DOMAIN), 'title_icon_class' => 'wpmui-fa wpmui-fa-users', 'desc' => __('Here you can manage the Memberships of existing Users.', MS_TEXT_DOMAIN)));
        // Display a filter to switch between individual memberships.
        $this->membership_filter();
        $listview->views();
        $listview->search_box();
        ?>
			<form method="post">
				<?php 
        $listview->display();
        ?>
			</form>
		</div>

		<?php 
        $html = ob_get_clean();
        return $html;
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:29,代码来源:class-ms-view-member-list.php

示例3: prepare_fields

 /**
  * Prepare html fields.
  *
  * @since  1.0.0
  *
  * @return array
  */
 function prepare_fields()
 {
     $invoice = $this->data['invoice'];
     $currency = MS_Plugin::instance()->settings->currency;
     $user_name = '';
     $transaction_link = '';
     $user_id = 0;
     $user_list = array();
     if ($invoice->id) {
         $member = $invoice->get_member();
         $user_id = $member->id;
         $user_name = $member->name;
         $transaction_link = sprintf('<a href="%s" target="_blank">%s</a>', MS_Controller_Plugin::get_admin_url('billing', array('show' => 'logs', 'invoice' => $invoice->id)), __('Show Transactions', 'membership2'));
     } else {
         $user_list = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
     }
     $fields = array('link_transactions' => array('id' => 'link_transactions', 'title' => $transaction_link, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'wrapper_class' => 'ms-transactions-link'), 'txt_user' => array('id' => 'txt_user', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => sprintf('<a href="%s">%s</a>', MS_Controller_Plugin::get_admin_url('add-member', array('user_id' => $user_id)), $user_name)), 'txt_membership' => array('id' => 'txt_membership', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_created' => array('id' => 'txt_created', 'title' => __('Invoice created on', 'membership2'), 'type' => MS_Helper_Html::TYPE_HTML_TEXT), 'txt_separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'status' => array('id' => 'status', 'title' => __('Invoice status', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'field_options' => MS_Model_Invoice::get_status_types(true), 'value' => $invoice->status), 'user_id' => array('id' => 'user_id', 'title' => __('Invoice for member', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->user_id, 'field_options' => $user_list), 'membership_id' => array('id' => 'membership_id', 'title' => __('Payment for membership', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $invoice->membership_id, 'field_options' => $this->data['memberships']), 'amount' => array('id' => 'amount', 'title' => sprintf(__('Amount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->amount), 'config' => array('step' => 'any', 'min' => 0)), 'discount' => array('id' => 'discount', 'title' => sprintf(__('Discount (%s)', 'membership2'), $currency), 'type' => MS_Helper_Html::INPUT_TYPE_NUMBER, 'value' => MS_Helper_Billing::format_price($invoice->discount), 'config' => array('step' => 'any', 'min' => 0)), 'due_date' => array('id' => 'due_date', 'title' => __('Due date', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_DATEPICKER, 'value' => $invoice->due_date), 'description' => array('id' => 'description', 'title' => __('Description', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT, 'class' => 'widefat', 'value' => $invoice->description), 'notes' => array('id' => 'notes', 'title' => __('Notes', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_TEXT_AREA, 'class' => 'widefat', 'value' => $invoice->get_notes_desc()), 'invoice_id' => array('id' => 'invoice_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $invoice->id), '_wpnonce' => array('id' => '_wpnonce', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($this->data['action'])), 'action' => array('id' => 'action', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $this->data['action']), 'separator' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR), 'execute' => array('id' => 'execute', 'title' => __('Execute status change actions on Save (add/remove membership)', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_CHECKBOX, 'value' => true), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::TYPE_HTML_LINK, 'title' => __('Cancel', 'membership2'), 'value' => __('Cancel', 'membership2'), 'url' => esc_url_raw(remove_query_arg(array('action', 'invoice_id'))), 'class' => 'wpmui-field-button button'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Changes', 'membership2')));
     if ($invoice->id > 0) {
         $fields['user_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['membership_id']['type'] = MS_Helper_Html::INPUT_TYPE_HIDDEN;
         $fields['txt_membership']['value'] = $this->data['memberships'][$invoice->membership_id];
         $fields['txt_created']['value'] = MS_Helper_Period::format_date($invoice->invoice_date);
     } else {
         unset($fields['txt_user']);
         unset($fields['txt_membership']);
         unset($fields['txt_created']);
         unset($fields['txt_separator']);
     }
     return apply_filters('ms_view_billing_edit_prepare_fields', $fields, $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:37,代码来源:class-ms-view-billing-edit.php

示例4: can_simulate

 /**
  * Determines if the current user is permitted to even think about using
  * simulation. If not allowed, then most of this class will not be used.
  *
  * @since  1.0.0
  * @return bool
  */
 public static function can_simulate()
 {
     if (defined('DOING_CRON') && DOING_CRON) {
         // No simulation during cron jobs...
         return false;
     }
     if (MS_Model_Member::is_admin_user()) {
         return true;
     }
     return false;
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:18,代码来源:class-ms-model-simulate.php

示例5: prepare_fields

 /**
  * Prepare html fields.
  *
  * @since  1.0.1.0
  *
  * @return array
  */
 function prepare_fields()
 {
     $member = $this->data['member'];
     $userlist = MS_Model_Member::get_usernames(null, MS_Model_Member::SEARCH_ALL_USERS);
     $log = $this->data['log'];
     $data_action = MS_Controller_Billing::AJAX_ACTION_TRANSACTION_LINK_DATA;
     $update_action = MS_Controller_Billing::AJAX_ACTION_TRANSACTION_UPDATE;
     $fields = array();
     $member_id = 0;
     if ($member && $member->id) {
         $member_id = $member->id;
     }
     $fields['info'] = array('id' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction ID', 'membership2'), 'value' => $log->id), 'gateway' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Payment Gateway', 'membership2'), 'value' => MS_Model_Gateway::get_name($log->gateway_id, true)), 'amount' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction Amount', 'membership2'), 'value' => MS_Helper_Billing::format_price($log->amount)), 'details' => array('type' => MS_Helper_Html::TYPE_HTML_TEXT, 'title' => __('Transaction Details', 'membership2'), 'value' => $log->description), 'sep' => array('type' => MS_Helper_Html::TYPE_HTML_SEPARATOR, 'value' => 'vertical'));
     $fields['member'] = array('user_id' => array('id' => 'user_id', 'title' => __('1. Payment by user', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $member_id, 'field_options' => $userlist));
     $fields['subscription'] = array('subscription_id' => array('id' => 'subscription_id', 'title' => __('2. Payment for subscription', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => 0, 'field_options' => array()));
     $fields['invoice'] = array('invoice_id' => array('id' => 'invoice_id', 'title' => __('3. Link payment with invoice', 'membership2'), 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => 0, 'field_options' => array(), 'after' => __('The selected Invoice will be marked as "paid"', 'membership2')));
     $fields['buttons'] = array('nonce_link_data' => array('id' => 'nonce_link_data', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($data_action)), 'nonce_update' => array('id' => 'nonce_update', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => wp_create_nonce($update_action)), 'log_id' => array('id' => 'log_id', 'type' => MS_Helper_Html::INPUT_TYPE_HIDDEN, 'value' => $log->id), 'cancel' => array('id' => 'cancel', 'type' => MS_Helper_Html::INPUT_TYPE_BUTTON, 'value' => __('Cancel', 'membership2'), 'class' => 'wpmui-field-button button close'), 'submit' => array('id' => 'submit', 'type' => MS_Helper_Html::INPUT_TYPE_SUBMIT, 'value' => __('Save Transaction', 'membership2')));
     return apply_filters('ms_view_billing_link_prepare_fields', $fields, $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:26,代码来源:class-ms-view-billing-link.php

示例6: save_application

 /**
  * Save coupon application.
  *
  * Saving the application to keep track of the application in gateway return.
  * Using COUPON_REDEMPTION_TIME to expire coupon application.
  *
  * This is a non-static function, as it saves the current object!
  *
  * @since  1.0.0
  * @param MS_Model_Relationship $subscription The subscription to apply the coupon.
  */
 public function save_application($subscription)
 {
     // Don't save empty invitations.
     if (empty($this->code)) {
         return false;
     }
     $membership = $subscription->get_membership();
     $discount = $this->get_discount_value($subscription);
     $time = apply_filters('ms_addon_coupon_model_save_application_redemption_time', self::COUPON_REDEMPTION_TIME);
     // Grab the user account as we should be logged in by now.
     $user = MS_Model_Member::get_current_member();
     $key = self::get_transient_name($user->id, $membership->id);
     $transient = apply_filters('ms_addon_coupon_model_transient_value', array('id' => $this->id, 'user_id' => $user->id, 'membership_id' => $membership->id, 'discount' => $discount, 'message' => $this->coupon_message));
     MS_Factory::set_transient($key, $transient, $time);
     $this->save();
     do_action('ms_addon_coupon_model_save_application', $subscription, $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:28,代码来源:class-ms-addon-coupon-model.php

示例7: can_edit_menus

 /**
  * Returns true only then, when the current user can edit menu items.
  *
  * Reasons why it might be denied:
  * - There are no menus where items can be added to.
  * - The user is no admin.
  *
  * @since  1.0.0
  * @return bool
  */
 public static function can_edit_menus()
 {
     $Can_Edit_Menus = null;
     if (null === $Can_Edit_Menus) {
         $Can_Edit_Menus = false;
         if (!MS_Plugin::is_network_wide()) {
             $menus = wp_get_nav_menus();
             if (MS_Model_Member::is_admin_user() && !empty($menus)) {
                 $Can_Edit_Menus = true;
             }
         }
         $Can_Edit_Menus = apply_filters('ms_model_pages_can_edit_menus', $Can_Edit_Menus);
     }
     return $Can_Edit_Menus;
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:25,代码来源:class-ms-model-pages.php

示例8: column_membership

 /**
  * Create membership column.
  *
  * @since  1.0.0
  *
  * @param MS_Model_Member $member The member object.
  */
 public function column_membership($member)
 {
     if (MS_Model_Member::is_admin_user($member->id)) {
         $html = '<b>' . __('Admin User', MS_TEXT_DOMAIN) . '</b>';
     } else {
         $subscriptions = $member->get_membership_ids();
         $visitor = array('id' => 'ms-empty-' . $member->id, 'type' => MS_Helper_Html::TYPE_HTML_TEXT, 'value' => __('(Visitor)'), 'after' => 'Edit', 'class' => 'ms-empty-note');
         $list = array('id' => 'ms-memberships-' . $member->id, 'type' => MS_Helper_Html::INPUT_TYPE_SELECT, 'value' => $subscriptions, 'field_options' => self::$memberships, 'multiple' => true, 'class' => 'ms-memberships', 'ajax_data' => array('action' => MS_Controller_Member::AJAX_ACTION_CHANGE_MEMBERSHIPS, 'member' => $member->id));
         $html = sprintf('<div class="no-auto-init">%1$s%2$s</div>', MS_Helper_Html::html_element($visitor, true), MS_Helper_Html::html_element($list, true));
     }
     return apply_filters('ms_helper_listtable_member_column_membership', $html, $member, $this);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:19,代码来源:class-ms-helper-listtable-member.php

示例9: to_html

    public function to_html()
    {
        ob_start();
        ?>
		<div class="ms-account-wrapper">
			<?php 
        if (MS_Model_Member::is_logged_in()) {
            ?>
				<h2>
					<?php 
            _e('Invoice', MS_TEXT_DOMAIN);
            ?>
				</h2>
				<table>
					<thead>
						<tr>
							<th class="ms-col-invoice-no"><?php 
            _e('Invoice #', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-status"><?php 
            _e('Status', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-total"><?php 
            printf('%s (%s)', __('Total', MS_TEXT_DOMAIN), MS_Plugin::instance()->settings->currency);
            ?>
</th>
							<th class="ms-col-invoice-title"><?php 
            _e('Membership', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-invoice-due"><?php 
            _e('Due date', MS_TEXT_DOMAIN);
            ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
            foreach ($this->data['invoices'] as $invoice) {
                $inv_membership = MS_Factory::load('MS_Model_Membership', $invoice->membership_id);
                $inv_classes = array('ms-invoice-' . $invoice->id, 'ms-subscription-' . $invoice->ms_relationship_id, 'ms-invoice-' . $invoice->status, 'ms-gateway-' . $invoice->gateway_id, 'ms-membership-' . $invoice->membership_id, 'ms-type-' . $inv_membership->type, 'ms-payment-' . $inv_membership->payment_type);
                ?>
						<tr class="<?php 
                echo esc_attr(implode(' ', $inv_classes));
                ?>
">
							<td class="ms-col-invoice-no"><?php 
                printf('<a href="%s">%s</a>', get_permalink($invoice->id), $invoice->get_invoice_number());
                ?>
</td>
							<td class="ms-col-invoice-status"><?php 
                echo esc_html($invoice->status_text());
                ?>
</td>
							<td class="ms-col-invoice-total"><?php 
                echo esc_html(MS_Helper_Billing::format_price($invoice->total));
                ?>
</td>
							<td class="ms-col-invoice-title"><?php 
                echo esc_html($inv_membership->name);
                ?>
</td>
							<td class="ms-col-invoice-due"><?php 
                echo esc_html(MS_Helper_Period::format_date($invoice->due_date, __('F j', MS_TEXT_DOMAIN)));
                ?>
</td>
						</tr>
					<?php 
            }
            ?>
					</tbody>
				</table>
			<?php 
        } else {
            ?>
				<?php 
            $redirect = esc_url_raw(add_query_arg(array()));
            $title = __('Your account', MS_TEXT_DOMAIN);
            echo do_shortcode("[ms-membership-login redirect='{$redirect}' title='{$title}']");
            ?>
			<?php 
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return $html;
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:91,代码来源:class-ms-view-frontend-invoices.php

示例10: autodetect_membership

 /**
  * Tries to auto-detect the currently displayed membership-ID.
  *
  * Use this function by calling the filter `ms_detect_membership_id`
  *
  * Detection logic:
  * 1. If a valid preferred value was specified then this value is used.
  * 2. Examine REQUEST data and look for membership/subscription/invoice.
  * 3. Check currently logged in user and use the top-priority subscription.
  *
  * @since  1.0.1.0
  * @param  int $preferred The preferred ID is only used if it is a valid ID.
  * @param  bool $no_member_check If set to true the member subscriptions are
  *         not checked, which means only REQUEST data is examined.
  * @param  bool $ignore_system If set to true, then the return value will
  *         never be a system-membership-ID (no auto-assigned membership).
  * @return int A valid Membership ID or 0 if all tests fail.
  */
 public function autodetect_membership($preferred = 0, $no_member_check = false, $ignore_system = false)
 {
     $membership_id = 0;
     // Check 1: If the preferred value is correct use it.
     if ($preferred) {
         $membership = MS_Factory::load('MS_Model_Membership', $preferred);
         // Only use the membership_id if it's valid and not filtered by ignore_system.
         if ($membership->is_valid() && $membership->id == $preferred) {
             if (!$ignore_system || !$membership->is_system()) {
                 $membership_id = $membership->id;
             }
         }
     }
     // Check 2: Examine the REQUEST parameters to find a valid ID.
     if (!$membership_id) {
         if (!$membership_id) {
             if (isset($_REQUEST['membership_id'])) {
                 $membership_id = $_REQUEST['membership_id'];
             } elseif (isset($_REQUEST['subscription_id'])) {
                 $sub_id = $_REQUEST['subscription_id'];
                 $subscription = MS_Factory::load('MS_Model_Relationship', $sub_id);
                 $membership_id = $subscription->membership_id;
             } elseif (isset($_REQUEST['ms_relationship_id'])) {
                 $sub_id = $_REQUEST['ms_relationship_id'];
                 $subscription = MS_Factory::load('MS_Model_Relationship', $sub_id);
                 $membership_id = $subscription->membership_id;
             } elseif (isset($_REQUEST['invoice_id'])) {
                 $inv_id = $_REQUEST['invoice_id'];
                 $invoice = MS_Factory::load('MS_Model_Invoice', $inv_id);
                 $membership_id = $invoice->membership_id;
             }
             $membership_id = intval($membership_id);
         }
         // Reset the membership_id if it's invalid or filtered by ignore_system.
         if ($membership_id) {
             $membership = MS_Factory::load('MS_Model_Membership', $membership_id);
             if (!$membership->is_valid()) {
                 $membership_id = 0;
             } elseif ($membership->id != $membership_id) {
                 $membership_id = 0;
             } elseif ($ignore_system && $membership->is_system) {
                 $membership_id = 0;
             }
         }
     }
     // Check 3: Check subscriptions of the current user.
     if (!$no_member_check && !$membership_id && is_user_logged_in()) {
         $member = MS_Model_Member::get_current_member();
         $subscription = $member->get_subscription('priority');
         if ($subscription) {
             $membership_id = $subscription->membership_id;
         }
         // Reset the membership_id if it's invalid or filtered by ignore_system.
         if ($membership_id) {
             $membership = MS_Factory::load('MS_Model_Membership', $membership_id);
             if (!$membership->is_valid()) {
                 $membership_id = 0;
             } elseif ($membership->id != $membership_id) {
                 $membership_id = 0;
             } elseif ($ignore_system && $membership->is_system) {
                 $membership_id = 0;
             }
         }
     }
     return apply_filters('ms_controller_membership_autodetect_membership', $membership_id, $preferred, $no_member_check);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:84,代码来源:class-ms-controller-membership.php

示例11: 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();
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:42,代码来源:class-ms-controller-settings.php

示例12: to_html

    public function to_html()
    {
        $fields = $this->prepare_fields();
        $subscription = $this->data['ms_relationship'];
        $invoice = $subscription->get_current_invoice();
        $member = MS_Model_Member::get_current_member();
        $gateway = $this->data['gateway'];
        // Stripe is using Ajax, so the URL is empty.
        $action_url = apply_filters('ms_gateway_stripe_view_button_form_action_url', '');
        $row_class = 'gateway_' . $gateway->id;
        if (!$gateway->is_live_mode()) {
            $row_class .= ' sandbox-mode';
        }
        ob_start();
        ?>
		<form action="<?php 
        echo esc_url($action_url);
        ?>
" method="post">
			<?php 
        foreach ($fields as $field) {
            MS_Helper_Html::html_element($field);
        }
        ?>
			<script
				src="https://checkout.stripe.com/checkout.js" class="stripe-button"
				data-key="<?php 
        echo esc_attr($gateway->get_publishable_key());
        ?>
"
				data-amount="<?php 
        echo esc_attr(ceil(abs($invoice->total * 100)));
        //amount in cents
        ?>
"
				data-name="<?php 
        echo esc_attr(bloginfo('name'));
        ?>
"
				data-description="<?php 
        echo esc_attr(strip_tags($invoice->short_description));
        ?>
"
				data-currency="<?php 
        echo esc_attr($invoice->currency);
        ?>
"
				data-panel-label="<?php 
        echo esc_attr($gateway->pay_button_url);
        ?>
"
				data-label="<?php 
        echo esc_attr($gateway->pay_button_url);
        ?>
"
				data-email="<?php 
        echo esc_attr($member->email);
        ?>
"
				>
			</script>
		</form>
		<?php 
        $payment_form = apply_filters('ms_gateway_form', ob_get_clean(), $gateway, $invoice, $this);
        ob_start();
        ?>
		<tr class="<?php 
        echo esc_attr($row_class);
        ?>
">
			<td class="ms-buy-now-column" colspan="2">
				<?php 
        echo $payment_form;
        ?>
			</td>
		</tr>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_gateway_button-' . $gateway->id, $html, $this);
        return $html;
    }
开发者ID:klgrimley,项目名称:mzf,代码行数:81,代码来源:class-ms-gateway-stripe-view-button.php

示例13: can_access_file

 /**
  * Checks if the current user can access the specified attachment.
  *
  * @since  1.0.0
  * @param  int $attachment_id
  * @return bool
  */
 public function can_access_file($attachment_id)
 {
     $access = false;
     if (MS_Model_Member::is_normal_admin()) {
         return true;
     }
     if (!MS_Model_Addon::is_enabled(MS_Addon_Mediafiles::ID)) {
         /*
          * Default protection mode:
          * Protect Attachments based on the parent post.
          */
         $parent_id = get_post_field('post_parent', $attachment_id);
         if (!$parent_id) {
             $access = true;
         } else {
             $member = MS_Model_Member::get_current_member();
             foreach ($member->subscriptions as $subscription) {
                 $membership = $subscription->get_membership();
                 $access = $membership->has_access_to_post($parent_id);
                 if ($access) {
                     break;
                 }
             }
         }
     } else {
         /*
          * Advanced protection mode (via Add-on):
          * Each Attachment can be protected individually.
          */
         $member = MS_Model_Member::get_current_member();
         foreach ($member->subscriptions as $subscription) {
             $rule = $subscription->get_membership()->get_rule(MS_Rule_Media::RULE_ID);
             $access = $rule->has_access($attachment_id);
             if ($access) {
                 break;
             }
         }
     }
     return apply_filters('ms_rule_media_can_access_file', $access, $attachment_id);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:47,代码来源:class-ms-rule-media-model.php

示例14: to_html

    public function to_html()
    {
        ob_start();
        ?>
		<div class="ms-account-wrapper">
			<?php 
        if (MS_Model_Member::is_logged_in()) {
            ?>
				<h2>
					<?php 
            _e('Activity', MS_TEXT_DOMAIN);
            ?>
				</h2>
				<table>
					<thead>
						<tr>
							<th class="ms-col-activity-date"><?php 
            _e('Date', MS_TEXT_DOMAIN);
            ?>
</th>
							<th class="ms-col-activity-title"><?php 
            _e('Activity', MS_TEXT_DOMAIN);
            ?>
</th>
						</tr>
					</thead>
					<tbody>
					<?php 
            foreach ($this->data['events'] as $event) {
                $ev_classes = array('ms-activity-topic-' . $event->topic, 'ms-activity-type-' . $event->type, 'ms-membership-' . $event->membership_id);
                ?>
						<tr class="<?php 
                echo esc_attr(implode(' ', $ev_classes));
                ?>
">
							<td class="ms-col-activity-date"><?php 
                echo esc_html(MS_Helper_Period::format_date($event->post_modified, __('F j (H:i)', MS_TEXT_DOMAIN)));
                ?>
</td>
							<td class="ms-col-activity-title"><?php 
                echo esc_html($event->description);
                ?>
</td>
						</tr>
					<?php 
            }
            ?>
				</tbody>
			</table>
			<?php 
        } else {
            $redirect = esc_url_raw(add_query_arg(array()));
            $title = __('Your account', MS_TEXT_DOMAIN);
            echo do_shortcode("[ms-membership-login redirect='{$redirect}' title='{$title}']");
        }
        ?>
		</div>
		<?php 
        $html = ob_get_clean();
        $html = apply_filters('ms_compact_code', $html);
        return $html;
    }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:62,代码来源:class-ms-view-frontend-activities.php

示例15: logout_form

 /**
  * Returns HTML partial that contains the logout form
  *
  * @since  1.0.0
  *
  * @return string
  */
 private function logout_form()
 {
     if (!MS_Model_Member::is_logged_in()) {
         return '';
     }
     $member = MS_Model_Member::get_current_member();
     extract($this->data);
     if (empty($redirect_logout)) {
         $redirect_logout = home_url();
     }
     $yourname = sprintf(__('You are logged in as %s.', MS_TEXT_DOMAIN), ucfirst($member->username));
     $html = sprintf('%1$s <a class="login_button" href="%2$s">%3$s</a>', $yourname, wp_logout_url($redirect_logout), __('Logout', MS_TEXT_DOMAIN));
     if (!empty($holder)) {
         $html = sprintf('<%1$s class="%2$s">%3$s</%1$s>', esc_attr($holder), esc_attr($holderclass), $html);
     }
     return $html;
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:24,代码来源:class-ms-view-shortcode-login.php


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