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


PHP pmpro_hasMembershipLevel函数代码示例

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


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

示例1: the_quiz_button

 function the_quiz_button($button, $quiz_id)
 {
     global $post;
     $quiz_id = get_the_ID();
     $user_id = get_current_user_id();
     $flag = 1;
     if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $pid = get_post_meta($quiz_id, 'vibe_quiz_product', true);
         if (isset($pid) && is_numeric($pid) && get_post_type($pid) == 'product') {
             $product_taken = wc_customer_bought_product('', $user_id, $pid);
             if (!$product_taken) {
                 $pid = get_permalink($pid);
                 $check = vibe_get_option('direct_checkout');
                 $check = intval($check);
                 if (isset($check) && $check) {
                     $pid .= '?redirect';
                 }
                 $flag = 0;
                 $html = '<a href="' . $pid . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
         $membership_ids = vibe_sanitize(get_post_meta($quiz_id, 'vibe_quiz_membership', false));
         if (!pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
             $membership_taken = get_user_meta($user_id, $quiz_id, true);
             if (!$membership_taken) {
                 $pmpro_levels_page_id = get_option('pmpro_levels_page_id');
                 $link = get_permalink($pmpro_levels_page_id);
                 $html = '<a href="' . $link . '"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '</a>';
                 $flag = 0;
             } else {
                 $flag = 1;
             }
         }
     }
     if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $points = get_post_meta($quiz_id, 'vibe_quiz_mycred_points', true);
         $mycred = mycred();
         $balance = $mycred->get_users_cred($user_id);
         if ($balance < $points) {
             $flag = 0;
             $html = '<a href="#"class="button create-group-button full"> ' . __('Take this Quiz', 'vibe') . '<span>' . __('<br/>Not enough points.', 'vibe') . '</span></a>';
         }
         if (!$mycred->has_entry('purchase_quiz', $quiz_id, $user_id)) {
             $flag = 1;
             $deduct = -1 * $points;
             $mycred->update_users_balance($user_id, $deduct);
             $mycred->add_to_log('purchase_quiz', $user_id, $deduct, __('Student subscibed to quiz', 'wplms-mycred'), $quiz_id);
         } else {
             $flag = 1;
         }
     }
     if (!$flag) {
         return $html;
     }
     return $button;
 }
开发者ID:VibeThemes,项目名称:wplms_sell_quiz,代码行数:60,代码来源:sell_quiz.php

示例2: sp_user_register

function sp_user_register($user_id)
{
    // check if the new user is a teacher (see Chapter 15 for details)
    if (pmpro_hasMembershipLevel('teacher', $user_id)) {
        // add a new "course" CPT with this user as author
        wp_insert_post(array('post_title' => 'My First Course', 'post_content' => 'This is a sample course...', 'post_author' => $user_id, 'post_status' => 'draft', 'post_type' => 'course'));
    }
}
开发者ID:Cywaithaka,项目名称:bwawwp,代码行数:8,代码来源:example-14.php

示例3: pmpro_checkout_start_date_keep_startdate

function pmpro_checkout_start_date_keep_startdate($startdate, $user_id, $level)
{
    if (pmpro_hasMembershipLevel($level->id, $user_id)) {
        global $wpdb;
        $sqlQuery = "SELECT startdate FROM {$wpdb->pmpro_memberships_users} WHERE user_id = '" . esc_sql($user_id) . "' AND membership_id = '" . esc_sql($level->id) . "' AND status = 'active' ORDER BY id DESC LIMIT 1";
        $old_startdate = $wpdb->get_var($sqlQuery);
        if (!empty($old_startdate)) {
            $startdate = "'" . $old_startdate . "'";
        }
    }
    return $startdate;
}
开发者ID:Seravo,项目名称:wp-paid-subscriptions,代码行数:12,代码来源:filters.php

示例4: pmprobt_wp_footer

function pmprobt_wp_footer()
{
    $options = get_option('pmprobt_options');
    if (empty($options) || empty($options['tracking_code'])) {
        return false;
    }
    //add tracking code
    echo $options['tracking_code'];
    //if user is logged in, identify them
    if (is_user_logged_in()) {
        global $current_user;
        ?>
        <script>
            _bt.identify('<?php 
        echo $current_user->user_id;
        ?>
');
            _bt.person.set({
                'email': '<?php 
        echo $current_user->user_email;
        ?>
',
                'firstName': '<?php 
        echo $current_user->first_name;
        ?>
',
                'lastName': '<?php 
        echo $current_user->last_name;
        ?>
'
            });
            <?php 
        if (function_exists('pmpro_hasMembershipLevel')) {
            if (pmpro_hasMembershipLevel()) {
                ?>
                        _bt.person.set({'membership_level': '<?php 
                echo $current_user->membership_level->id;
                ?>
'});
                        <?php 
            }
        }
        ?>
                    </script>
                <?php 
    }
}
开发者ID:strangerstudios,项目名称:pmpro-boomtrain,代码行数:47,代码来源:pmpro-boomtrain.php

示例5: wplms_unit_check_pmpro_membership

function wplms_unit_check_pmpro_membership($content)
{
    global $post;
    if ($post->post_type != 'unit' || !is_user_logged_in()) {
        return $content;
    }
    $unit_id = $post->ID;
    $user_id = get_current_user_id();
    if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) {
        $membership_ids = get_post_meta($unit_id, 'vibe_pmpro_membership', true);
        if (!empty($membership_ids) && count($membership_ids) >= 1) {
            if (pmpro_hasMembershipLevel($membership_ids, $user_id)) {
                return $content;
            } else {
                $levels = pmpro_getAllLevels($membership_ids);
                foreach ($levels as $level) {
                    $level_array[$level->id] = $level->name;
                }
                $content = 'Please purchase membership plan ';
            }
        }
    }
    return $content;
}
开发者ID:VibeThemes,项目名称:wplms-pmpro-unit-addon,代码行数:24,代码来源:wplms-pmpro-unit-addon.php

示例6: __

                    $form_message_class = 'regular';
                } else {
                    $form_message = __('An error occured while updating. Please check the form and try again.', 'cp');
                    $form_message_class = 'red';
                }
            }
        }
    }
    $student = new Student(get_current_user_id());
    $user_id = get_current_user_id();
    $payment_status = $wpdb->get_var($wpdb->prepare("SELECT status \n\t\tFROM {$wpdb->pmpro_memberships_users} \n\t\tWHERE user_id = %s", $user_id));
    global $pmpro_pages;
    //PMPRO
    global $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
    ob_start();
    if (pmpro_hasMembershipLevel()) {
        $ssorder = new MemberOrder();
        $ssorder->getLastMemberOrder();
        $invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' ORDER BY timestamp DESC LIMIT 6");
        ?>
	
		<div id="pmpro_account">	
			<h5><?php 
        _e("Membership", "pmpro");
        ?>
</h5>
			<div class="row">
				<div class="col-md-4">
					<h6>Level</h6>
					<?php 
        echo $current_user->membership_level->name;
开发者ID:ivan-shulev,项目名称:despreneur-academy,代码行数:31,代码来源:page-settings.php

示例7: get_userdata

        $user = get_userdata($last_subscr_order->user_id);
        if (empty($user) || empty($user->ID)) {
            ipnlog("ERROR: Could not cancel membership. No user attached to order #" . $last_subscr_order->id . " with subscription transaction id = " . $subscr_id . ".");
        } else {
            /*
            	We want to make sure this is a cancel originating from PayPal and not one already handled by PMPro.
            	For example, if a user cancels on WP/PMPro side, we've already cancelled the membership.
            	Also, if a user is changing levels, we don't want to cancel their new membership, just the old subscription at PayPal.
            	
            	So we check 2 things and don't cancel if:
            	(1) This order already has "cancelled" status.
            	(2) The user doesn't currently have the level attached to this order.
            */
            if ($last_subscr_order->status == "cancelled") {
                ipnlog("We've already processed this cancellation. Probably originated from WP/PMPro. (Order #" . $last_subscr_order->id . ", Subscription Transaction ID #" . $subscr_id . ")");
            } elseif (!pmpro_hasMembershipLevel($last_subsc_order->membership_id, $user->ID)) {
                ipnlog("This user has a different level than the one associated with this order. Their membership was probably changed by an admin or through an upgrade/downgrade. (Order #" . $last_subscr_order->id . ", Subscription Transaction ID #" . $subscr_id . ")");
            } else {
                pmpro_changeMembershipLevel(0, $last_subscr_order->user_id, 'cancelled');
                ipnlog("Canceled membership for user with id = " . $last_subscr_order->user_id . ". Subscription transaction id = " . $subscr_id . ".");
                //send an email to the member
                $myemail = new PMProEmail();
                $myemail->sendCancelEmail($user);
                //send an email to the admin
                $myemail = new PMProEmail();
                $myemail->sendCancelAdminEmail($user, $last_subscr_order->membership_id);
            }
        }
        pmpro_ipnExit();
    }
}
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:31,代码来源:ipnhandler.php

示例8: getDailyReport

?>
</h1>
			<div class="arrow bounce"></div>
    	</div>
  	</div>
</div>

<!--BANNER END-->
<div class="clearfix"></div>

<div class="container">
  
  	<div class="row text-center daily-performance">

  		<?php 
if (pmpro_hasMembershipLevel(1) || pmpro_hasMembershipLevel(2)) {
    $reports = getDailyReport();
    ?>

		  	<div class="col-md-4 col-md-offset-2">

			  	<h4>DAILY PROFT / LOSS STATUS</h4>

			  	<?php 
    foreach ($reports as $post) {
        setup_postdata($post);
        ?>

			  		<?php 
        $file = get_field('profit/loss_pdf');
        $filename = $file['title'];
开发者ID:aaronfrey,项目名称:PepperLillie-TAT,代码行数:31,代码来源:page-get-trades.php

示例9: wplms_pmp_pro_connect

function wplms_pmp_pro_connect($course_id, $user_id)
{
    if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
        $membership_ids = vibe_sanitize(get_post_meta($course_id, 'vibe_pmpro_membership', false));
        if (pmpro_hasMembershipLevel($membership_ids, $user_id) && isset($membership_ids) && count($membership_ids) >= 1) {
            $coursetaken = get_user_meta($user_id, $course_id, true);
            if (!isset($coursetaken) || $coursetaken == '') {
                $duration = get_post_meta($course_id, 'vibe_duration', true);
                $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
                $new_duration = time() + $course_duration_parameter * $duration;
                $new_duration = apply_filters('wplms_pmpro_course_check', $new_duration);
                if (update_user_meta($user_id, $course_id, $new_duration)) {
                    bp_course_update_user_course_status($user_id, $course_id, 0);
                    //since version 1.8.4
                    $group_id = get_post_meta($course_id, 'vibe_group', true);
                    if (isset($group_id) && $group_id != '') {
                        groups_join_group($group_id, $user_id);
                    }
                }
            }
        }
    }
}
开发者ID:Nguyenkain,项目名称:Elearning,代码行数:23,代码来源:func.php

示例10: pmpro_shortcode_account

function pmpro_shortcode_account($atts, $content = null, $code = "")
{
    global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
    // $atts    ::= array of attributes
    // $content ::= text within enclosing form of shortcode element
    // $code    ::= the shortcode found, when == callback name
    // examples: [pmpro_account] [pmpro_account sections="membership,profile"/]
    extract(shortcode_atts(array('section' => '', 'sections' => 'membership,profile,invoices,links'), $atts));
    //did they use 'section' instead of 'sections'?
    if (!empty($section)) {
        $sections = $section;
    }
    //turn into an array
    $sections = explode(',', $sections);
    ob_start();
    //if a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
    if (pmpro_hasMembershipLevel()) {
        $ssorder = new MemberOrder();
        $ssorder->getLastMemberOrder();
        $invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' ORDER BY timestamp DESC LIMIT 6");
        ?>
	
	<div id="pmpro_account">		
		
		<?php 
        if (in_array('membership', $sections) || in_array('memberships', $sections)) {
            ?>
			<div id="pmpro_account-membership" class="pmpro_box">
				
				<h3><?php 
            _e("My Memberships", "pmpro");
            ?>
</h3>
				<table width="100%" cellpadding="0" cellspacing="0" border="0">
					<thead>
						<tr>
							<th><?php 
            _e("Level", "pmpro");
            ?>
</th>
							<th><?php 
            _e("Billing", "pmpro");
            ?>
</th>
							<th><?php 
            _e("Expiration", "pmpro");
            ?>
</th>
						</tr>
					</thead>
					<tbody>
						<?php 
            //TODO: v2.0 will loop through levels here
            $level = $current_user->membership_level;
            ?>
						<tr>
							<td class="pmpro_account-membership-levelname">
								<?php 
            echo $current_user->membership_level->name;
            ?>
								<div class="pmpro_actionlinks">
									<?php 
            do_action("pmpro_member_action_links_before");
            ?>
									
									<?php 
            if (pmpro_isLevelExpiringSoon($current_user->membership_level)) {
                ?>
										<a href="<?php 
                echo pmpro_url("checkout", "?level=" . $current_user->membership_level->id, "https");
                ?>
"><?php 
                _e("Renew", "pmpro");
                ?>
</a>
									<?php 
            }
            ?>

									<?php 
            if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) {
                ?>
										<a href="<?php 
                echo pmpro_url("billing", "", "https");
                ?>
"><?php 
                _e("Update Billing Info", "pmpro");
                ?>
</a>
									<?php 
            }
            ?>
									
									<?php 
            //To do: Only show CHANGE link if this level is in a group that has upgrade/downgrade rules
            if (count($pmpro_levels) > 1 && !defined("PMPRO_DEFAULT_LEVEL")) {
                ?>
										<a href="<?php 
                echo pmpro_url("levels");
                ?>
//.........这里部分代码省略.........
开发者ID:mathieuhays,项目名称:paid-memberships-pro,代码行数:101,代码来源:pmpro_account.php

示例11: pmprorh_checkFieldForLevel

function pmprorh_checkFieldForLevel($field, $scope = "default", $args = NULL)
{
    if (!empty($field->levels)) {
        if ($scope == "profile") {
            //expecting the args to be the user id
            if (pmpro_hasMembershipLevel($field->levels, $args)) {
                return true;
            } else {
                return false;
            }
        } else {
            //check against $_REQUEST
            if (!empty($_REQUEST['level'])) {
                if (in_array($_REQUEST['level'], $field->levels)) {
                    return true;
                } else {
                    return false;
                }
            } else {
                return false;
            }
        }
    }
    return true;
}
开发者ID:jcm,项目名称:pmpro-register-helper,代码行数:25,代码来源:pmpro-register-helper.php

示例12: pmproap_pmpro_level_cost_text

function pmproap_pmpro_level_cost_text($text, $level)
{
    global $pmpro_pages;
    //only checkout page, with ap passed in, and have the level checking out for
    if (is_page($pmpro_pages['checkout']) && !empty($_REQUEST['ap']) && pmpro_hasMembershipLevel($level->id)) {
        $text = str_replace(__("The price for membership", "pmproap"), __("The price is", "pmproap"), $text);
        $text = str_replace(__(" now", "pmproap"), "", $text);
    }
    return $text;
}
开发者ID:greathmaster,项目名称:pmpro-addon-packages,代码行数:10,代码来源:pmpro-addon-packages.php

示例13: modify_nav_menu_args

function modify_nav_menu_args($args)
{
    //make sure PMPro is active
    if (!function_exists('pmpro_hasMembershipLevel')) {
        return $args;
    }
    //if not a member, return original
    if (!pmpro_hasMembershipLevel()) {
        return $args;
    }
    //get current user's level id
    global $current_user;
    $level = pmpro_getMembershipLevelForUser($current_user->ID);
    $level_id = $level->id;
    //get all menus
    $menus = get_registered_nav_menus();
    //reverse so level menus come first
    $menus = array_reverse($menus);
    //look for a member version of this and swap it in
    foreach ($menus as $location => $description) {
        if ($location == "members-" . $args['theme_location'] && has_nav_menu("members-" . $args['theme_location']) || $location == "members-" . $level_id . "-" . $args['theme_location'] && has_nav_menu("members-" . $level_id . "-" . $args['theme_location'])) {
            $args['theme_location'] = $location;
            break;
        }
    }
    return $args;
}
开发者ID:greathmaster,项目名称:pmpro-nav-menus,代码行数:27,代码来源:pmpro-nav-menus.php

示例14: pmpro_changeMembershipLevel

/**
 * Create, add, remove or updates the membership level of the given user to the given level.
 *
 * $level may either be the ID or name of the desired membership_level.
 * If $user_id is omitted, the value will be retrieved from $current_user.
 *
 * @param int $level ID of level to set as new level, use 0 to cancel membership
 * @param int $user_id ID of the user to change levels for
 * @param string $old_level_status The status to set for the row in the memberships users table. (e.g. inactive, cancelled, admin_cancelled, expired) Defaults to 'inactive'.
 * $param int $cancel_level If set cancel just this one level instead of all active levels (to support Multiple Memberships per User)
 *
 * Return values:
 *		Success returns boolean true.
 *		Failure returns boolean false.
 */
function pmpro_changeMembershipLevel($level, $user_id = NULL, $old_level_status = 'inactive', $cancel_level = NULL)
{
    global $wpdb;
    global $current_user, $pmpro_error;
    if (empty($user_id)) {
        $user_id = $current_user->ID;
    }
    if (empty($user_id)) {
        $pmpro_error = __("User ID not found.", "pmpro");
        return false;
    }
    //make sure user id is int for security
    $user_id = intval($user_id);
    if (empty($level)) {
        $level = 0;
    } else {
        if (is_array($level)) {
            //custom level
        } else {
            $level_obj = pmpro_getLevel($level);
            if (empty($level_obj)) {
                $pmpro_error = __("Invalid level.", "pmpro");
                return false;
            }
            $level = $level_obj->id;
        }
    }
    //if it's a custom level, they're changing
    if (!is_array($level)) {
        //are they even changing?
        if (pmpro_hasMembershipLevel($level, $user_id)) {
            $pmpro_error = __("not changing?", "pmpro");
            return false;
            //not changing
        }
    }
    //get all active membershipships for this user
    $old_levels = pmpro_getMembershipLevelsForUser($user_id);
    //get level id
    if (is_array($level)) {
        $level_id = $level['membership_id'];
    } else {
        $level_id = $level;
    }
    //just id
    /**
     * Action to run before the membership level changes.
     *
     * @param int $level_id ID of the level changed to.
     * @param int $user_id ID of the user changed.
     * @param array $old_levels array of prior levels the user belonged to.
     * $param int $cancel_level ID of the level being cancelled if specified
     */
    do_action("pmpro_before_change_membership_level", $level_id, $user_id, $old_levels, $cancel_level);
    //deactivate old memberships based on the old_level_status passed in (updates pmpro_memberships_users table)
    $pmpro_deactivate_old_levels = true;
    /**
     * Filter whether old levels should be deactivated or not. This supports the MMPU addon.
     * Typically you'll want to hook into pmpro_before_change_membership_level 
     * or pmpro_after_change_membership_level later to run your own deactivation logic.
     * 
     * @since  1.8.11
     * @var $pmpro_deactivate_old_levels bool True or false if levels should be deactivated. Defaults to true.
     */
    $pmpro_deactivate_old_levels = apply_filters("pmpro_deactivate_old_levels", $pmpro_deactivate_old_levels);
    //make sure we deactivate the specified level if it's passed in
    if (!empty($cancel_level)) {
        $pmpro_deactivate_old_levels = true;
        $new_old_levels = array();
        foreach ($old_levels as $key => $old_level) {
            if ($old_level->id == $cancel_level) {
                $new_old_levels[] = $old_levels[$key];
                break;
            }
        }
        $old_levels = $new_old_levels;
    }
    if ($old_levels && $pmpro_deactivate_old_levels) {
        foreach ($old_levels as $old_level) {
            $sql = "UPDATE {$wpdb->pmpro_memberships_users} SET `status`='{$old_level_status}', `enddate`='" . current_time('mysql') . "' WHERE `id`=" . $old_level->subscription_id;
            if (!$wpdb->query($sql)) {
                $pmpro_error = __("Error interacting with database", "pmpro") . ": " . ($wpdb->last_error ? $wpdb->last_error : 'unavailable');
                return false;
            }
        }
//.........这里部分代码省略.........
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:101,代码来源:functions.php

示例15: pmpromd_profile_preheader

function pmpromd_profile_preheader()
{
    global $post, $pmpro_pages, $current_user;
    if (!empty($post->ID) && $post->ID == $pmpro_pages['profile']) {
        /*
        	Preheader operations here.
        */
        global $main_post_id;
        $main_post_id = $post->ID;
        //Get the profile user
        if (!empty($_REQUEST['pu']) && is_numeric($_REQUEST['pu'])) {
            $pu = get_user_by('id', $_REQUEST['pu']);
        } elseif (!empty($_REQUEST['pu'])) {
            $pu = get_user_by('slug', $_REQUEST['pu']);
        } elseif (!empty($current_user->ID)) {
            $pu = $current_user;
        } else {
            $pu = false;
        }
        //If no profile user, go to directory or home
        if (empty($pu) || empty($pu->ID)) {
            if (!empty($pmpro_pages['directory'])) {
                wp_redirect(get_permalink($pmpro_pages['directory']));
            } else {
                wp_redirect(home_url());
            }
            exit;
        }
        /*
        	If a level is required for the profile page, make sure the profile user has it.
        */
        //check is levels are required
        $levels = pmpro_getMatches("/ levels?=[\"']([^\"^']*)[\"']/", $post->post_content, true);
        if (!empty($levels) && !pmpro_hasMembershipLevel(explode(",", $levels), $pu->ID)) {
            if (!empty($pmpro_pages['directory'])) {
                wp_redirect(get_permalink($pmpro_pages['directory']));
            } else {
                wp_redirect(home_url());
            }
            exit;
        }
        /*
        	Update the head title and H1
        */
        function pmpromd_the_title($title, $post_id = NULL)
        {
            global $main_post_id, $current_user;
            if ($post_id == $main_post_id) {
                if (!empty($_REQUEST['pu'])) {
                    global $wpdb;
                    $user_nicename = $_REQUEST['pu'];
                    $display_name = $wpdb->get_var("SELECT display_name FROM {$wpdb->users} WHERE user_nicename = '" . esc_sql($user_nicename) . "' LIMIT 1");
                } elseif (!empty($current_user)) {
                    $display_name = $current_user->display_name;
                }
                if (!empty($display_name)) {
                    $title = $display_name;
                }
            }
            return $title;
        }
        add_filter("the_title", "pmpromd_the_title", 10, 2);
        function pmpromd_wp_title($title, $sep)
        {
            global $wpdb, $main_post_id, $post, $current_user;
            if ($post->ID == $main_post_id) {
                if (!empty($_REQUEST['pu'])) {
                    $user_nicename = $_REQUEST['pu'];
                    $display_name = $wpdb->get_var("SELECT display_name FROM {$wpdb->users} WHERE user_nicename = '" . esc_sql($user_nicename) . "' LIMIT 1");
                } elseif (!empty($current_user)) {
                    $display_name = $current_user->display_name;
                }
                if (!empty($display_name)) {
                    $title = $display_name . ' ' . $sep . ' ';
                }
                $title .= get_bloginfo('name');
            }
            return $title;
        }
        add_filter("wp_title", "pmpromd_wp_title", 10, 2);
    }
}
开发者ID:greathmaster,项目名称:pmpro-member-directory,代码行数:82,代码来源:profile.php


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