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
        }
    }
}
Exemplo n.º 2
0
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;
}
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 &raquo;"), $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">
				<?php 
        global $recaptcha, $recaptcha_publickey;
        if ($recaptcha == 2 || $recaptcha == 1 && pmpro_isLevelFree($pmpro_level)) {
            echo recaptcha_get_html($recaptcha_publickey, NULL, true);
        }
        ?>
								
			</div>
			
			<div>
				<span id="pmpro_submit_span" >
					<input type="hidden" name="submit-checkout" value="1" />		
					<input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php 
        echo $button;
        ?>
" />
				</span>
			</div>	
		</form>
		<?php 
    }
    ?>
	<?php 
    $temp_content = ob_get_contents();
    ob_end_clean();
    return $temp_content;
}
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);
}
Exemplo n.º 5
0
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(']]>', ']]&gt;', $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;
}
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;
}
Exemplo n.º 7
0
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");
            ?>
					<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>
						<input id="fullname" name="fullname" type="text" class="input" size="30" value="" /> <strong>LEAVE THIS BLANK</strong>
					</div>

					<div class="pmpro_captcha">
						<?php 
            global $recaptcha, $recaptcha_publickey;
            if ($recaptcha == 2 || !empty($level) && $recaptcha == 1 && pmpro_isLevelFree(pmpro_getLevel($level))) {
                echo pmpro_recaptcha_get_html($recaptcha_publickey, NULL, true);
            }
            ?>
					</div>
					<?php 
        }
        ?>
			<div>
				<span id="pmpro_submit_span" >
					<input type="hidden" name="submit-checkout" value="1" />
					<input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php 
        echo $button;
        ?>
" />
				</span>
			</div>
			<?php 
        if (!empty($login) && empty($current_user->ID)) {
            ?>
			<div style="text-align:center;">
				<a href="<?php 
            echo wp_login_url(get_permalink());
            ?>
"><?php 
            _e('Log In', 'pmpro');
            ?>
</a>
			</div>
			<?php 
        }
        ?>
		</form>
		<?php 
    }
    ?>
	<?php 
    $temp_content = ob_get_contents();
    ob_end_clean();
    return $temp_content;
}
 /**
  * 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();
 }
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;
}
Exemplo n.º 10
0
function memberlite_page_title()
{
    global $post;
    //capture output
    ob_start();
    //figure out page title
    if (function_exists('is_woocommerce') && is_woocommerce()) {
        woocommerce_breadcrumb();
        ?>
		<h1 class="page-title">
		<?php 
        if (is_shop()) {
            echo get_the_title(get_option('woocommerce_shop_page_id'));
        } elseif (is_archive()) {
            single_cat_title();
        } else {
            the_title();
        }
        ?>
		</h1>
			<?php 
        // Show an optional term description.
        $term_description = woocommerce_product_archive_description();
        if (!empty($term_description)) {
            printf('<div class="taxonomy-description">%s</div>', $term_description);
        }
        woocommerce_taxonomy_archive_description();
    } elseif (is_author() || is_tag() || is_archive()) {
        ?>
			<h1 class="page-title">
			<?php 
        if (is_category()) {
            single_cat_title();
        } elseif (is_tag()) {
            $current_tag = single_tag_title("", false);
            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;
}
Exemplo n.º 11
0
    }
    ?>
			<?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
Exemplo n.º 12
0
 * 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>

function billing_content_func($atts)
{
    global $wpdb, $pmpro_msg, $pmpro_msgt, $pmpro_levels, $current_user, $levels;
    //-> If a member is logged in, show them some info here (1. past invoices. 2. billing information with button to update.)
    if ($current_user->membership_level->ID) {
        if ($pmpro_msg) {
            ?>
            <div class="pmpro_message <?php 
            echo $pmpro_msgt;
            ?>
"><?php 
            echo $pmpro_msg;
            ?>
</div>
            <?php 
        }
        ?>
	
        <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 
        //wpex_logo();
        ?>
                        <!--
                        <div class="clear clearfix"></div>
                        <br/>
                        -->
                        <?php 
        $level = $current_user->membership_level->name;
        ?>
                        <p><?php 
        _e("Membership status: <strong>" . $level . "</strong>", "pmpro");
        ?>
</p>
                        <?php 
        //die(var_dump($current_user));
        ?>
                        <ul>
                            <li><strong><?php 
        _e("Level", "pmpro");
        ?>
:</strong> <?php 
        echo $current_user->membership_level->name;
        ?>
</li>
                            <?php 
        if ($current_user->membership_level->billing_amount > 0) {
            ?>
                                <li><strong><?php 
            _e("Membership Fee", "pmpro");
            ?>
:</strong>
                                    <?php 
            $level = $current_user->membership_level;
            if ($current_user->membership_level->cycle_number > 1) {
                printf(__('%s every %d %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), $level->cycle_number, pmpro_translate_billing_period($level->cycle_period, $level->cycle_number));
            } elseif ($current_user->membership_level->cycle_number == 1) {
                printf(__('%s per %s.', 'pmpro'), pmpro_formatPrice($level->billing_amount), pmpro_translate_billing_period($level->cycle_period));
            } else {
                echo pmpro_formatPrice($current_user->membership_level->billing_amount);
            }
            ?>
                                </li>
                            <?php 
        }
        ?>
						

                            <?php 
        if ($current_user->membership_level->billing_limit) {
            ?>
                                <li><strong><?php 
            _e("Duration", "pmpro");
            ?>
:</strong> <?php 
            echo $current_user->membership_level->billing_limit . ' ' . sornot($current_user->membership_level->cycle_period, $current_user->membership_level->billing_limit);
            ?>
</li>
                            <?php 
        }
        ?>

                            <?php 
        if ($current_user->membership_level->enddate) {
            ?>
                                <li><strong><?php 
            _e("Next billing date", "pmpro");
            ?>
:</strong> <?php 
            echo date_i18n(get_option('date_format'), $current_user->membership_level->enddate);
            ?>
</li>
                            <?php 
        }
        ?>

                            <?php 
        if ($current_user->membership_level->trial_limit == 1) {
            printf(__("Your first payment will cost %s.", "pmpro"), pmpro_formatPrice($current_user->membership_level->trial_amount));
        } elseif (!empty($current_user->membership_level->trial_limit)) {
            printf(__("Your first %d payments will cost %s.", "pmpro"), $current_user->membership_level->trial_limit, pmpro_formatPrice($current_user->membership_level->trial_amount));
        }
        ?>
                        </ul>

                    </div> <!-- end pmpro_account-membership -->

                    <div id="pmpro_account-profile" class="pmpro_box hide">	
                        <?php 
        get_currentuserinfo();
        ?>
 
                        <h3><?php 
        _e("My Account", "pmpro");
        ?>
</h3>
                        <?php 
        if ($current_user->user_firstname) {
            ?>
                            <p><?php 
            echo $current_user->user_firstname;
            ?>
 <?php 
            echo $current_user->user_lastname;
            ?>
</p>
                        <?php 
        }
        ?>
                        <ul>
                            <li><strong><?php 
        _e("Username", "pmpro");
        ?>
:</strong> <?php 
        echo $current_user->user_login;
        ?>
</li>
                            <li><strong><?php 
        _e("Email", "pmpro");
        ?>
:</strong> <?php 
        echo $current_user->user_email;
        ?>
</li>
                        </ul>
                        <p>
                            <a href="<?php 
        echo admin_url('profile.php');
        ?>
"><?php 
        _e("Edit Profile", "pmpro");
        ?>
</a> |
                            <a href="<?php 
        echo admin_url('profile.php');
        ?>
"><?php 
        _ex("Change Password", "As in 'change password'.", "pmpro");
        ?>
</a>
                        </p>
                    </div> <!-- end pmpro_account-profile -->

                    <?php 
        //last invoice for current info
        //$ssorder = $wpdb->get_row("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM $wpdb->pmpro_membership_orders WHERE user_id = '$current_user->ID' AND membership_id = '" . $current_user->membership_level->ID . "' AND status = 'success' ORDER BY timestamp DESC LIMIT 1");
        $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");
        if (!empty($ssorder->id) && $ssorder->gateway != "check" && $ssorder->gateway != "paypalexpress" && $ssorder->gateway != "paypalstandard" && $ssorder->gateway != "twocheckout") {
            //default values from DB (should be last order or last update)
            $bfirstname = get_user_meta($current_user->ID, "pmpro_bfirstname", true);
            $blastname = get_user_meta($current_user->ID, "pmpro_blastname", true);
            $baddress1 = get_user_meta($current_user->ID, "pmpro_baddress1", true);
            $baddress2 = get_user_meta($current_user->ID, "pmpro_baddress2", true);
            $bcity = get_user_meta($current_user->ID, "pmpro_bcity", true);
            $bstate = get_user_meta($current_user->ID, "pmpro_bstate", true);
            $bzipcode = get_user_meta($current_user->ID, "pmpro_bzipcode", true);
            $bcountry = get_user_meta($current_user->ID, "pmpro_bcountry", true);
            $bphone = get_user_meta($current_user->ID, "pmpro_bphone", true);
            $bemail = get_user_meta($current_user->ID, "pmpro_bemail", true);
            $bconfirmemail = get_user_meta($current_user->ID, "pmpro_bconfirmemail", true);
            $CardType = get_user_meta($current_user->ID, "pmpro_CardType", true);
            $AccountNumber = hideCardNumber(get_user_meta($current_user->ID, "pmpro_AccountNumber", true), false);
            $ExpirationMonth = get_user_meta($current_user->ID, "pmpro_ExpirationMonth", true);
            $ExpirationYear = get_user_meta($current_user->ID, "pmpro_ExpirationYear", true);
            ?>
	

                        <div id="pmpro_account-billing" class="pmpro_box">
                            <h3><?php 
            _e("Billing Information", "pmpro");
            ?>
</h3>
                            <?php 
            if (!empty($baddress1)) {
                ?>
                                <p>
                                    <strong><?php 
                _e("Billing Address", "pmpro");
                ?>
</strong><br />
                                    <?php 
                echo $bfirstname . " " . $blastname;
                ?>
                                    <br />		
                                    <?php 
                echo $current_user->user_email;
                ?>
<br />
                                    <?php 
                echo $baddress1;
                ?>
<br />
                                    <?php 
                if ($baddress2) {
                    echo $baddress2 . "<br />";
                }
                ?>
                                    <?php 
                if ($bcity && $bstate) {
                    ?>
                                        <?php 
                    echo $bcity;
                    ?>
, <?php 
                    echo $bstate;
                    ?>
 <?php 
                    echo $bzipcode;
                    ?>
 <?php 
                    echo $bcountry;
                    ?>
                                    <?php 
                }
                ?>
                         
                                    <br />
                                    <?php 
                echo formatPhone($bphone);
                ?>
                                </p>
                            <?php 
            }
            ?>

                            <?php 
            if (!empty($AccountNumber)) {
                ?>
                                <p>
                                    <strong><?php 
                _e("Payment Method", "pmpro");
                ?>
</strong><br />
                                    <?php 
                echo $CardType;
                ?>
: <?php 
                echo last4($AccountNumber);
                ?>
 (<?php 
                echo $ExpirationMonth;
                ?>
/<?php 
                echo $ExpirationYear;
                ?>
)
                                </p>
                            <?php 
            }
            ?>

                            <?php 
            if (isset($ssorder->status) && $ssorder->status == "success" && (isset($ssorder->gateway) && in_array($ssorder->gateway, array("authorizenet", "paypal", "stripe", "braintree", "payflow", "cybersource")))) {
                ?>
                                <p><a href="<?php 
                echo pmpro_url("billing", "");
                ?>
"><?php 
                _e("Edit Billing Information", "pmpro");
                ?>
</a></p>
                                <?php 
            }
            ?>
                        </div> <!-- end pmpro_account-billing -->				
                        <?php 
        }
        ?>

                    <?php 
        if (!empty($invoices)) {
            ?>
                        <div id="pmpro_account-invoices" class="pmpro_box">
                            <h3><?php 
            _e("Past Invoices", "pmpro");
            ?>
</h3>
                            <ul>
                                <?php 
            $count = 0;
            foreach ($invoices as $invoice) {
                if ($count++ > 5) {
                    break;
                }
                ?>
                                    <li><a href="<?php 
                echo pmpro_url("invoice", "?invoice=" . $invoice->code);
                ?>
"><?php 
                echo date_i18n(get_option("date_format"), $invoice->timestamp);
                ?>
 (<?php 
                echo pmpro_formatPrice($invoice->total);
                ?>
)</a></li>
                                    <?php 
            }
            ?>
                            </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 
}
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>
						<input id="fullname" name="fullname" type="text" class="input" size="30" value="" /> <strong>LEAVE THIS BLANK</strong>
					</div>
					
					<div class="pmpro_captcha">
						<?php 
            global $recaptcha, $recaptcha_publickey;
            if ($recaptcha == 2 || $recaptcha == 1 && pmpro_isLevelFree($pmpro_level)) {
                echo recaptcha_get_html($recaptcha_publickey, NULL, true);
            }
            ?>
								
					</div>
					<?php 
        }
        ?>
			<div>
				<span id="pmpro_submit_span" >
					<input type="hidden" name="submit-checkout" value="1" />		
					<input type="submit" class="pmpro_btn pmpro_btn-submit-checkout" value="<?php 
        echo $submit_button;
        ?>
" />
				</span>
			</div>	
		</form>
		<?php 
    }
    ?>
	<?php 
    $temp_content = ob_get_contents();
    ob_end_clean();
    return $temp_content;
}
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;
}