本文整理汇总了PHP中pmpro_getLevel函数的典型用法代码示例。如果您正苦于以下问题:PHP pmpro_getLevel函数的具体用法?PHP pmpro_getLevel怎么用?PHP pmpro_getLevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmpro_getLevel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pap_pmpro_track_sale
function pap_pmpro_track_sale($total, $orderid, $affiliate_code = NULL, $campaign_id = NULL, $channel_id = NULL, $visitor_id = NULL)
{
pap_login();
$saleTracker = new Pap_Api_SaleTracker(URL_TO_PAP . 'scripts/sale.php');
$saleTracker->setAccountId(PAP_ACCOUNT);
if (!empty($visitor_id)) {
$saleTracker->setVisitorId($visitor_id);
}
$sale1 = $saleTracker->createSale();
$sale1->setTotalCost($total);
$sale1->setOrderID($orderid);
$order = new MemberOrder($orderid);
$level_id = $order->membership_id;
$level = pmpro_getLevel($level_id);
$sale1->setProductID(sanitize_title($level->name, "pmpro-level-" . $level_id));
if (!empty($affiliate_code)) {
$sale1->setAffiliateID($affiliate_code);
}
if (!empty($campaign_id)) {
$sale1->setCampaignID($campaign_id);
}
if (!empty($channel_id)) {
$sale1->setChannelID($channel_id);
}
try {
$saleTracker->register();
} catch (Exception $e) {
//die($e->getMessage);
if (current_user_can("manage_options")) {
?>
<p>ERROR: <?php
echo $e->getMessage();
?>
</p>
<?php
} else {
//shhhh... don't let normal users know
}
}
}
示例2: pmpro_getCheckoutButton
function pmpro_getCheckoutButton($level_id, $button_text = NULL, $classes = NULL)
{
if (empty($button_text)) {
$button_text = __("Sign Up for !!name!! Now", "pmpro");
}
if (empty($classes)) {
$classes = "pmpro_btn";
}
if (empty($level_id)) {
$r = __("Please specify a level id.", "pmpro");
} else {
//get level
$level = pmpro_getLevel($level_id);
//replace vars
$replacements = array("!!id!!" => $level->id, "!!name!!" => $level->name, "!!description!!" => $level->description, "!!confirmation!!" => $level->confirmation, "!!initial_payment!!" => $level->initial_payment, "!!billing_amount!!" => $level->billing_amount, "!!cycle_number!!" => $level->cycle_number, "!!cycle_period!!" => $level->cycle_period, "!!billing_limit!!" => $level->billing_limit, "!!trial_amount!!" => $level->trial_amount, "!!trial_limit!!" => $level->trial_limit, "!!expiration_number!!" => $level->expiration_number, "!!expiration_period!!" => $level->expiration_period);
$button_text = str_replace(array_keys($replacements), $replacements, $button_text);
//button text
$r = "<a href=\"" . pmpro_url("checkout", "?level=" . $level_id) . "\" class=\"" . $classes . "\">" . $button_text . "</a>";
}
return $r;
}
示例3: pmprorh_signup_shortcode
function pmprorh_signup_shortcode($atts, $content = null, $code = "")
{
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_signup level="3" short="1" intro="0" button="Signup Now"]
extract(shortcode_atts(array('level' => NULL, 'short' => NULL, 'intro' => true, 'button' => "Signup »"), $atts));
//turn 0's into falses
if ($short === "0" || $short === "false" || $short === "no") {
$short = false;
} else {
$short = true;
}
if ($intro === "0" || $intro === "false" || $intro === "no") {
$intro = false;
} else {
$intro = true;
}
global $current_user, $membership_levels;
ob_start();
?>
<?php
if (!empty($current_user->ID)) {
?>
<p>You are logged in as <?php
echo $current_user->user_login;
?>
.</p>
<?php
} else {
?>
<form class="pmpro_form" action="<?php
echo pmpro_url("checkout");
?>
" method="post">
<?php
if ($intro) {
echo wpautop("Register for " . pmpro_getLevel($level)->name . ".");
}
?>
<input type="hidden" id="level" name="level" value="<?php
echo $level;
?>
" />
<div>
<label for="username">Username</label>
<input id="username" name="username" type="text" class="input" size="30" value="" />
</div>
<?php
do_action("pmpro_checkout_after_username");
?>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="password2_copy" value="1" />
<?php
} else {
?>
<div>
<label for="password2">Confirm Password</label>
<input id="password2" name="password2" type="password" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_password");
?>
<div>
<label for="bemail">E-mail Address</label>
<input id="bemail" name="bemail" type="text" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="bconfirmemail_copy" value="1" />
<?php
} else {
?>
<div>
<label for="bconfirmemail">Confirm E-mail</label>
<input id="bconfirmemail" name="bconfirmemail" type="text" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_email");
?>
<div class="pmpro_hidden">
<label for="fullname">Full Name</label>
<input id="fullname" name="fullname" type="text" class="input" size="30" value="" /> <strong>LEAVE THIS BLANK</strong>
</div>
<div class="pmpro_captcha">
//.........这里部分代码省略.........
示例4: pmprosm_changeMembershipLevelWithCode
function pmprosm_changeMembershipLevelWithCode($level_id, $user_id, $code_id)
{
$child_level = pmpro_getLevel($level_id);
//set the start date to NOW() but allow filters
$startdate = apply_filters("pmpro_checkout_start_date", "NOW()", $user_id, $child_level);
$custom_level = array('user_id' => $user_id, 'membership_id' => $level_id, 'code_id' => $code_id, 'initial_payment' => $child_level->initial_payment, 'billing_amount' => $child_level->billing_amount, 'cycle_number' => $child_level->cycle_number, 'cycle_period' => $child_level->cycle_period, 'billing_limit' => $child_level->billing_limit, 'trial_amount' => $child_level->trial_amount, 'trial_limit' => $child_level->trial_limit, 'startdate' => $startdate, 'enddate' => '');
return pmpro_changeMembershipLevel($custom_level, $user_id);
}
示例5: pmpro_membership_content_filter
function pmpro_membership_content_filter($content, $skipcheck = false)
{
global $post, $current_user;
if (!$skipcheck) {
$hasaccess = pmpro_has_membership_access(NULL, NULL, true);
if (is_array($hasaccess)) {
//returned an array to give us the membership level values
$post_membership_levels_ids = $hasaccess[1];
$post_membership_levels_names = $hasaccess[2];
$hasaccess = $hasaccess[0];
}
}
if ($hasaccess) {
//all good, return content
return $content;
} else {
//if show excerpts is set, return just the excerpt
if (pmpro_getOption("showexcerpts")) {
//show excerpt
global $post;
if ($post->post_excerpt) {
//defined exerpt
$content = wpautop($post->post_excerpt);
} elseif (strpos($content, "<span id=\"more-" . $post->ID . "\"></span>") !== false) {
//more tag
$pos = strpos($content, "<span id=\"more-" . $post->ID . "\"></span>");
$content = wpautop(substr($content, 0, $pos));
} elseif (strpos($content, 'class="more-link">') !== false) {
//more link
$content = preg_replace("/\\<a.*class\\=\"more\\-link\".*\\>.*\\<\\/a\\>/", "", $content);
} else {
//auto generated excerpt. pulled from wp_trim_excerpt
$content = strip_shortcodes($content);
$content = str_replace(']]>', ']]>', $content);
$content = strip_tags($content);
$excerpt_length = apply_filters('excerpt_length', 55);
$words = preg_split("/[\n\r\t ]+/", $content, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if (count($words) > $excerpt_length) {
array_pop($words);
$content = implode(' ', $words);
$content = $content . "... ";
} else {
$content = implode(' ', $words) . "... ";
}
$content = wpautop($content);
}
} else {
//else hide everything
$content = "";
}
if (empty($post_membership_levels_ids)) {
$post_membership_levels_ids = array();
}
if (empty($post_membership_levels_names)) {
$post_membership_levels_names = array();
}
//hide levels which don't allow signups by default
if (!apply_filters("pmpro_membership_content_filter_disallowed_levels", false, $post_membership_levels_ids, $post_membership_levels_names)) {
foreach ($post_membership_levels_ids as $key => $id) {
//does this level allow registrations?
$level_obj = pmpro_getLevel($id);
if (!$level_obj->allow_signups) {
unset($post_membership_levels_ids[$key]);
unset($post_membership_levels_names[$key]);
}
}
}
$pmpro_content_message_pre = '<div class="pmpro_content_message">';
$pmpro_content_message_post = '</div>';
$sr_search = array("!!levels!!", "!!referrer!!");
$sr_replace = array(pmpro_implodeToEnglish($post_membership_levels_names), urlencode(site_url($_SERVER['REQUEST_URI'])));
//get the correct message to show at the bottom
if (is_feed()) {
$newcontent = apply_filters("pmpro_rss_text_filter", stripslashes(pmpro_getOption("rsstext")));
$content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
} elseif ($current_user->ID) {
//not a member
$newcontent = apply_filters("pmpro_non_member_text_filter", stripslashes(pmpro_getOption("nonmembertext")));
$content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
} else {
//not logged in!
$newcontent = apply_filters("pmpro_not_logged_in_text_filter", stripslashes(pmpro_getOption("notloggedintext")));
$content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
}
}
return $content;
}
示例6: pmprowoo_checkout_level_extend_memberships
function pmprowoo_checkout_level_extend_memberships($level_array)
{
$level_obj = pmpro_getLevel($level_array['membership_id']);
//does this level expire? are they an existing user of this level?
if (!empty($level_obj) && !empty($level_obj->expiration_number) && pmpro_hasMembershipLevel($level_obj->id, $level_array['user_id'])) {
//get the current enddate of their membership
$user = get_userdata($level_array['user_id']);
$user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
$expiration_date = $user->membership_level->enddate;
//calculate days left
$todays_date = current_time('timestamp');
$time_left = $expiration_date - $todays_date;
//time left?
if ($time_left > 0) {
//convert to days and add to the expiration date (assumes expiration was 1 year)
$days_left = floor($time_left / (60 * 60 * 24));
//figure out days based on period
if ($level_obj->expiration_period == "Day") {
$total_days = $days_left + $level_obj->expiration_number;
} elseif ($level_obj->expiration_period == "Week") {
$total_days = $days_left + $level_obj->expiration_number * 7;
} elseif ($level_obj->expiration_period == "Month") {
$total_days = $days_left + $level_obj->expiration_number * 30;
} elseif ($level_obj->expiration_period == "Year") {
$total_days = $days_left + $level_obj->expiration_number * 365;
}
//update the end date
$level_array['enddate'] = date("Y-m-d", strtotime("+ {$total_days} Days", $todays_date));
}
}
return $level_array;
}
示例7: pmprorh_signup_shortcode
function pmprorh_signup_shortcode($atts, $content = null, $code = "")
{
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_signup level="3" short="1" intro="0" button="Signup Now"]
//make sure PMPro is activated
if (!function_exists('pmpro_getLevel')) {
return "Paid Memberships Pro must be installed to use the pmpro_signup shortcode.";
}
//default title
if (!empty($level)) {
$default_title = 'Register For ' . pmpro_getLevel($level)->name;
} else {
$default_title = 'Register For ' . get_option('blogname');
}
//set defaults
extract(shortcode_atts(array('button' => "Sign Up Now", 'intro' => "0", 'level' => NULL, 'login' => true, 'short' => NULL, 'title' => $default_title), $atts));
//turn 0's into falses
if ($login === "0" || $login === "false" || $login === "no") {
$login = false;
} else {
$login = true;
}
if ($short === "0" || $short === "false" || $short === "no") {
$short = false;
} else {
$short = true;
}
if ($intro === "0" || $intro === "false" || $intro === "no") {
$intro = false;
}
global $current_user, $membership_levels;
ob_start();
?>
<?php
if (!empty($current_user->ID) && pmpro_hasMembershipLevel($level, $current_user->ID)) {
?>
<p>You are logged in as <?php
echo $current_user->user_login;
?>
.</p>
<?php
} else {
?>
<form class="pmpro_form pmpro_signup_form" action="<?php
echo pmpro_url("checkout");
?>
" method="post">
<h2><?php
echo $title;
?>
</h2>
<?php
if (!empty($intro)) {
echo wpautop($intro);
}
?>
<input type="hidden" id="level" name="level" value="<?php
echo $level;
?>
" />
<?php
if (!empty($current_user->ID)) {
?>
<p id="pmpro_account_loggedin">
<?php
printf(__('You are logged in as <strong>%s</strong>. If you would like to use a different account for this membership, <a href="%s">log out now</a>.', 'pmpro'), $current_user->user_login, wp_logout_url($_SERVER['REQUEST_URI']));
?>
</p>
<?php
} else {
?>
<div>
<label for="username">Username</label>
<input id="username" name="username" type="text" class="input" size="30" value="" />
</div>
<?php
do_action("pmpro_checkout_after_username");
?>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="password2_copy" value="1" />
<?php
} else {
?>
<div>
<label for="password2">Confirm Password</label>
<input id="password2" name="password2" type="password" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_password");
//.........这里部分代码省略.........
示例8: sendBillableInvoiceEmail
/**
* Send billable invoice email.
*
* @since 1.8.6
*
* @param WP_User $user
* @param MemberOrder $order
*
* @return bool Whether the email was sent successfully.
*/
function sendBillableInvoiceEmail($user = NULL, $order = NULL)
{
global $current_user;
if (!$user) {
$user = $current_user;
}
if (!$user || !$order) {
return false;
}
$level = pmpro_getLevel($order->membership_id);
$this->email = $user->user_email;
$this->subject = __('Invoice for Order #: ', 'pmpro') . $order->code;
$this->template = "billable_invoice";
// Load invoice template
if (file_exists(get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-email.php')) {
$template = get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-email.php';
} elseif (file_exists(get_template_directory() . '/paid-memberships-pro/pages/orders-email.php')) {
$template = get_template_directory() . '/paid-memberships-pro/pages/orders-email.php';
} else {
$template = PMPRO_DIR . '/adminpages/templates/orders-email.php';
}
ob_start();
require_once $template;
$invoice = ob_get_contents();
ob_end_clean();
$this->data = array('order_code' => $order->code, 'login_link' => wp_login_url(pmpro_url("account")), 'invoice_link' => wp_login_url(pmpro_url("invoice", "?invoice=" . $order->code)), 'invoice' => $invoice);
return $this->sendEmail();
}
示例9: pmproap_getLevelIDForCheckoutLink
function pmproap_getLevelIDForCheckoutLink($post_id = NULL, $user_id = NULL)
{
global $current_user, $post;
//default to current user
if (empty($user_id) && !empty($current_user) && !empty($current_user->ID)) {
$user_id = $current_user->ID;
}
//default to current post
if (empty($post_id) && !empty($post) && !empty($post->ID)) {
$post_id = $post->ID;
}
//no post, we bail
if (empty($post_id)) {
return false;
}
//no user id? make sure it's null
if (empty($user_id)) {
$user_id = NULL;
}
//use current level or offer a free level checkout
$has_access = pmpro_has_membership_access($post_id, $user_id, true);
$post_levels = $has_access[1];
//make sure membership_level obj is populated
if (is_user_logged_in()) {
$current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
}
if (!empty($current_user->membership_level) && in_array($current_user->membership_level->ID, $post_levels)) {
$text_level_id = $current_user->membership_level->id;
} elseif (!empty($post_levels)) {
//find a free level to checkout with
foreach ($post_levels as $post_level_id) {
$post_level = pmpro_getLevel($post_level_id);
if (pmpro_isLevelFree($post_level)) {
$text_level_id = $post_level->id;
break;
}
}
}
//didn't find a level id to use yet? return false and user's will be linked to the levels page.
if (empty($text_level_id)) {
$text_level_id = false;
}
return $text_level_id;
}
示例10: memberlite_page_title
//.........这里部分代码省略.........
printf(__('Posts Tagged: %s', 'memberlite'), '<span>' . $current_tag . '</span>');
} elseif (is_author()) {
printf(__('Author: %s', 'memberlite'), '<span class="vcard">' . get_the_author() . '</span>');
} elseif (is_day()) {
printf(__('Day: %s', 'memberlite'), '<span>' . get_the_date() . '</span>');
} elseif (is_month()) {
printf(__('Month: %s', 'memberlite'), '<span>' . get_the_date(_x('F Y', 'monthly archives date format', 'memberlite')) . '</span>');
} elseif (is_year()) {
printf(__('Year: %s', 'memberlite'), '<span>' . get_the_date(_x('Y', 'yearly archives date format', 'memberlite')) . '</span>');
} elseif (is_tax('post_format', 'post-format-aside')) {
_e('Asides', 'memberlite');
} elseif (is_tax('post_format', 'post-format-gallery')) {
_e('Galleries', 'memberlite');
} elseif (is_tax('post_format', 'post-format-image')) {
_e('Images', 'memberlite');
} elseif (is_tax('post_format', 'post-format-video')) {
_e('Videos', 'memberlite');
} elseif (is_tax('post_format', 'post-format-quote')) {
_e('Quotes', 'memberlite');
} elseif (is_tax('post_format', 'post-format-link')) {
_e('Links', 'memberlite');
} elseif (is_tax('post_format', 'post-format-status')) {
_e('Statuses', 'memberlite');
} elseif (is_tax('post_format', 'post-format-audio')) {
_e('Audios', 'memberlite');
} elseif (is_tax('post_format', 'post-format-chat')) {
_e('Chats', 'memberlite');
} elseif (bbp_is_forum_archive()) {
_e('Forums', 'memberlite');
} else {
_e('Archives', 'memberlite');
}
?>
</h1>
<?php
// Show an optional term description.
$term_description = term_description();
if (!empty($term_description)) {
printf('<div class="taxonomy-description">%s</div>', $term_description);
}
} elseif (is_search()) {
?>
<h1 class="page-title">
<?php
printf(__('Search Results for: %s', 'memberlite'), '<span>' . get_search_query() . '</span>');
?>
</h1>
<?php
} elseif (is_singular('post')) {
$author_id = $post->post_author;
?>
<div class="masthead-post-byline">
<div class="post_author_avatar"><?php
echo get_avatar($author_id, 80);
?>
</div>
<?php
the_title('<h1 class="entry-title">', '</h1>');
?>
<p class="entry-meta">
<?php
memberlite_posted_on($post);
?>
</p><!-- .entry-meta -->
</div>
<?php
} elseif (is_home()) {
?>
<h1 class="page-title">
<?php
if (get_option('page_for_posts')) {
echo get_the_title(get_option('page_for_posts'));
}
?>
</h1>
<?php
} elseif (is_page_template('templates/landing.php')) {
global $memberlite_landing_page_level, $memberlite_banner_desc, $memberlite_landing_page_checkout_button;
the_post_thumbnail('medium', array('class' => 'alignleft'));
the_title('<h1 class="entry-title">', '</h1>');
if (defined('PMPRO_VERSION')) {
$level = pmpro_getLevel($memberlite_landing_page_level);
if (!empty($level)) {
echo '<p class="pmpro_level-price">' . memberlite_getLevelCost($level, true, true) . '</p>';
if (empty($memberlite_banner_desc)) {
echo wpautop($level->description);
}
echo '<p>' . do_shortcode('[memberlite_btn style="action" href="' . pmpro_url('checkout', '?level=' . $memberlite_landing_page_level, 'https') . '" text="' . $memberlite_landing_page_checkout_button . '"]') . '</p>';
}
}
} else {
the_title('<h1 class="entry-title">', '</h1>');
}
//get captured output
$page_title_html = ob_get_contents();
ob_end_clean();
//filter
$page_title_html = apply_filters('memberlite_page_title', $page_title_html);
echo $page_title_html;
}
示例11: do_action
}
?>
<?php
}
?>
<?php
do_action('after_loop');
?>
</main><!-- #main -->
<?php
do_action('after_main');
?>
</div><!-- #primary -->
<?php
if (defined('PMPRO_VERSION')) {
$level = pmpro_getLevel($memberlite_landing_page_level);
if (!empty($level)) {
do_action('before_sidebar');
?>
<div id="secondary" class="medium-4 columns widget-area" role="complementary">
<?php
do_action('before_sidebar_widgets');
?>
<?php
$memberlite_custom_sidebar = get_post_meta($post->ID, '_memberlite_custom_sidebar', true);
$memberlite_default_sidebar = get_post_meta($post->ID, '_memberlite_default_sidebar', true);
if (empty($memberlite_default_sidebar) || $memberlite_default_sidebar == 'default_sidebar_above') {
echo do_shortcode('[memberlite_signup level="' . $memberlite_landing_page_level . '" short="true" title="Sign Up Now"]');
}
if (!empty($memberlite_custom_sidebar)) {
//Custom sidebar
示例12: die
* Gets the order and displays the print view template.
*
* @since 1.8.6
*/
//only admins can get this
if (!function_exists("current_user_can") || !current_user_can("manage_options") && !current_user_can("pmpro_ordersprint")) {
die(__("You do not have permissions to perform this action.", "pmpro"));
}
// Do we have an order ID?
if (empty($_REQUEST['order'])) {
wp_redirect(admin_url('admin..php?page=pmpro-orders'));
exit;
}
// Get order and membership level.
$order = new MemberOrder($_REQUEST['order']);
$level = pmpro_getLevel($order->membership_id);
// Load template
if (file_exists(get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-print.php')) {
$template = get_stylesheet_directory() . '/paid-memberships-pro/pages/orders-print.php';
} elseif (file_exists(get_template_directory() . '/paid-memberships-pro/pages/orders-print.php')) {
$template = get_template_directory() . '/paid-memberships-pro/pages/orders-print.php';
} else {
$template = PMPRO_DIR . '/adminpages/templates/orders-print.php';
}
require_once $template;
?>
<script>
window.print();
</script>
示例13: billing_content_func
//.........这里部分代码省略.........
</ul>
<?php
//if ($count == 6) {
?>
<p><a href="<?php
echo pmpro_url("invoice");
?>
"><?php
_e("View All Invoices", "pmpro");
?>
</a></p>
<?php
//}
?>
</div> <!-- end pmpro_account-billing -->
<?php
}
?>
<!--
<p class="help-block">We have the following subscriptions available for our site. To join, simply click on the <strong>Change Subscription</strong> button to Change Membership Level.</p>
-->
<?php
//getLevels();
?>
</div> <!-- end pmpro_account -->
<!-- END CONTENT-->
</div>
</div>
<?php
} else {
$user_id = $current_user->ID;
//make sure we only run once a day
$today = date("Y-m-d", current_time("timestamp"));
//look for memberships that expired
$sqlQuery = "SELECT mu.user_id, mu.membership_id, mu.startdate, mu.enddate FROM {$wpdb->pmpro_memberships_users} mu WHERE mu.status = 'expired' AND mu.enddate IS NOT NULL AND mu.enddate <> '' AND mu.enddate <> '0000-00-00 00:00:00' AND DATE(mu.enddate) <= '" . $today . "' AND mu.user_id = '" . $user_id . "' ORDER BY mu.enddate LIMIT 1";
$expired = $wpdb->get_results($sqlQuery);
if (count($expired) > 0) {
?>
<div class="row billing-content">
<div class="col-md-8 col-sm-8 col-sm-offset-3 col-md-offset-3">
<!-- BEGIN CONTENT-->
<div id="pmpro_account">
<div id="pmpro_account-membership" class="pmpro_box-first">
<?php
foreach ($expired as $e) {
$level_id = $e->membership_id;
$level = pmpro_getLevel($level_id);
?>
<div class="pmpro_message">Your "<?php
echo $level->name;
?>
" Membership has expired, please renew now <a href="<?php
echo pmpro_url("levels");
?>
"><?php
_e("here", "pmpro");
?>
</a>.</div>
<div id="pmpro_account-membership" class="pmpro_box-first">
<?php
$level = $current_user->membership_level->name;
?>
<p><?php
_e("Membership status: <strong>" . $level->name . "(Expired)</strong>", "pmpro");
?>
</p>
<ul>
<?php
if ($e->enddate) {
//die(var_dump($e->enddate));
?>
<li><strong><?php
_e("Expiration billing date", "pmpro");
?>
: </strong> <?php
echo " " . date_i18n(get_option('date_format'), strtotime($e->enddate));
?>
</li>
<?php
}
?>
</ul>
</div> <!-- end pmpro_account-membership -->
<?php
}
?>
</div>
</div>
</div>
</div>
<?php
}
}
?>
<?php
}
示例14: memberlitesc_signup_shortcode
function memberlitesc_signup_shortcode($atts, $content = null, $code = "")
{
// $atts ::= array of attributes
// $content ::= text within enclosing form of shortcode element
// $code ::= the shortcode found, when == callback name
// examples: [pmpro_signup level="3" short="1" intro="0" submit_button="Signup Now"]
extract(shortcode_atts(array('level' => NULL, 'title' => NULL, 'short' => NULL, 'intro' => NULL, 'submit_button' => "Sign Up Now"), $atts));
//turn 0's into falses
if ($short == "0" || $short == "false" || $short == "no") {
$short = false;
}
if (empty($title)) {
$title = pmpro_getLevel($level)->name;
}
global $current_user, $membership_levels;
ob_start();
?>
<?php
if (empty($current_user->ID) || !pmpro_hasMembershipLevel($level, $current_user->ID)) {
?>
<form class="pmpro_form memberlite_signup" action="<?php
echo pmpro_url("checkout", "?level=" . $level, "https");
?>
" method="post">
<h2><?php
echo $title;
?>
</h2>
<?php
if (!empty($intro)) {
echo wpautop($intro);
}
?>
<input type="hidden" id="level" name="level" value="<?php
echo $level;
?>
" />
<?php
if (!empty($current_user->ID)) {
?>
<p id="pmpro_account_loggedin">
<?php
printf(__('You are logged in as <strong>%s</strong>. If you would like to use a different account for this membership, <a href="%s">log out now</a>.', 'pmpro'), $current_user->user_login, wp_logout_url($_SERVER['REQUEST_URI']));
?>
</p>
<?php
} else {
?>
<div>
<label for="username">Username</label>
<input id="username" name="username" type="text" class="input" size="30" value="" />
</div>
<?php
do_action("pmpro_checkout_after_username");
?>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="password2_copy" value="1" />
<?php
} else {
?>
<div>
<label for="password2">Confirm Password</label>
<input id="password2" name="password2" type="password" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_password");
?>
<div>
<label for="bemail">E-mail Address</label>
<input id="bemail" name="bemail" type="email" class="input" size="30" value="" />
</div>
<?php
if ($short) {
?>
<input type="hidden" name="bconfirmemail_copy" value="1" />
<?php
} else {
?>
<div>
<label for="bconfirmemail">Confirm E-mail</label>
<input id="bconfirmemail" name="bconfirmemail" type="email" class="input" size="30" value="" />
</div>
<?php
}
?>
<?php
do_action("pmpro_checkout_after_email");
?>
<div class="pmpro_hidden">
<label for="fullname">Full Name</label>
//.........这里部分代码省略.........
示例15: pmprodlm_dlm_no_access_after_message
function pmprodlm_dlm_no_access_after_message($download)
{
global $current_user;
if (function_exists('pmpro_hasMembershipLevel')) {
if (!pmpro_has_membership_access($download->id)) {
$hasaccess = pmpro_has_membership_access($download->id, NULL, true);
if (is_array($hasaccess)) {
//returned an array to give us the membership level values
$post_membership_levels_ids = $hasaccess[1];
$post_membership_levels_names = $hasaccess[2];
$hasaccess = $hasaccess[0];
}
if (empty($post_membership_levels_ids)) {
$post_membership_levels_ids = array();
}
if (empty($post_membership_levels_names)) {
$post_membership_levels_names = array();
}
//hide levels which don't allow signups by default
if (!apply_filters("pmpro_membership_content_filter_disallowed_levels", false, $post_membership_levels_ids, $post_membership_levels_names)) {
foreach ($post_membership_levels_ids as $key => $id) {
//does this level allow registrations?
$level_obj = pmpro_getLevel($id);
if (!$level_obj->allow_signups) {
unset($post_membership_levels_ids[$key]);
unset($post_membership_levels_names[$key]);
}
}
}
$pmpro_content_message_pre = '<div class="pmpro_content_message">';
$pmpro_content_message_post = '</div>';
$content = '';
$sr_search = array("!!levels!!", "!!referrer!!");
$sr_replace = array(pmpro_implodeToEnglish($post_membership_levels_names), urlencode(site_url($_SERVER['REQUEST_URI'])));
//get the correct message to show at the bottom
if ($current_user->ID) {
//not a member
$newcontent = apply_filters("pmpro_non_member_text_filter", stripslashes(pmpro_getOption("nonmembertext")));
$content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
} else {
//not logged in!
$newcontent = apply_filters("pmpro_not_logged_in_text_filter", stripslashes(pmpro_getOption("notloggedintext")));
$content .= $pmpro_content_message_pre . str_replace($sr_search, $sr_replace, $newcontent) . $pmpro_content_message_post;
}
}
}
echo $content;
}