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


PHP MS_Model_Member::is_admin_user方法代码示例

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


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

示例1: 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

示例2: is_admin_user

 /**
  * Verify if current user can perform management actions.
  *
  * @since  1.0.0
  *
  * @return boolean True if can, false otherwise.
  */
 public function is_admin_user()
 {
     $is_admin_user = MS_Model_Member::is_admin_user();
     return apply_filters('ms_controller_is_admin_user', $is_admin_user);
 }
开发者ID:jsandlin85,项目名称:SkylineSports,代码行数:12,代码来源:class-ms-controller.php

示例3: 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

示例4: 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

示例5: login_redirect

 /**
  * Redirect user to account page.
  *
  * Only redirect when no previous redirect_to is set or when going to /wp-admin/.
  *
  * @since  1.0.0
  *
  * @param string $redirect_to URL to redirect to.
  * @param string $request URL the user is coming from.
  * @param object $user Logged user's data.
  * @return string The redirect url.
  */
 public function login_redirect($redirect_to, $request, $user)
 {
     if (!empty($user->ID) && !MS_Model_Member::is_admin_user($user->ID) && (empty($redirect_to) || admin_url() == $redirect_to)) {
         $redirect_to = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_ACCOUNT);
     }
     return apply_filters('ms_controller_frontend_login_redirect', $redirect_to, $request, $user, $this);
 }
开发者ID:klgrimley,项目名称:mzf,代码行数:19,代码来源:class-ms-controller-frontend.php

示例6: customize_toolbar

 /**
  * Customize the Admin Toolbar.
  *
  * Related Action Hooks:
  * - wp_before_admin_bar_render
  *
  * @since  1.0.0
  */
 public function customize_toolbar()
 {
     if (MS_Model_Member::is_admin_user() && MS_Plugin::is_enabled() && !is_network_admin() && MS_Model_Simulate::can_simulate()) {
         if ($this->simulate->is_simulating()) {
             $this->add_detail_nodes();
         } else {
             $this->add_test_membership_node();
         }
     } else {
         if (!MS_Plugin::is_enabled()) {
             $this->add_unprotected_node();
         }
     }
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:22,代码来源:class-ms-controller-adminbar.php

示例7: save

 /**
  * Save model.
  *
  * Only saves if is not admin user and not a visitor.
  * Don't save automatically assigned visitor/system memberships.
  *
  * @since  1.0.0
  * @api
  */
 public function save()
 {
     do_action('ms_model_relationship_save_before', $this);
     if (!empty($this->user_id) && !MS_Model_Member::is_admin_user($this->user_id)) {
         if (!$this->is_system()) {
             parent::save();
             parent::store_singleton();
         }
     }
     do_action('ms_model_relationship_after', $this);
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:20,代码来源:class-ms-model-relationship.php

示例8: ms_no_value

 /**
  * Special Shortcode Callback: Replace shortcodes with empty value.
  *
  *     All Shortcodes use this callback function
  *     when Content Protection is DISABLED!
  *
  * @since  1.0.0
  * @param  mixed[] $atts Shortcode attributes.
  * @param  string $content
  * @return string
  */
 public function ms_no_value($atts, $content = '')
 {
     static $Done = false;
     if ($Done) {
         return '';
     }
     $Done = true;
     if (MS_Model_Member::is_admin_user()) {
         $content = sprintf('<p class="ms-alert-box ms-alert-error ms-unprotected">%s<br /><br /><em>(%s)</em></p>', __('Content Protection is disabled. Please enable the protection to see this shortcode.', 'membership2'), __('This message is only displayed to Site Administrators', 'membership2'));
     } else {
         $content = '';
     }
     return apply_filters('ms_controller_shortcode_ms_no_value', $content, $this);
 }
开发者ID:EdoMagen,项目名称:project-s-v2,代码行数:25,代码来源:class-ms-controller-shortcode.php

示例9: to_html

    public function to_html()
    {
        global $post;
        /**
         * Provide a customized account page.
         *
         * @since  1.0.0
         */
        $html = apply_filters('ms_shortcode_custom_account', '', $this->data);
        if (!empty($html)) {
            return $html;
        } else {
            $html = '';
        }
        $member = MS_Model_Member::get_current_member();
        $fields = $this->prepare_fields();
        // Extract shortcode options.
        extract($this->data);
        ob_start();
        ?>
		<div class="ms-account-wrapper">
			<?php 
        if (MS_Model_Member::is_logged_in()) {
            ?>

				<?php 
            // ================================================= MEMBERSHIPS
            if ($show_membership) {
                ?>
				<div id="account-membership">
				<h2>
					<?php 
                echo $membership_title;
                if ($show_membership_change) {
                    $signup_url = MS_Model_Pages::get_page_url(MS_Model_Pages::MS_PAGE_REGISTER);
                    printf('<a href="%s" class="ms-edit-profile">%s</a>', $signup_url, $membership_change_label);
                }
                ?>
				</h2>
				<?php 
                /**
                 * Add custom content right before the memberships list.
                 *
                 * @since  1.0.0
                 */
                do_action('ms_view_account_memberships_top', $member, $this);
                if (MS_Model_Member::is_admin_user()) {
                    _e('You are an admin user and have access to all memberships', 'membership2');
                } else {
                    if (!empty($this->data['subscription'])) {
                        ?>
						<table>
							<tr>
								<th class="ms-col-membership"><?php 
                        _e('Membership name', 'membership2');
                        ?>
</th>
								<th class="ms-col-status"><?php 
                        _e('Status', 'membership2');
                        ?>
</th>
								<th class="ms-col-expire-date"><?php 
                        _e('Expire date', 'membership2');
                        ?>
</th>
							</tr>
							<?php 
                        $empty = true;
                        // These subscriptions have no expire date
                        $no_expire_list = array(MS_Model_Relationship::STATUS_PENDING, MS_Model_Relationship::STATUS_WAITING, MS_Model_Relationship::STATUS_DEACTIVATED);
                        // These subscriptions display the trial-expire date
                        $trial_expire_list = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_TRIAL_EXPIRED);
                        foreach ($this->data['subscription'] as $subscription) {
                            $empty = false;
                            $membership = $subscription->get_membership();
                            $subs_classes = array('ms-subscription-' . $subscription->id, 'ms-status-' . $subscription->status, 'ms-type-' . $membership->type, 'ms-payment-' . $membership->payment_type, 'ms-gateway-' . $subscription->gateway_id, 'ms-membership-' . $subscription->membership_id, $subscription->has_trial() ? 'ms-with-trial' : 'ms-no-trial');
                            ?>
								<tr class="<?php 
                            echo esc_attr(implode(' ', $subs_classes));
                            ?>
">
									<td class="ms-col-membership"><?php 
                            echo esc_html($membership->name);
                            ?>
</td>
									<td class="ms-col-status">
									<?php 
                            if (MS_Model_Relationship::STATUS_PENDING == $subscription->status) {
                                // Display a "Purchase" link when status is Pending
                                $code = sprintf('[%s id="%s" label="%s"]', MS_Helper_Shortcode::SCODE_MS_BUY, $membership->id, __('Pending', 'membership2'));
                                echo do_shortcode($code);
                            } else {
                                echo esc_html($subscription->status_text());
                            }
                            ?>
									</td>
									<td class="ms-col-expire-date"><?php 
                            if (in_array($subscription->status, $no_expire_list)) {
                                echo '&nbsp;';
                            } elseif (in_array($subscription->status, $trial_expire_list)) {
//.........这里部分代码省略.........
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:101,代码来源:class-ms-view-shortcode-account.php

示例10: to_html

    /**
     * Returns the HTML code for the Purchase-Membership form.
     *
     * @since  1.0.0
     * @return string
     */
    public function to_html()
    {
        $membership = $this->data['membership'];
        $invoice = $this->data['invoice'];
        $subscription = $this->data['ms_relationship'];
        $class = 'ms-alert-success';
        $msg = __('Please check the details of the membership below and click ' . 'on the relevant button to complete the signup.', 'membership2');
        if (!empty($this->data['error'])) {
            $class = 'ms-alert-error';
            $msg = $this->data['error'];
        }
        /**
         * Log the users IP and current timestamp inside the invoice.
         *
         * @since 1.0.2.0
         */
        $invoice->checkout_ip = lib3()->net->current_ip()->ip;
        $invoice->checkout_date = date('Y-m-d H:i:s');
        $invoice->save();
        $cancel_warning = false;
        if (!MS_Model_Member::is_admin_user()) {
            if (!MS_Model_Addon::is_enabled(MS_Model_Addon::ADDON_MULTI_MEMBERSHIPS)) {
                // Member can only sign up to one membership.
                $valid_status = array(MS_Model_Relationship::STATUS_TRIAL, MS_Model_Relationship::STATUS_ACTIVE, MS_Model_Relationship::STATUS_PENDING);
                foreach ($this->data['member']->subscriptions as $tmp_subscription) {
                    if ($tmp_subscription->is_system()) {
                        continue;
                    }
                    if (in_array($tmp_subscription->status, $valid_status)) {
                        $cancel_warning = __('Your other Memberships will be cancelled when you complete this payment.', 'membership2');
                        break;
                    }
                }
            } elseif ($subscription->move_from_id) {
                $move_from_ids = explode(',', $subscription->move_from_id);
                $names = array();
                foreach ($move_from_ids as $id) {
                    $ms = MS_Factory::load('MS_Model_Membership', $id);
                    if ($ms->is_system()) {
                        continue;
                    }
                    $names[] = $ms->name;
                }
                if (1 == count($names)) {
                    $cancel_warning = sprintf(__('When you complete this payment your Membership "%s" will be cancelled.', 'membership2'), $names[0]);
                } elseif (1 < count($names)) {
                    $cancel_warning = sprintf(__('When you complete this payment the following Memberships will be cancelled: %s.', 'membership2'), implode(', ', $names));
                }
            }
        }
        // Check if the user goes through a trial period before first payment.
        $is_trial = $invoice->uses_trial;
        $skip_form = !MS_Model_Member::is_admin_user() && !$cancel_warning && $membership->is_free();
        /**
         * Filter the flag to allow Add-ons like "Invitation codes" to override
         * the state and force the form to display.
         *
         * @var bool
         */
        $skip_form = apply_filters('ms_view_frontend_payment_skip_form', $skip_form, $invoice, $this);
        if ($skip_form) {
            // No confirmation required. Simply register for this membership!
            $args = array();
            $args['ms_relationship_id'] = $subscription->id;
            $args['gateway'] = MS_Gateway_Free::ID;
            $args['step'] = MS_Controller_Frontend::STEP_PROCESS_PURCHASE;
            $args['_wpnonce'] = wp_create_nonce($args['gateway'] . '_' . $args['ms_relationship_id']);
            $url = esc_url_raw(add_query_arg($args));
            /*
             * Very likely the html output has already began.
             * So we redirect by using javascript.
             */
            ?>
			<script>window.location.href = '<?php 
            echo $url;
            ?>
';</script>
			<?php 
            exit;
        }
        $show_tax = MS_Model_Addon::is_enabled(MS_Addon_Taxamo::ID);
        /**
         * Trigger an action before the payment form is displayed. This hook
         * can be used by Add-ons or plugins to initialize payment settings or
         * add custom code.
         */
        do_action('ms_view_frontend_payment_form_start', $invoice, $this);
        $classes = array('ms-membership-form-wrapper', 'ms-subscription-' . $subscription->id, 'ms-invoice-' . $invoice->id);
        ob_start();
        ?>
		<div class="<?php 
        echo esc_attr(implode(' ', $classes));
        ?>
">
//.........这里部分代码省略.........
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:101,代码来源:class-ms-view-frontend-payment.php


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