function pmpro_upgrade_1_8_9_3_ajax()
{
    global $wpdb;
    $debug = false;
    $run = true;
    //some vars
    $all_levels = pmpro_getAllLevels(true, true);
    //keeping track of which user we're working on
    $last_user_id = get_option('pmpro_upgrade_1_8_9_3_last_user_id', 0);
    //get all active users during the period where things may have been broken
    $user_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' AND user_id > {$last_user_id} ORDER BY user_id LIMIT 10");
    //track progress
    $first_load = get_transient('pmpro_updates_first_load');
    if ($first_load) {
        $total_users = $wpdb->get_var("SELECT COUNT(user_id) FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND modified > '2016-05-19' ORDER BY user_id");
        update_option('pmpro_upgrade_1_8_9_3_total', $total_users, 'no');
        $progress = 0;
    } else {
        $total_users = get_option('pmpro_upgrade_1_8_9_3_total', 0);
        $progress = get_option('pmpro_upgrade_1_8_9_3_progress', 0);
    }
    update_option('pmpro_upgrade_1_8_9_3_progress', $progress + count($user_ids), 'no');
    global $pmpro_updates_progress;
    if ($total_users > 0) {
        $pmpro_updates_progress = "[" . $progress . "/" . $total_users . "]";
    } else {
        $pmpro_updates_progress = "";
    }
    if (empty($user_ids)) {
        //done with this update
        pmpro_removeUpdate('pmpro_upgrade_1_8_9_3_ajax');
        delete_option('pmpro_upgrade_1_8_9_3_last_user_id');
        delete_option('pmpro_upgrade_1_8_9_3_total');
        delete_option('pmpro_upgrade_1_8_9_3_progress');
    } else {
        foreach ($user_ids as $user_id) {
            $last_user_id = $user_id;
            //keeping track of the last user we processed
            $user = get_userdata($user_id);
            //user not found for some reason
            if (empty($user)) {
                if ($debug) {
                    echo "User #" . $user_id . " not found.\n";
                }
                continue;
            }
            //get level
            $user->membership_level = pmpro_getMembershipLevelForUser($user->ID);
            //has a start and end date already
            if (!empty($user->membership_level->enddate) && !empty($user->membership_level->startdate)) {
                if ($debug) {
                    echo "User #" . $user_id . ", " . $user->user_email . " already has a start and end date.\n";
                }
                continue;
            }
            //get order
            $last_order = new MemberOrder();
            $last_order->getLastMemberOrder();
            /*
            	Figure out if this user should have been given an end date.
            	The level my have an end date.
            	They might have used a discount code.
            	They might be using the set-expiration-dates code.
            	They might have custom code setting the end date.
            
            	Let's setup some vars as if we are at checkout.
            	Then pass recreate the level with the pmpro_checkout_level filter.
            	And use the end date there if there is one.
            */
            global $pmpro_level, $discount_code, $discount_code_id;
            //level
            $level_id = $user->membership_level->id;
            $_REQUEST['level'] = $level_id;
            //gateway
            if (!empty($last_order) && !empty($last_order->gateway)) {
                $_REQUEST['gateway'] = $last_order->gateway;
            } else {
                $_REQUEST['gateway'] = pmpro_getGateway();
            }
            //discount code
            $discount_code_id = $user->membership_level->code_id;
            $discount_code = $wpdb->get_var("SELECT code FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . $discount_code_id . "' LIMIT 1");
            //get level
            if (!empty($discount_code_id)) {
                $sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level_id . "' LIMIT 1";
                $pmpro_level = $wpdb->get_row($sqlQuery);
                //if the discount code doesn't adjust the level, let's just get the straight level
                if (empty($pmpro_level)) {
                    $pmpro_level = $all_levels[$level_id];
                }
                //filter adjustments to the level
                $pmpro_level->code_id = $discount_code_id;
                $pmpro_level = apply_filters("pmpro_discount_code_level", $pmpro_level, $discount_code_id);
            }
            //no level yet, use default
            if (empty($pmpro_level)) {
                $pmpro_level = $all_levels[$level_id];
            }
            //no level for some reason
            if (empty($pmpro_level) && empty($pmpro_level->id)) {
                if ($debug) {
                    echo "No level found with ID #" . $level_id . " for user #" . $user_id . ", " . $user->user_email . ".\n";
                }
                continue;
            }
            //filter level
            $pmpro_level = apply_filters("pmpro_checkout_level", $pmpro_level);
            if ($debug) {
                echo "User #" . $user_id . ", " . $user->user_email . ". Fixing.\n";
            }
            //calculate and fix start date
            if (empty($user->membership_level->startdate)) {
                $startdate = $wpdb->get_var("SELECT modified FROM {$wpdb->pmpro_memberships_users} WHERE user_id = {$user_id} AND membership_id = {$level_id} AND status = 'active' LIMIT 1");
                //filter
                $filtered_startdate = apply_filters("pmpro_checkout_start_date", $startdate, $user_id, $pmpro_level);
                //only use filtered value if it's not 0
                if (!empty($filtered_startdate) && $filtered_startdate != '0000-00-00 00:00:00' && $filtered_startdate != "'0000-00-00 00:00:00'") {
                    $startdate = $filtered_startdate;
                }
                if ($debug) {
                    echo "- Adding startdate " . $startdate . ".\n";
                }
                if ($run) {
                    $sqlQuery = "UPDATE {$wpdb->pmpro_memberships_users} SET startdate = '" . esc_sql($startdate) . "' WHERE user_id = {$user_id} AND membership_id = {$level_id} AND status = 'active' LIMIT 1";
                    $wpdb->query($sqlQuery);
                }
            } else {
                $startdate = date_i18n("Y-m-d", $user->membership_level->startdate);
            }
            //calculate and fix the end date
            if (empty($user->membership_level->enddate)) {
                if (!empty($pmpro_level->expiration_number)) {
                    $enddate = date_i18n("Y-m-d", strtotime("+ " . $pmpro_level->expiration_number . " " . $pmpro_level->expiration_period, $last_order->timestamp));
                } else {
                    $enddate = "NULL";
                }
                $enddate = apply_filters("pmpro_checkout_end_date", $enddate, $user_id, $pmpro_level, $startdate);
                if (!empty($enddate) && $enddate != "NULL") {
                    if ($debug) {
                        echo "- Adding enddate " . $enddate . ".\n";
                    }
                    if ($run) {
                        $sqlQuery = "UPDATE {$wpdb->pmpro_memberships_users} SET enddate = '" . esc_sql($enddate) . "' WHERE user_id = {$user_id} AND membership_id = {$level_id} AND status = 'active' LIMIT 1";
                        $wpdb->query($sqlQuery);
                    }
                }
            }
            //clear vars for next pass
            $user_id = NULL;
            $level_id = NULL;
            $discount_code = NULL;
            $discount_code_id = NULL;
            $pmpro_level = NULL;
            $last_order = NULL;
            $startdate = NULL;
            $filtered_startdate = NULL;
            $enddate = NULL;
            echo "\n";
        }
        update_option('pmpro_upgrade_1_8_9_3_last_user_id', $last_user_id, 'no');
    }
}
    function pmpro_levels($course_id = null)
    {
        if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) {
            $levels = pmpro_getAllLevels();
            // Get all the PMPro Levels
            ?>
          <li class="course_membership"><strong><?php 
            _e('Set Course Memberships', 'wplms-front-end');
            ?>
<span>
                  <select id="vibe_pmpro_membership" class="chosen" multiple>
                      <?php 
            if (isset($levels) && is_array($levels)) {
                foreach ($levels as $level) {
                    if (!is_Array($course_pricing['vibe_pmpro_membership'])) {
                        $course_pricing['vibe_pmpro_membership'] = array();
                    }
                    if (is_object($level)) {
                        echo '<option value="' . $level->id . '" ' . (in_array($level->id, $course_pricing['vibe_pmpro_membership']) ? 'selected' : '') . '>' . $level->name . '</option>';
                    }
                }
            }
            ?>
                  </select>
              </span>
              </strong>
          </li>
      <?php 
        }
    }
/**
 * Register settings sections and fields.
 *
 * @since 0.3.0
 */
function pmprolpv_admin_init()
{
    // Register limits settings section.
    add_settings_section('pmprolpv_limits', 'Membership Post View Limits', 'pmprolpv_settings_section_limits', 'pmpro-limitpostviews');
    // Register redirection settings section.
    add_settings_section('pmprolpv_redirection', 'Redirection', 'pmprolpv_settings_section_redirection', 'pmpro-limitpostviews');
    // Register limits settings fields.
    $levels = pmpro_getAllLevels(true, true);
    $levels[0] = new stdClass();
    $levels[0]->name = __('Non-members', 'pmpro');
    asort($levels);
    foreach ($levels as $id => $level) {
        $title = $level->name;
        add_settings_field('pmprolpv_limit_' . $id, $title, 'pmprolpv_settings_field_limits', 'pmpro-limitpostviews', 'pmprolpv_limits', $id);
        // Register JavaScript setting.
        register_setting('pmpro-limitpostviews', 'pmprolpv_limit_' . $id, 'pmprolpv_sanitize_limit');
    }
    // Register redirection settings field.
    add_settings_field('pmprolpv_redirect_page', 'Redirect to', 'pmprolpv_settings_field_redirect_page', 'pmpro-limitpostviews', 'pmprolpv_redirection');
    // Register redirection setting.
    register_setting('pmpro-limitpostviews', 'pmprolpv_redirect_page');
    // Register JavaScript settings field.
    add_settings_field('pmprolpv_use_js', 'Use JavaScript redirection', 'pmprolpv_settings_field_use_js', 'pmpro-limitpostviews', 'pmprolpv_redirection');
    // Register JavaScript setting.
    register_setting('pmpro-limitpostviews', 'pmprolpv_use_js');
}
Esempio n. 4
0
 function wplms_sell_quiz_as_product($metabox)
 {
     if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $metabox['vibe_quiz_product'] = array('label' => __('Associated Product', 'vibe-customtypes'), 'desc' => __('Associated Product with the Course.', 'vibe-customtypes'), 'id' => 'vibe_quiz_product', 'type' => 'selectcpt', 'post_type' => 'product', 'std' => '');
     }
     if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && is_user_logged_in()) {
         $levels = pmpro_getAllLevels();
         foreach ($levels as $level) {
             $level_array[] = array('value' => $level->id, 'label' => $level->name);
         }
         $metabox['vibe_quiz_pmpro_membership'] = array('label' => __('PMPro Membership', 'vibe-customtypes'), 'desc' => __('Required Membership level for this quiz', 'vibe-customtypes'), 'id' => 'vibe_quiz_pmpro_membership', 'type' => 'multiselect', 'options' => $level_array);
     }
     if (in_array('wplms-mycred-addon/wplms-mycred-addon.php', apply_filters('active_plugins', get_option('active_plugins')))) {
         $metabox['vibe_quiz_mycred_points'] = array('label' => __('MyCred Points', 'vibe-customtypes'), 'desc' => __('MyCred Points required to take this quiz.', 'vibe-customtypes'), 'id' => 'vibe_quiz_mycred_points', 'type' => 'number');
     }
     return $metabox;
 }
Esempio n. 5
0
function pmproet_admin_init_test_order()
{
    global $current_user, $pmproet_test_order_id;
    //make sure PMPro is activated
    if (!class_exists('MemberOrder')) {
        return;
    }
    $pmproet_test_order_id = get_option('pmproet_test_order_id');
    $test_order = new MemberOrder($pmproet_test_order_id);
    if (empty($test_order->id)) {
        $all_levels = pmpro_getAllLevels();
        if (!empty($all_levels)) {
            $first_level = array_shift($all_levels);
            $test_order->membership_id = $first_level->id;
            $test_order->InitialPayment = $first_level->initial_payment;
        } else {
            $test_order->membership_id = 1;
            $test_order->InitialPayment = 1;
        }
        $test_order->user_id = $current_user->ID;
        $test_order->cardtype = "Visa";
        $test_order->accountnumber = "4111111111111111";
        $test_order->expirationmonth = date('m', current_time('timestamp'));
        $test_order->expirationyear = intval(date('Y', current_time('timestamp'))) + 1;
        $test_order->ExpirationDate = $test_order->expirationmonth . $test_order->expirationyear;
        $test_order->CVV2 = '123';
        $test_order->FirstName = 'Jane';
        $test_order->LastName = 'Doe';
        $test_order->Address1 = '123 Street';
        $test_order->billing = new stdClass();
        $test_order->billing->name = 'Jane Doe';
        $test_order->billing->street = '123 Street';
        $test_order->billing->city = 'City';
        $test_order->billing->state = 'ST';
        $test_order->billing->country = 'US';
        $test_order->billing->zip = '12345';
        $test_order->billing->phone = '5558675309';
        $test_order->gateway_environment = 'sandbox';
        $test_order->notes = __('This is a test order used with the PMPro Email Templates addon.', 'pmpro');
        $test_order->saveOrder();
        $pmproet_test_order_id = $test_order->id;
        update_option('pmproet_test_order_id', $pmproet_test_order_id);
    }
}
function register_my_members_menu()
{
    //make sure PMPro is activated
    if (!function_exists('pmpro_getAllLevels')) {
        return;
    }
    $my_theme = wp_get_theme();
    $menus = get_registered_nav_menus();
    foreach ($menus as $location => $description) {
        register_nav_menu('members-' . $location, __($description . ' - Members', $my_theme->get('Template')));
        $levels = pmpro_getAllLevels(true, true);
        foreach ($levels as $level) {
            $level_nav_menu = get_option('pmpro_nav_menu_hidden_level_' . $level->id, false);
            if (!empty($level_nav_menu)) {
                register_nav_menu('members-' . $level->id . '-' . $location, __($description . ' - ' . $level->name . ' Members', 'pmpro'));
            }
        }
    }
}
Esempio n. 7
0
    public function javo_item_price_callback($atts, $content = "")
    {
        global $post;
        $temp = $post;
        $errors = new wp_error();
        if (!defined('PMPRO_VERSION')) {
            $errors->add('test-error', __('Please activate "Paid Membership Pro" plugin to use price table shortcodes.', 'javo_fr'));
        }
        extract(shortcode_atts(array('title' => '', 'sub_title' => '', 'title_text_color' => '#000', 'sub_title_text_color' => '#000', 'line_color' => '#fff'), $atts));
        if ($errors->get_error_code() != null) {
            ob_start();
            ?>
			<div class="alert alert-danger">
				<strong><?php 
            _e('Error!', 'javo_fr');
            ?>
</strong>
				<div><?php 
            echo $errors->get_error_message();
            ?>
</div>
			</div>
			<?php 
            return ob_get_clean();
        }
        $pmpro_levels = pmpro_getAllLevels();
        ob_start();
        echo apply_filters('javo_shortcode_title', $title, $sub_title, array('title' => 'color:' . $title_text_color . ';', 'subtitle' => 'color:' . $sub_title_text_color . ';', 'line' => 'border-color:' . $line_color . ';'));
        $post->post_content = "[pmpro_levels]";
        if (function_exists('pmpro_wp')) {
            pmpro_wp();
        }
        echo do_shortcode('[pmpro_levels]');
        $post = $temp;
        return ob_get_clean();
    }
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;
}
<?php

global $wpdb, $pmpro_msg, $pmpro_msgt, $current_user;
$pmpro_levels = pmpro_getAllLevels(false, true);
$pmpro_level_order = pmpro_getOption('level_order');
if (!empty($pmpro_level_order)) {
    $order = explode(',', $pmpro_level_order);
    //reorder array
    $reordered_levels = array();
    foreach ($order as $level_id) {
        foreach ($pmpro_levels as $key => $level) {
            if ($level_id == $level->id) {
                $reordered_levels[] = $pmpro_levels[$key];
            }
        }
    }
    $pmpro_levels = $reordered_levels;
}
$pmpro_levels = apply_filters("pmpro_levels_array", $pmpro_levels);
if ($pmpro_msg) {
    ?>
<div class="pmpro_message <?php 
    echo $pmpro_msgt;
    ?>
"><?php 
    echo $pmpro_msg;
    ?>
</div>
<?php 
}
?>
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;
    }
    //Extract the user-defined sections for the shortcode
    $sections = array_map('trim', 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();
        $mylevels = pmpro_getMembershipLevelsForUser();
        $pmpro_levels = pmpro_getAllLevels(false, true);
        // just to be sure - include only the ones that allow signups
        $invoices = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(timestamp) as timestamp FROM {$wpdb->pmpro_membership_orders} WHERE user_id = '{$current_user->ID}' AND status NOT IN('refunded', 'review', 'token', 'error') 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 
            foreach ($mylevels as $level) {
                ?>
						<tr>
							<td class="pmpro_account-membership-levelname">
								<?php 
                echo $level->name;
                ?>
								<div class="pmpro_actionlinks">
									<?php 
                do_action("pmpro_member_action_links_before");
                ?>
									
									<?php 
                if (array_key_exists($level->id, $pmpro_levels) && pmpro_isLevelExpiringSoon($level)) {
                    ?>
										<a href="<?php 
                    echo pmpro_url("checkout", "?level=" . $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"))) && pmpro_isLevelRecurring($level)) {
                    ?>
										<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");
                    ?>
"><?php 
                    _e("Change", "pmpro");
                    ?>
</a>
									<?php 
                }
                ?>
									<a href="<?php 
                echo pmpro_url("cancel", "?levelstocancel=" . $level->id);
                ?>
"><?php 
                _e("Cancel", "pmpro");
                ?>
</a>
									<?php 
                do_action("pmpro_member_action_links_after");
                ?>
								</div> <!-- end pmpro_actionlinks -->
							</td>
							<td class="pmpro_account-membership-levelfee">
								<p><?php 
                echo pmpro_getLevelCost($level, true, true);
                ?>
</p>
							</td>
							<td class="pmpro_account-membership-expiration">
							<?php 
                if ($level->enddate) {
                    echo date_i18n(get_option('date_format'), $level->enddate);
                } else {
                    echo "---";
                }
                ?>
							</td>
						</tr>
						<?php 
            }
            ?>
					</tbody>
				</table>
				<?php 
            //Todo: If there are multiple levels defined that aren't all in the same group defined as upgrades/downgrades
            ?>
				<div class="pmpro_actionlinks">
					<a href="<?php 
            echo pmpro_url("levels");
            ?>
"><?php 
            _e("View all Membership Options", "pmpro");
            ?>
</a>
				</div>

			</div> <!-- end pmpro_account-membership -->
		<?php 
        }
        ?>
		
		<?php 
        if (in_array('profile', $sections)) {
            ?>
			<div id="pmpro_account-profile" class="pmpro_box">	
				<?php 
            wp_get_current_user();
            ?>
 
				<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>
					<?php 
            do_action('pmpro_account_bullets_top');
            ?>
					<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>
					<?php 
            do_action('pmpro_account_bullets_bottom');
            ?>
				</ul>
				<div class="pmpro_actionlinks">
					<a href="<?php 
            echo admin_url('profile.php');
            ?>
"><?php 
            _e("Edit Profile", "pmpro");
            ?>
</a>
					<a href="<?php 
            echo admin_url('profile.php');
            ?>
"><?php 
            _e('Change Password', 'pmpro');
            ?>
</a>
				</div>
			</div> <!-- end pmpro_account-profile -->
		<?php 
        }
        ?>
	
		<?php 
        if (in_array('invoices', $sections) && !empty($invoices)) {
            ?>
		
		<div id="pmpro_account-invoices" class="pmpro_box">
			<h3><?php 
            _e("Past Invoices", "pmpro");
            ?>
</h3>
			<table width="100%" cellpadding="0" cellspacing="0" border="0">
				<thead>
					<tr>
						<th><?php 
            _e("Date", "pmpro");
            ?>
</th>
						<th><?php 
            _e("Level", "pmpro");
            ?>
</th>
						<th><?php 
            _e("Amount", "pmpro");
            ?>
</th>
					</tr>
				</thead>
				<tbody>
				<?php 
            $count = 0;
            foreach ($invoices as $invoice) {
                if ($count++ > 4) {
                    break;
                }
                //get an member order object
                $invoice_id = $invoice->id;
                $invoice = new MemberOrder();
                $invoice->getMemberOrderByID($invoice_id);
                $invoice->getMembershipLevel();
                ?>
						<tr id="pmpro_account-invoice-<?php 
                echo $invoice->code;
                ?>
">
							<td><a href="<?php 
                echo pmpro_url("invoice", "?invoice=" . $invoice->code);
                ?>
"><?php 
                echo date_i18n(get_option("date_format"), $invoice->timestamp);
                ?>
</td>
							<td><?php 
                if (!empty($invoice->membership_level)) {
                    echo $invoice->membership_level->name;
                } else {
                    echo __("N/A", "pmpro");
                }
                ?>
</td>
							<td><?php 
                echo pmpro_formatPrice($invoice->total);
                ?>
</td>
						</tr>
						<?php 
            }
            ?>
				</tbody>
			</table>						
			<?php 
            if ($count == 6) {
                ?>
				<div class="pmpro_actionlinks"><a href="<?php 
                echo pmpro_url("invoice");
                ?>
"><?php 
                _e("View All Invoices", "pmpro");
                ?>
</a></div>
			<?php 
            }
            ?>
		</div> <!-- end pmpro_account-invoices -->
		<?php 
        }
        ?>
		
		<?php 
        if (in_array('links', $sections) && (has_filter('pmpro_member_links_top') || has_filter('pmpro_member_links_bottom'))) {
            ?>
		<div id="pmpro_account-links" class="pmpro_box">
			<h3><?php 
            _e("Member Links", "pmpro");
            ?>
</h3>
			<ul>
				<?php 
            do_action("pmpro_member_links_top");
            ?>
				
				<?php 
            do_action("pmpro_member_links_bottom");
            ?>
			</ul>
		</div> <!-- end pmpro_account-links -->		
		<?php 
        }
        ?>
	</div> <!-- end pmpro_account -->		
	<?php 
    }
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}
function pmproup_adminpage()
{
    global $wpdb;
    //get options
    $options = pmproup_getOptions();
    //saving?
    if (!empty($_REQUEST['savesettings'])) {
        //get parent page
        $parent_page = intval($_REQUEST['parent_page']);
        //get levels and make sure they are all ints
        if (!empty($_REQUEST['levels'])) {
            $olevels = $_REQUEST['levels'];
        } else {
            $olevels = array();
        }
        $levels = array();
        foreach ($olevels as $olevel) {
            $levels[] = intval($olevel);
        }
        //update options
        $options['parent_page'] = $parent_page;
        $options['levels'] = $levels;
        update_option('pmpro_user_pages', $options);
        //see if existing member checkbox is checked
        if (!empty($_REQUEST['existing_members']) && !empty($levels)) {
            //find all members
            $member_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->pmpro_memberships_users} WHERE status = 'active' AND membership_id IN('" . implode("','", $levels) . "')");
            //loop through
            if (!empty($member_ids)) {
                echo "<p>Generating user pages... ";
                $count = 0;
                foreach ($member_ids as $member_id) {
                    //check for user page
                    $user_page_id = get_user_meta($member_id, "pmproup_user_page", true);
                    //no page, create one
                    if (empty($user_page_id)) {
                        $count++;
                        echo ". ";
                        pmproup_pmpro_after_checkout($member_id);
                    }
                }
                echo " Done. " . $count . " " . _n('member', 'members', $count) . " setup.</p>";
            }
        }
    }
    require_once PMPRO_DIR . "/adminpages/admin_header.php";
    ?>
		<form action="" method="post" enctype="multipart/form-data"> 
			<h2>User Pages Settings</h2>
		
			<?php 
    if (defined('PMPROUP_PARENT_PAGE_ID') || defined('PMPROUP_LEVELS')) {
        ?>
				<div id="message" class="error"><p><strong>Warning:</strong> PMPROUP_PARENT_PAGE_ID and PMPROUP_LEVELS seem to be defined already... maybe in your wp-config.php. These constants are no longer needed and you should find their definitions and delete them. The settings here will control the User Pages addon.</p></div>
				<?php 
    }
    ?>
		
			<p>The User Pages addon can be used to create a "user page" for new members of specific levels. The user pages will only be visible to site admins and the user it was created for.</p>
			
			<hr />
			
			<p>The <strong>Top Level Page</strong> is the WordPress page under which all user pages will be created. You can create a page called "User Pages" and then choose it from the dropdown below.</p>						
		
			<table class="form-table">
			<tbody>				
				<tr>
					<th scope="row" valign="top">
						<label for="parent_page"><?php 
    _e('Top Level Page', 'pmpro');
    ?>
:</label>
					</th>
					<td>
						<?php 
    wp_dropdown_pages(array("name" => "parent_page", "show_option_none" => "-- Choose One --", "selected" => $options['parent_page']));
    ?>
						
					</td>
				</tr>
			</tbody>
			</table>
			
			<hr />
			
			<p>Only members of the levels specified below will have user pages created for them. Hold the Control button (or Command button on Macs) and click to select/deselect multiple levels.</p>
			
			<table class="form-table">
			<tbody>				
				<tr>
					<th scope="row" valign="top">
						<label for="levels"><?php 
    _e('User Pages Levels', 'pmpro');
    ?>
:</label>
					</th>
					<td>
						<select id="levels" name="levels[]" multiple="yes">
							<?php 
    $levels = pmpro_getAllLevels(true, true);
    foreach ($levels as $level) {
        ?>
									<option value="<?php 
        echo $level->id;
        ?>
" <?php 
        if (in_array($level->id, $options['levels'])) {
            echo 'selected="selected"';
        }
        ?>
><?php 
        echo $level->name;
        ?>
</option>
								<?php 
    }
    ?>
						</select>						
					</td>
				</tr>
			</tbody>
			</table>
			
			<hr />
						
			<p>If you have existing members from before the User Pages addon was activated, you can <strong>check this box and click the Save Settings button to generate user pages for existing members</strong>. Only members in the above selected levels will have user pages created. Links to the User Pages will show up in the Member Links section of each user's membership account page. Users will not otherwise be notified of the creation of this page.</p>
			
			<table class="form-table">
			<tbody>				
				<tr>
					<th scope="row" valign="top">
						
					</th>
					<td>
						<input type="checkbox" id="existing_members" name="existing_members" value="1" />
						<label for="existing_members">Generate User Pages for existing members.</label>					
					</td>
				</tr>
			</tbody>
			</table>						
			
			<hr />
			
			<p class="submit">            
				<input name="savesettings" type="submit" class="button button-primary" value="<?php 
    _e('Save Settings', 'pmpro');
    ?>
" /> 		                			
			</p>
		</form>
	<?php 
    require_once PMPRO_DIR . "/adminpages/admin_footer.php";
}
function pmpro_update_existing_subscriptions()
{
    //only admins can get this
    if (!function_exists("current_user_can") || !current_user_can("manage_options")) {
        die(__("You do not have permissions to perform this action.", "pmpro"));
    }
    //vars
    global $pmpro_currency_symbol, $gateway;
    if (isset($_REQUEST['pmproues_gateway'])) {
        $pmproues_gateway = $_REQUEST['pmproues_gateway'];
    } else {
        $pmproues_gateway = "stripe";
    }
    if (isset($_REQUEST['pmproues_level'])) {
        $pmproues_level = $_REQUEST['pmproues_level'];
    } else {
        $pmproues_level = "";
    }
    if (isset($_REQUEST['pmproues_billing_amount'])) {
        $pmproues_billing_amount = $_REQUEST['pmproues_billing_amount'];
    } else {
        $pmproues_billing_amount = "";
    }
    if (isset($_REQUEST['pmproues_cycle_number'])) {
        $pmproues_cycle_number = $_REQUEST['pmproues_cycle_number'];
    } else {
        $pmproues_cycle_number = "1";
    }
    if (isset($_REQUEST['pmproues_cycle_period'])) {
        $pmproues_cycle_period = $_REQUEST['pmproues_cycle_period'];
    } else {
        $pmproues_cycle_period = "Month";
    }
    require_once PMPRO_DIR . "/adminpages/admin_header.php";
    //clear out msg fields
    $msg = "";
    $msgt = "";
    //running?
    if (!empty($_REQUEST['updatesubscriptions'])) {
        //check fields
        if (empty($pmproues_gateway) || empty($pmproues_level)) {
            $msg = __('You must select a gateway and level to update.');
            $msgt = 'error';
        } elseif (!empty($pmproues_billing_amount) && (empty($pmproues_cycle_number) || empty($pmproues_cycle_period))) {
            $msg = __('Select a cycle number and billing period or use billing amount 0 to cancel the subscriptions.');
            $msgt = 'error';
        } else {
            $updatesubscriptions = true;
        }
    }
    ?>

<h2><?php 
    _e('Update Existing Subscriptions at the Gateway', 'pmpro');
    ?>
</h2>

<?php 
    if (!empty($msg)) {
        ?>
	<div class="message <?php 
        echo $msgt;
        ?>
"><p><?php 
        echo $msg;
        ?>
</p></div>
<?php 
    }
    ?>

<p><?php 
    _e('This plugin currently supports updating Stripe subscriptions only. You can choose one level to update at a time and set a new billing amount and/or period for all active subscriptions for users of that level.');
    ?>
</p>

<?php 
    if (!empty($updatesubscriptions)) {
        ?>

<p id="pmproues_updates_intro"><?php 
        _e('Updates are processing. This may take a few minutes to complete.', 'pmproues');
        ?>
</p>
<textarea id="pmproues_updates_status" rows="20" cols="120">Loading...</textarea>

<?php 
    } else {
        ?>
	<form action="" method="post">
		<table class="form-table">
			<tbody>
				<tr>
					<th scope="row">
						<label for="pmproues_gateway"><?php 
        _e('Gateway', 'pmproues');
        ?>
</label>
					</th>
					<td>
						<select name="pmproues_gateway" id="pmproues_gateway">
							<option value="stripe"><?php 
        _e('Stripe', 'pmproues');
        ?>
</option>						
						</select>
					</td>
				</tr>
				
				<tr>
					<th scope="row">
						<label for="pmproues_level"><?php 
        _e('Level', 'pmproues');
        ?>
</label>
					</th>
					<td>
						<select name="pmproues_level" id="pmproues_level">
							<option value="">- <?php 
        _e('Choose One', 'pmproues');
        ?>
 -</option>
							<?php 
        $levels = pmpro_getAllLevels(true, true);
        foreach ($levels as $level) {
            ?>
								<option value="<?php 
            echo $level->id;
            ?>
"><?php 
            echo $level->name;
            ?>
</option>
								<?php 
        }
        ?>
						</select>
					</td>
				</tr>
				
				<tr>
					<th scope="row" valign="top"><label for="pmproues_billing_amount"><?php 
        _e('New Billing Amount', 'pmproues');
        ?>
:</label></th>
					<td>
						<?php 
        if (pmpro_getCurrencyPosition() == "left") {
            echo $pmpro_currency_symbol;
        }
        ?>
						<input id="pmproues_billing_amount" name="pmproues_billing_amount" type="text" size="20" value="<?php 
        echo esc_attr($pmproues_billing_amount);
        ?>
" /> 
						<?php 
        if (pmpro_getCurrencyPosition() == "right") {
            echo $pmpro_currency_symbol;
        }
        ?>
						<small><?php 
        _e('per', 'pmpro');
        ?>
</small>
						<input id="pmproues_cycle_number" name="pmproues_cycle_number" type="text" size="10" value="<?php 
        echo esc_attr($pmproues_cycle_number);
        ?>
" />
						<select id="pmproues_cycle_period" name="pmproues_cycle_period">
						  <?php 
        $cycles = array(__('Day(s)', 'pmpro') => 'Day', __('Week(s)', 'pmpro') => 'Week', __('Month(s)', 'pmpro') => 'Month', __('Year(s)', 'pmpro') => 'Year');
        foreach ($cycles as $name => $value) {
            echo "<option value='{$value}'";
            if ($pmproues_cycle_period == $value) {
                echo " selected='selected'";
            }
            echo ">{$name}</option>";
        }
        ?>
						</select>
						<br /><small>
							<?php 
        _e('Use billing amount of 0 to cancel subscriptions.', 'pmproues');
        ?>
							<?php 
        if ($gateway == "stripe") {
            ?>
								<br /><strong <?php 
            if (!empty($pmpro_stripe_error)) {
                ?>
class="pmpro_red"<?php 
            }
            ?>
><?php 
            _e('Stripe integration currently only supports billing periods of "Week", "Month" or "Year".', 'pmpro');
            ?>
							<?php 
        } elseif ($gateway == "braintree") {
            ?>
								<br /><strong <?php 
            if (!empty($pmpro_braintree_error)) {
                ?>
class="pmpro_red"<?php 
            }
            ?>
><?php 
            _e('Braintree integration currently only supports billing periods of "Month" or "Year".', 'pmpro');
            ?>
						
							<?php 
        } elseif ($gateway == "payflowpro") {
            ?>
								<br /><strong <?php 
            if (!empty($pmpro_payflow_error)) {
                ?>
class="pmpro_red"<?php 
            }
            ?>
><?php 
            _e('Payflow integration currently only supports billing frequencies of 1 and billing periods of "Week", "Month" or "Year".', 'pmpro');
            ?>
							<?php 
        }
        ?>
						</small>	
						<?php 
        if ($gateway == "braintree" && $edit < 0) {
            ?>
							<p class="pmpro_message"><strong><?php 
            _e('Note', 'pmpro');
            ?>
:</strong> <?php 
            _e('After saving this level, make note of the ID and create a "Plan" in your Braintree dashboard with the same settings and the "Plan ID" set to <em>pmpro_#</em>, where # is the level ID.', 'pmpro');
            ?>
</p>
						<?php 
        } elseif ($gateway == "braintree") {
            ?>
							<p class="pmpro_message"><strong><?php 
            _e('Note', 'pmpro');
            ?>
:</strong> <?php 
            _e('You will need to create a "Plan" in your Braintree dashboard with the same settings and the "Plan ID" set to', 'pmpro');
            ?>
 <em>pmpro_<?php 
            echo $level->id;
            ?>
</em>.</p>
						<?php 
        }
        ?>
						
					</td>
				</tr>
				
				<tr>
					<th scope="row">
						<label for="pmproues_live"><?php 
        _e('Test or Live', 'pmproues');
        ?>
</label>
					</th>
					<td>
						<select name="pmproues_live" id="pmproues_live">
							<option value="0"><?php 
        _e('Test Run', 'pmproues');
        ?>
</option>
							<option value="1"><?php 
        _e('Live Run', 'pmproues');
        ?>
</option>
						</select>
						<small><?php 
        _e('When testing, planned updates are shown but not made at the gateway.', 'pmproues');
        ?>
</small>
					</td>
				</tr>
				
			</tbody>
		</table>
		
		<p class="submit topborder">
			<input type="hidden" name="updatesubscriptions" value="1" />
			<input name="run" type="submit" class="button-primary" value="<?php 
        _e('Run Update', 'pmproues');
        ?>
" />		
		</p>
	</form>
<?php 
    }
    ?>
	
<?php 
    require_once PMPRO_DIR . "/adminpages/admin_footer.php";
}
Esempio n. 13
0
					<option value="<?php 
    echo "Last Year";
    ?>
" <?php 
    selected($predefined_date, "Last Year");
    ?>
><?php 
    echo "Last Year";
    ?>
</option>

			</select>

			<?php 
    //Note: only orders belonging to current levels can be filtered. There is no option for orders belonging to deleted levels
    $levels = pmpro_getAllLevels();
    ?>
			<select id="l" name="l">
			<?php 
    foreach ($levels as $level) {
        ?>
				<option value="<?php 
        echo $level->id;
        ?>
" <?php 
        selected($l, $level->id);
        ?>
><?php 
        echo $level->name;
        ?>
</option>
    function bp_course_get_course_credits($args = NULL)
    {
        $defaults = array('id' => get_the_ID(), 'currency' => 'CREDITS', 'bypass' => 0);
        $r = wp_parse_args($args, $defaults);
        extract($r, EXTR_SKIP);
        $private = 0;
        $credits_html = '';
        $credits = array();
        if (!empty($bypass)) {
            if (is_user_logged_in()) {
                $user_id = get_current_user_id();
                $expire_check = get_user_meta($user_id, $id, true);
                if ($expire > time()) {
                    return '';
                }
            }
        }
        $free_course = get_post_meta($id, 'vibe_course_free', true);
        if (vibe_validate($free_course)) {
            $credits[] = '<strong>' . apply_filters('wplms_free_course_price', __('FREE', 'vibe')) . '</strong>';
        } else {
            $product_id = get_post_meta($id, 'vibe_product', true);
            if (isset($product_id) && $product_id != '' && function_exists('get_product')) {
                //WooCommerce installed
                $product = get_product($product_id);
                if (is_object($product)) {
                    $link = get_permalink($product_id);
                    $check = vibe_get_option('direct_checkout');
                    if (isset($check) && $check) {
                        $link .= '?redirect';
                    }
                    $price_html = str_replace('class="amount"', 'class="amount"', $product->get_price_html());
                    $credits[$link] = '<strong>' . $price_html . '</strong>';
                }
            }
            if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins')))) {
                $membership_ids = vibe_sanitize(get_post_meta($id, 'vibe_pmpro_membership', false));
                if (isset($membership_ids) && is_Array($membership_ids) && count($membership_ids) && function_exists('pmpro_getAllLevels')) {
                    //$membership_id = min($membership_ids);
                    $levels = pmpro_getAllLevels();
                    foreach ($levels as $level) {
                        if (in_array($level->id, $membership_ids)) {
                            $link = get_option('pmpro_levels_page_id');
                            $link = get_permalink($link) . '#' . $level->id;
                            $credits[$link] = '<strong>' . $level->name . '</strong>';
                        }
                    }
                }
            }
            $course_credits = get_post_meta($id, 'vibe_course_credits', true);
            if (isset($course_credits) && $course_credits != '') {
                $credits[] = '<strong>' . $course_credits . '</strong>';
            }
        }
        // End Else
        $credits = apply_filters('wplms_course_credits_array', $credits, $id);
        if (count($credits) > 1) {
            $credits_html .= '<div class="pricing_course">
    								<div class="result"><span>' . __('Price Options +', 'vibe') . '</span></div>
								    <div class="drop">';
            $first = 1;
            foreach ($credits as $key => $credit) {
                $credits_html .= '<label data-value="' . $key . '"><span class="font-text">' . $credit . '</span></label>';
                $first = 0;
            }
            $credits_html .= '</div>
								</div>';
            /*$credits_html .='<ul class="pricing_course">';
            		$first = 1;
            		foreach($credits as $key=>$credit){
            			$credits_html .='<li data-value="'.$key.'" '.(($first)?'class="active"':'').'>&nbsp;'.$credit.'</li>';
            			$first=0;
            		}
            		$credits_html .='</ul>';*/
        } else {
            if (count($credits)) {
                foreach ($credits as $credit) {
                    $credits_html .= $credit;
                }
                if (is_singular('course')) {
                    $credits_html .= '<i class="icon-wallet-money right"></i>';
                }
            }
        }
        $credits_html .= '';
        $credits_html = apply_filters('wplms_course_credits', $credits_html, $id);
        return $credits_html;
    }
function vibe_meta_box_arrays($metabox)
{
    // References added to Pick labels for Import/Export
    $prefix = 'vibe_';
    $sidebars = $GLOBALS['wp_registered_sidebars'];
    $sidebararray = array();
    foreach ($sidebars as $sidebar) {
        if (!in_array($sidebar['id'], array('student_sidebar', 'instructor_sidebar'))) {
            $sidebararray[] = array('label' => $sidebar['name'], 'value' => $sidebar['id']);
        }
    }
    $course_duration_parameter = apply_filters('vibe_course_duration_parameter', 86400);
    $drip_duration_parameter = apply_filters('vibe_drip_duration_parameter', 86400);
    $unit_duration_parameter = apply_filters('vibe_unit_duration_parameter', 60);
    $quiz_duration_parameter = apply_filters('vibe_quiz_duration_parameter', 60);
    $product_duration_parameter = apply_filters('vibe_product_duration_parameter', 86400);
    $assignment_duration_parameter = apply_filters('vibe_assignment_duration_parameter', 86400);
    switch ($metabox) {
        case 'post':
            $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Post Sub-Title', 'vibe-customtypes'), 'desc' => __('Post Sub- Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'template' => array('label' => __('Post Template', 'vibe-customtypes'), 'desc' => __('Select a post template for showing content.', 'vibe-customtypes'), 'id' => $prefix . 'template', 'type' => 'select', 'options' => array(1 => array('label' => __('Content on Left', 'vibe-customtypes'), 'value' => ''), 2 => array('label' => __('Content on Right', 'vibe-customtypes'), 'value' => 'right'), 3 => array('label' => __('Full Width', 'vibe-customtypes'), 'value' => 'full')), 'std' => ''), $prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray), $prefix . 'title' => array('label' => __('Show Page Title', 'vibe-customtypes'), 'desc' => __('Show Page/Post Title.', 'vibe-customtypes'), 'id' => $prefix . 'title', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'author' => array('label' => __('Show Author Information', 'vibe-customtypes'), 'desc' => __('Author information below post content.', 'vibe-customtypes'), 'id' => $prefix . 'author', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'breadcrumbs' => array('label' => __('Show Breadcrumbs', 'vibe-customtypes'), 'desc' => __('Show breadcrumbs.', 'vibe-customtypes'), 'id' => $prefix . 'breadcrumbs', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'prev_next' => array('label' => __('Show Prev/Next Arrows', 'vibe-customtypes'), 'desc' => __('Show previous/next links on top below the Subheader.', 'vibe-customtypes'), 'id' => $prefix . 'prev_next', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'));
            break;
        case 'page':
            $metabox_settings = array($prefix . 'title' => array('label' => __('Show Page Title', 'vibe-customtypes'), 'desc' => __('Show Page/Post Title.', 'vibe-customtypes'), 'id' => $prefix . 'title', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'subtitle' => array('label' => __('Page Sub-Title', 'vibe-customtypes'), 'desc' => __('Page Sub- Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'breadcrumbs' => array('label' => __('Show Breadcrumbs', 'vibe-customtypes'), 'desc' => __('Show breadcrumbs.', 'vibe-customtypes'), 'id' => $prefix . 'breadcrumbs', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'S'), $prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select Sidebar | Sidebar : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray));
            break;
        case 'course':
            $metabox_settings = array($prefix . 'sidebar' => array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray, 'std' => 'coursesidebar'), $prefix . 'duration' => array('label' => __('Total Duration of Course', 'vibe-customtypes'), 'desc' => sprintf(__('Duration of Course (in %s)', 'vibe-customtypes'), calculate_duration_time($course_duration_parameter)), 'id' => $prefix . 'duration', 'type' => 'number', 'std' => 10), $prefix . 'students' => array('label' => __('Total number of Students in Course', 'vibe-customtypes'), 'desc' => __('Total number of Students who have taken this Course.', 'vibe-customtypes'), 'id' => $prefix . 'students', 'type' => 'number', 'std' => 0), $prefix . 'course_auto_eval' => array('label' => __('Auto Evaluation', 'vibe-customtypes'), 'desc' => __('Evalute Courses based on Quizes scores available in Course (* Requires atleast 1 Quiz in course)', 'vibe-customtypes'), 'id' => $prefix . 'course_auto_eval', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'start_date' => array('label' => __('Course Start Date', 'vibe-customtypes'), 'desc' => __('Date from which Course Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_date', 'type' => 'date'), $prefix . 'max_students' => array('label' => __('Maximum Students in Course', 'vibe-customtypes'), 'desc' => __('Maximum number of students who can pursue the course at a time.', 'vibe-customtypes'), 'id' => $prefix . 'max_students', 'type' => 'number'), $prefix . 'course_badge' => array('label' => __('Excellence Badge', 'vibe-customtypes'), 'desc' => __('Upload badge image which Students recieve upon course completion', 'vibe-customtypes'), 'id' => $prefix . 'course_badge', 'type' => 'image'), $prefix . 'course_badge_percentage' => array('label' => __('Badge Percentage', 'vibe-customtypes'), 'desc' => __('Badge is given to people passing above percentage (out of 100)', 'vibe-customtypes'), 'id' => $prefix . 'course_badge_percentage', 'type' => 'number'), $prefix . 'course_badge_title' => array('label' => __('Badge Title', 'vibe-customtypes'), 'desc' => __('Title is shown on hovering the badge.', 'vibe-customtypes'), 'id' => $prefix . 'course_badge_title', 'type' => 'text'), $prefix . 'course_certificate' => array('label' => __('Completion Certificate', 'vibe-customtypes'), 'desc' => __('Enable Certificate image which Students recieve upon course completion (out of 100)', 'vibe-customtypes'), 'id' => $prefix . 'course_certificate', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'certificate_template' => array('label' => __('Certificate Template', 'vibe-customtypes'), 'desc' => __('Select a Certificate Template', 'vibe-customtypes'), 'id' => $prefix . 'certificate_template', 'type' => 'selectcpt', 'post_type' => 'certificate'), $prefix . 'course_passing_percentage' => array('label' => __('Passing Percentage', 'vibe-customtypes'), 'desc' => __('Course passing percentage, for completion certificate', 'vibe-customtypes'), 'id' => $prefix . 'course_passing_percentage', 'type' => 'number'), $prefix . 'course_drip' => array('label' => __('Drip Feed', 'vibe-customtypes'), 'desc' => __('Enable Drip Feed course', 'vibe-customtypes'), 'id' => $prefix . 'course_drip', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'course_drip_duration' => array('label' => __('Drip Feed Duration', 'vibe-customtypes'), 'desc' => __('Duration between consecutive Drip feed units (in ', 'vibe-customtypes') . calculate_duration_time($drip_duration_parameter) . ' )', 'id' => $prefix . 'course_drip_duration', 'type' => 'number'), $prefix . 'course_curriculum' => array('label' => __('Course Curriculum', 'vibe-customtypes'), 'desc' => __('Set Course Curriculum, prepare units and quizes before setting up curriculum', 'vibe-customtypes'), 'id' => $prefix . 'course_curriculum', 'post_type1' => 'unit', 'post_type2' => 'quiz', 'type' => 'curriculum'), $prefix . 'pre_course' => array('label' => __('Pre-Required Course', 'vibe-customtypes'), 'desc' => __('Pre Required course for this course', 'vibe-customtypes'), 'id' => $prefix . 'pre_course', 'type' => 'selectmulticpt', 'post_type' => 'course'), $prefix . 'course_retakes' => array('label' => __('Course Retakes', 'vibe-customtypes'), 'desc' => __('Set number of times a student can re-take the course (0 to disable)', 'vibe-customtypes'), 'id' => $prefix . 'course_retakes', 'type' => 'number', 'std' => 0), $prefix . 'forum' => array('label' => __('Course Forum', 'vibe-customtypes'), 'desc' => __('Connect Forum with Course.', 'vibe-customtypes'), 'id' => $prefix . 'forum', 'type' => 'selectcpt', 'post_type' => 'forum'), $prefix . 'group' => array('label' => __('Course Group', 'vibe-customtypes'), 'desc' => __('Connect a Group with Course.', 'vibe-customtypes'), 'id' => $prefix . 'group', 'type' => 'groups'), $prefix . 'course_instructions' => array('label' => __('Course specific instructions', 'vibe-customtypes'), 'desc' => __('Course specific instructions which would be shown in the Start course/Course status page', 'vibe-customtypes'), 'id' => $prefix . 'course_instructions', 'type' => 'editor', 'std' => ''), $prefix . 'course_message' => array('label' => __('Course Completion Message', 'vibe-customtypes'), 'desc' => __('This message is shown to users when they Finish submit the course', 'vibe-customtypes'), 'id' => $prefix . 'course_message', 'type' => 'editor', 'std' => 'Thank you for Finish the Course.'));
            break;
        case 'course_product':
            $metabox_settings = array($prefix . 'course_free' => array('label' => __('Free Course', 'vibe-customtypes'), 'desc' => __('Course is Free for all Members', 'vibe-customtypes'), 'id' => $prefix . 'course_free', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'));
            if (in_array('paid-memberships-pro/paid-memberships-pro.php', apply_filters('active_plugins', get_option('active_plugins'))) && function_exists('pmpro_getAllLevels')) {
                $levels = pmpro_getAllLevels();
                foreach ($levels as $level) {
                    $level_array[] = array('value' => $level->id, 'label' => $level->name);
                }
                $metabox_settings[$prefix . 'pmpro_membership'] = array('label' => __('PMPro Membership', 'vibe-customtypes'), 'desc' => __('Required Membership levle for this course', 'vibe-customtypes'), 'id' => $prefix . 'pmpro_membership', 'type' => 'multiselect', 'options' => $level_array);
            }
            if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) {
                $instructor_privacy = vibe_get_option('instructor_content_privacy');
                $flag = 1;
                if (isset($instructor_privacy) && $instructor_privacy && !current_user_can('manage_options')) {
                    $flag = 0;
                }
                if ($flag) {
                    $metabox_settings[$prefix . 'product'] = array('label' => __('Associated Product', 'vibe-customtypes'), 'desc' => __('Associated Product with the Course.', 'vibe-customtypes'), 'id' => $prefix . 'product', 'type' => 'selectcpt', 'post_type' => 'product', 'std' => '');
                }
            }
            break;
        case 'unit':
            $unit_types = apply_filters('wplms_unit_types', array(array('label' => __('Video', 'vibe-customtypes'), 'value' => 'play'), array('label' => __('Audio', 'vibe-customtypes'), 'value' => 'music-file-1'), array('label' => __('Podcast', 'vibe-customtypes'), 'value' => 'podcast'), array('label' => __('General', 'vibe-customtypes'), 'value' => 'text-document')));
            $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Unit Description', 'vibe-customtypes'), 'desc' => __('Small Description.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), $prefix . 'type' => array('label' => __('Unit Type', 'vibe-customtypes'), 'desc' => __('Select Unit type from Video , Audio , Podcast, General , ', 'vibe-customtypes'), 'id' => $prefix . 'type', 'type' => 'select', 'options' => $unit_types, 'std' => 'text-document'), $prefix . 'free' => array('label' => __('Free Unit', 'vibe-customtypes'), 'desc' => __('Set Free unit, viewable to all', 'vibe-customtypes'), 'id' => $prefix . 'free', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'duration' => array('label' => __('Unit Duration', 'vibe-customtypes'), 'desc' => __('Duration in ', 'vibe-customtypes') . calculate_duration_time($unit_duration_parameter), 'id' => $prefix . 'duration', 'type' => 'number'), $prefix . 'assignment' => array('label' => __('Connect Assignments', 'vibe-customtypes'), 'desc' => __('Select an Assignment which you can connect with this Unit', 'vibe-customtypes'), 'id' => $prefix . 'assignment', 'type' => 'selectmulticpt', 'post_type' => 'wplms-assignment'), $prefix . 'forum' => array('label' => __('Unit Forum', 'vibe-customtypes'), 'desc' => __('Connect Forum with Unit.', 'vibe-customtypes'), 'id' => $prefix . 'forum', 'type' => 'selectcpt', 'post_type' => 'forum'));
            break;
        case 'question':
            $question_types = apply_filters('wplms_question_types', array(array('label' => __('True or False', 'vibe-customtypes'), 'value' => 'truefalse'), array('label' => __('Multiple Choice', 'vibe-customtypes'), 'value' => 'single'), array('label' => __('Multiple Correct', 'vibe-customtypes'), 'value' => 'multiple'), array('label' => __('Sort Answers', 'vibe-customtypes'), 'value' => 'sort'), array('label' => __('Match Answers', 'vibe-customtypes'), 'value' => 'match'), array('label' => __('Fill in the Blank', 'vibe-customtypes'), 'value' => 'fillblank'), array('label' => __('Dropdown Select', 'vibe-customtypes'), 'value' => 'select'), array('label' => __('Small Text', 'vibe-customtypes'), 'value' => 'smalltext'), array('label' => __('Large Text', 'vibe-customtypes'), 'value' => 'largetext')));
            $metabox_settings = array($prefix . 'question_type' => array('label' => __('Question Type', 'vibe-customtypes'), 'desc' => __('Select Question type, ', 'vibe-customtypes'), 'id' => $prefix . 'question_type', 'type' => 'select', 'options' => $question_types, 'std' => 'single'), $prefix . 'question_options' => array('label' => __('Question Options (For Single/Multiple/Sort/Match Question types)', 'vibe-customtypes'), 'desc' => __('Single/Mutiple Choice question options', 'vibe-customtypes'), 'id' => $prefix . 'question_options', 'type' => 'repeatable_count'), $prefix . 'question_answer' => array('label' => __('Correct Answer', 'vibe-customtypes'), 'desc' => __('Enter (1 = True, 0 = false ) or Choice Number (1,2..) or comma saperated Choice numbers (1,2..) or Correct Answer for small text (All possible answers comma saperated) | 0 for No Answer or Manual Check', 'vibe-customtypes'), 'id' => $prefix . 'question_answer', 'type' => 'text', 'std' => 0), $prefix . 'question_hint' => array('label' => __('Answer Hint', 'vibe-customtypes'), 'desc' => __('Add a Hint/clue for the answer to show to student', 'vibe-customtypes'), 'id' => $prefix . 'question_hint', 'type' => 'textarea', 'std' => ''), $prefix . 'question_explaination' => array('label' => __('Answer Explanation', 'vibe-customtypes'), 'desc' => __('Add Answer explanation', 'vibe-customtypes'), 'id' => $prefix . 'question_explaination', 'type' => 'editor', 'std' => ''));
            break;
        case 'quiz':
            $metabox_settings = array($prefix . 'subtitle' => array('label' => __('Quiz Subtitle', 'vibe-customtypes'), 'desc' => __('Quiz Subtitle.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'text', 'std' => ''), $prefix . 'quiz_course' => array('label' => __('Connected Course', 'vibe-customtypes'), 'id' => $prefix . 'quiz_course', 'type' => 'selectcpt', 'post_type' => 'course', 'post_status' => array('publish', 'draft'), 'desc' => __('Connecting a quiz with a course would force the quiz to be available to users who have taken the course.', 'vibe-customtypes')), $prefix . 'duration' => array('label' => __('Quiz Duration', 'vibe-customtypes'), 'desc' => __('Quiz duration in ', 'vibe-customtypes') . calculate_duration_time($quiz_duration_parameter) . __(' Enables Timer & auto submits on expire. 9999 to disable.', 'vibe-customtypes'), 'id' => $prefix . 'duration', 'type' => 'number', 'std' => 0), $prefix . 'quiz_auto_evaluate' => array('label' => __('Auto Evaluate Results', 'vibe-customtypes'), 'desc' => __('Evaluate results as soon as quiz is complete. (* No Large text questions ), Diable for manual evaluate', 'vibe-customtypes'), 'id' => $prefix . 'quiz_auto_evaluate', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_retakes' => array('label' => __('Number of Extra Quiz Retakes', 'vibe-customtypes'), 'desc' => __('Student can reset and start the quiz all over again. Number of Extra retakes a student can take.', 'vibe-customtypes'), 'id' => $prefix . 'quiz_retakes', 'type' => 'number', 'std' => 0), $prefix . 'quiz_message' => array('label' => __('Post Quiz Message', 'vibe-customtypes'), 'desc' => __('This message is shown to users when they submit the quiz', 'vibe-customtypes'), 'id' => $prefix . 'quiz_message', 'type' => 'editor', 'std' => 'Thank you for Submitting the Quiz. Check Results in your Profile.'), $prefix . 'quiz_dynamic' => array('label' => __('Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Dynamic quiz automatically selects questions.', 'vibe-customtypes'), 'id' => $prefix . 'quiz_dynamic', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_tags' => array('label' => __('Dynamic Quiz Question tags', 'vibe-customtypes'), 'desc' => __('Select Question tags from where questions will be selected for the quiz.(required if dynamic enabled)', 'vibe-customtypes'), 'id' => $prefix . 'quiz_tags', 'type' => 'dynamic_taxonomy', 'taxonomy' => 'question-tag', 'std' => 0), $prefix . 'quiz_number_questions' => array('label' => __('Number of Questions in Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Enter the number of Questions in the dynamic quiz. (required if dynamic enabled).', 'vibe-customtypes'), 'id' => $prefix . 'quiz_number_questions', 'type' => 'number', 'std' => 0), $prefix . 'quiz_marks_per_question' => array('label' => __('Marks per Question in Dynamic Quiz', 'vibe-customtypes'), 'desc' => __('Enter the number of marks per Questions in the dynamic quiz. (required if dynamic enabled).', 'vibe-customtypes'), 'id' => $prefix . 'quiz_marks_per_question', 'type' => 'number', 'std' => 0), $prefix . 'quiz_random' => array('label' => __('Randomize Quiz Questions', 'vibe-customtypes'), 'desc' => __('Random Question sequence for every quiz', 'vibe-customtypes'), 'id' => $prefix . 'quiz_random', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), $prefix . 'quiz_questions' => array('label' => __('Quiz Questions', 'vibe-customtypes'), 'desc' => __('Quiz questions for Static Quiz only', 'vibe-customtypes'), 'id' => $prefix . 'quiz_questions', 'type' => 'repeatable_selectcpt', 'post_type' => 'question', 'std' => 0));
            break;
        case 'testimonial':
            $metabox_settings = array(array('label' => __('Author Name', 'vibe-customtypes'), 'desc' => __('Enter the name of the testimonial author.', 'vibe-customtypes'), 'id' => $prefix . 'testimonial_author_name', 'type' => 'text'), array('label' => __('Designation', 'vibe-customtypes'), 'desc' => __('Enter the testimonial author\'s designation.', 'vibe-customtypes'), 'id' => $prefix . 'testimonial_author_designation', 'type' => 'text'));
            break;
        case 'product':
            $metabox_settings = array(array('label' => __('Associated Courses', 'vibe-customtypes'), 'desc' => __('Associated Courses with this product. Enables access to the course.', 'vibe-customtypes'), 'id' => $prefix . 'courses', 'type' => 'selectmulticpt', 'post_type' => 'course'), array('label' => __('Subscription ', 'vibe-customtypes'), 'desc' => __('Enable if Product is Subscription Type (Price per month)', 'vibe-customtypes'), 'id' => $prefix . 'subscription', 'type' => 'showhide', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Subscription Duration', 'vibe-customtypes'), 'desc' => __('Duration for Subscription Products (in ', 'vibe-customtypes') . calculate_duration_time($product_duration_parameter) . ')', 'id' => $prefix . 'duration', 'type' => 'number'));
            break;
        case 'wplms-event':
            $metabox_settings = array(array('label' => __('Event Sub-Title', 'vibe-customtypes'), 'desc' => __('Event Sub-Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), array('label' => __('Course', 'vibe-customtypes'), 'desc' => __('Select Course for which the event is valid', 'vibe-customtypes'), 'id' => $prefix . 'event_course', 'type' => 'selectcpt', 'post_type' => 'course'), array('label' => __('Connect an Assignment', 'vibe-customtypes'), 'desc' => __('Select an Assignment which you can connect with this Event', 'vibe-customtypes'), 'id' => $prefix . 'assignment', 'type' => 'selectcpt', 'post_type' => 'wplms-assignment'), array('label' => __('Event Icon', 'vibe-customtypes'), 'desc' => __('Click on icon to  select an icon for the event', 'vibe-customtypes'), 'id' => $prefix . 'icon', 'type' => 'icon'), array('label' => __('Event Color', 'vibe-customtypes'), 'desc' => __('Select color for Event', 'vibe-customtypes'), 'id' => $prefix . 'color', 'type' => 'color'), array('label' => __('Start Date', 'vibe-customtypes'), 'desc' => __('Date from which Event Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_date', 'type' => 'date'), array('label' => __('End Date', 'vibe-customtypes'), 'desc' => __('Date on which Event ends.', 'vibe-customtypes'), 'id' => $prefix . 'end_date', 'type' => 'date'), array('label' => __('Start Time', 'vibe-customtypes'), 'desc' => __('Date from which Event Begins', 'vibe-customtypes'), 'id' => $prefix . 'start_time', 'type' => 'time'), array('label' => __('End Time', 'vibe-customtypes'), 'desc' => __('Date on which Event ends.', 'vibe-customtypes'), 'id' => $prefix . 'end_time', 'type' => 'time'), array('label' => __('Show Location', 'vibe-customtypes'), 'desc' => __('Show Location and Google map with the event', 'vibe-customtypes'), 'id' => $prefix . 'show_location', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Location', 'vibe-customtypes'), 'desc' => __('Location of event', 'vibe-customtypes'), 'id' => $prefix . 'location', 'type' => 'gmap'), array('label' => __('Additional Information', 'vibe-customtypes'), 'desc' => __('Point wise Additional Information regarding the event', 'vibe-customtypes'), 'id' => $prefix . 'additional_info', 'type' => 'repeatable'), array('label' => __('More Information', 'vibe-customtypes'), 'desc' => __('Supports HTML and shortcodes', 'vibe-customtypes'), 'id' => $prefix . 'more_info', 'type' => 'editor'), array('label' => __('All Day', 'vibe-customtypes'), 'desc' => __('An all Day event', 'vibe-customtypes'), 'id' => $prefix . 'all_day', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Private Event', 'vibe-customtypes'), 'desc' => __('Only Invited participants can see the Event', 'vibe-customtypes'), 'id' => $prefix . 'private_event', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'));
            if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins'))) || function_exists('is_plugin_active_for_network') && is_plugin_active_for_network('woocommerce/woocommerce.php')) {
                $metabox_settings[] = array('label' => __('Associated Product for Event Access', 'vibe-customtypes'), 'desc' => __('Purchase of this product grants Event access to the member.', 'vibe-customtypes'), 'id' => $prefix . 'product', 'type' => 'selectcpt', 'post_type' => 'product', 'std' => '');
            }
            break;
        case 'payments':
            $metabox_settings = array(array('label' => __('From', 'vibe-customtypes'), 'desc' => __('Date on which Payment was done.', 'vibe-customtypes'), 'id' => $prefix . 'date_from', 'type' => 'text'), array('label' => __('To', 'vibe-customtypes'), 'desc' => __('Date on which Payment was done.', 'vibe-customtypes'), 'id' => $prefix . 'date_to', 'type' => 'text'), array('label' => __('Instructor and Commissions', 'vibe-customtypes'), 'desc' => __('Instructor commissions', 'vibe-customtypes'), 'id' => $prefix . 'instructor_commissions', 'type' => 'payments'));
            break;
        case 'certificate':
            $metabox_settings = array(array('label' => __('Background Image/Pattern', 'vibe-customtypes'), 'desc' => __('Add background image', 'vibe-customtypes'), 'id' => $prefix . 'background_image', 'type' => 'image'), array('label' => __('Enable Print & PDF', 'vibe-customtypes'), 'desc' => __('Displays a Print and Download as PDF Button on top right corner of certificate', 'vibe-customtypes'), 'id' => $prefix . 'print', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Certificate Width', 'vibe-customtypes'), 'desc' => __('Add certificate width', 'vibe-customtypes'), 'id' => $prefix . 'certificate_width', 'type' => 'text'), array('label' => __('Certificate Height', 'vibe-customtypes'), 'desc' => __('Add certificate height', 'vibe-customtypes'), 'id' => $prefix . 'certificate_height', 'type' => 'text'), array('label' => __('Custom Class', 'vibe-customtypes'), 'desc' => __('Add Custom Class over Certificate container.', 'vibe-customtypes'), 'id' => $prefix . 'custom_class', 'type' => 'text'), array('label' => __('Custom CSS', 'vibe-customtypes'), 'desc' => __('Add Custom CSS for Certificate.', 'vibe-customtypes'), 'id' => $prefix . 'custom_css', 'type' => 'textarea'), array('label' => __('NOTE:', 'vibe-customtypes'), 'desc' => __(' USE FOLLOWING SHORTCODES TO DISPLAY RELEVANT DATA : <br />1. <strong>[certificate_student_name]</strong> : Displays Students Name<br />2. <strong>[certificate_course]</strong> : Displays Course Name<br />3. <strong>[certificate_student_marks]</strong> : Displays Students Marks in Course<br />4. <strong>[certificate_student_date]</strong>: Displays date on which Certificate was awarded to the Student<br />5. <strong>[certificate_student_email]</strong>: Displays registered email of the Student<br />6. <strong>[certificate_code]</strong>: Generates unique code for Student which can be validated from Certificate page.<br />7. <strong>[course_completion_date]</strong>: Displays course completion date from course activity.', 'vibe-customtypes'), 'id' => $prefix . 'note', 'type' => 'note'));
            break;
        case 'wplms-assignment':
            $max_upload = (int) ini_get('upload_max_filesize');
            $max_post = (int) ini_get('post_max_size');
            $memory_limit = (int) ini_get('memory_limit');
            $upload_mb = min($max_upload, $max_post, $memory_limit);
            $metabox_settings = array(array('label' => __('Assignment Sub-Title', 'vibe-customtypes'), 'desc' => __('Assignment Sub-Title.', 'vibe-customtypes'), 'id' => $prefix . 'subtitle', 'type' => 'textarea', 'std' => ''), array('label' => __('Sidebar', 'vibe-customtypes'), 'desc' => __('Select a Sidebar | Default : mainsidebar', 'vibe-customtypes'), 'id' => $prefix . 'sidebar', 'type' => 'select', 'options' => $sidebararray), array('label' => __('Assignment Maximum Marks', 'vibe-customtypes'), 'desc' => __('Set Maximum marks for the assignment', 'vibe-customtypes'), 'id' => $prefix . 'assignment_marks', 'type' => 'number', 'std' => '10'), array('label' => sprintf(__('Assignment Maximum Time limit %s', 'vibe-customtypes'), '( ' . calculate_duration_time($assignment_duration_parameter) . ' )'), 'desc' => __('Set Maximum Time limit for Assignment ( in ', 'vibe-customtypes') . calculate_duration_time($assignment_duration_parameter) . ' )', 'id' => $prefix . 'assignment_duration', 'type' => 'number', 'std' => '10'), array('label' => __('Include in Course Evaluation', 'vibe-customtypes'), 'desc' => __('Include assignment marks in Course Evaluation', 'vibe-customtypes'), 'id' => $prefix . 'assignment_evaluation', 'type' => 'yesno', 'options' => array(array('value' => 'H', 'label' => 'Hide'), array('value' => 'S', 'label' => 'Show')), 'std' => 'H'), array('label' => __('Include in Course', 'vibe-customtypes'), 'desc' => __('Assignments marks will be shown/used in course evaluation', 'vibe-customtypes'), 'id' => $prefix . 'assignment_course', 'type' => 'selectcpt', 'post_type' => 'course'), array('label' => __('Assignment Submissions', 'vibe-customtypes'), 'desc' => __('Select type of assignment submissions', 'vibe-customtypes'), 'id' => $prefix . 'assignment_submission_type', 'type' => 'select', 'options' => array(1 => array('label' => 'Upload file', 'value' => 'upload'), 2 => array('label' => 'Text Area', 'value' => 'textarea')), 'std' => ''), array('label' => __('Attachment Type', 'vibe-customtypes'), 'desc' => __('Select valid attachment types ', 'vibe-customtypes'), 'id' => $prefix . 'attachment_type', 'type' => 'multiselect', 'options' => array(array('value' => 'JPG', 'label' => 'JPG'), array('value' => 'GIF', 'label' => 'GIF'), array('value' => 'PNG', 'label' => 'PNG'), array('value' => 'PDF', 'label' => 'PDF'), array('value' => 'DOC', 'label' => 'DOC'), array('value' => 'DOCX', 'label' => 'DOCX'), array('value' => 'PPT', 'label' => 'PPT'), array('value' => 'PPTX', 'label' => 'PPTX'), array('value' => 'PPS', 'label' => 'PPS'), array('value' => 'PPSX', 'label' => 'PPSX'), array('value' => 'ODT', 'label' => 'ODT'), array('value' => 'XLS', 'label' => 'XLS'), array('value' => 'XLSX', 'label' => 'XLSX'), array('value' => 'MP3', 'label' => 'MP3'), array('value' => 'M4A', 'label' => 'M4A'), array('value' => 'OGG', 'label' => 'OGG'), array('value' => 'WAV', 'label' => 'WAV'), array('value' => 'WMA', 'label' => 'WMA'), array('value' => 'MP4', 'label' => 'MP4'), array('value' => 'M4V', 'label' => 'M4V'), array('value' => 'MOV', 'label' => 'MOV'), array('value' => 'WMV', 'label' => 'WMV'), array('value' => 'AVI', 'label' => 'AVI'), array('value' => 'MPG', 'label' => 'MPG'), array('value' => 'OGV', 'label' => 'OGV'), array('value' => '3GP', 'label' => '3GP'), array('value' => '3G2', 'label' => '3G2'), array('value' => 'FLV', 'label' => 'FLV'), array('value' => 'WEBM', 'label' => 'WEBM'), array('value' => 'APK', 'label' => 'APK '), array('value' => 'RAR', 'label' => 'RAR'), array('value' => 'ZIP', 'label' => 'ZIP')), 'std' => 'single'), array('label' => __('Attachment Size (in MB)', 'vibe-customtypes'), 'desc' => __('Set Maximum Attachment size for upload ( set less than ', 'vibe-customtypes') . $upload_mb . ' MB)', 'id' => $prefix . 'attachment_size', 'type' => 'number', 'std' => '2'));
            break;
        case 'popup':
            $metabox_settings = array(array('label' => __('Width (in px)', 'vibe-customtypes'), 'desc' => __('Set Maximum width of popup', 'vibe-customtypes'), 'id' => $prefix . 'popup_width', 'type' => 'number', 'std' => '480'), array('label' => __('Height (in px)', 'vibe-customtypes'), 'desc' => __('Set Maximum height of popup ', 'vibe-customtypes'), 'id' => $prefix . 'popup_height', 'type' => 'number', 'std' => '600'), array('label' => __('Custom Class', 'vibe-customtypes'), 'desc' => __('Add custom class to popup ', 'vibe-customtypes'), 'id' => $prefix . 'popup_class', 'type' => 'text', 'std' => ''), array('label' => __('Add Custom CSS', 'vibe-customtypes'), 'desc' => __('Custom CSS for Popup', 'vibe-customtypes'), 'id' => $prefix . 'custom_css', 'type' => 'textarea', 'std' => ''));
            break;
    }
    return apply_filters('wplms_' . $metabox . '_metabox', $metabox_settings);
}
Esempio n. 16
0
function memberlite_settings_meta_box_callback($post)
{
    wp_nonce_field('memberlite_settings_meta_box', 'memberlite_settings_meta_box_nonce');
    $memberlite_page_template = get_post_meta($post->ID, '_wp_page_template', true);
    $memberlite_banner_desc = get_post_meta($post->ID, '_memberlite_banner_desc', true);
    $memberlite_banner_hide_title = get_post_meta($post->ID, '_memberlite_banner_hide_title', true);
    $memberlite_banner_hide_breadcrumbs = get_post_meta($post->ID, '_memberlite_banner_hide_breadcrumbs', true);
    $memberlite_banner_right = get_post_meta($post->ID, '_memberlite_banner_right', true);
    $memberlite_banner_bottom = get_post_meta($post->ID, '_memberlite_banner_bottom', true);
    $memberlite_landing_page_checkout_button = get_post_meta($post->ID, '_memberlite_landing_page_checkout_button', true);
    $memberlite_landing_page_level = get_post_meta($post->ID, '_memberlite_landing_page_level', true);
    $memberlite_landing_page_upsell = get_post_meta($post->ID, '_memberlite_landing_page_upsell', true);
    echo '<h2>' . __('Page Banner Settings', 'memberlite') . '</h2>';
    echo '<p style="margin: 1rem 0 0 0;"><strong>' . __('Banner Description', 'memberlite') . '</strong> <em>Shown in the masthead banner below the page title.</em>';
    if ($memberlite_page_template == 'templates/landing.php' && function_exists('pmpro_getAllLevels')) {
        echo ' <em>Leave blank to show landing page level description as banner description.</em>';
    }
    echo '</p>';
    echo '<label class="screen-reader-text" for="memberlite_banner_desc">';
    _e('Banner Description', 'memberlite');
    echo '</label>';
    echo '<textarea class="large-text" rows="3" id="memberlite_banner_desc" name="memberlite_banner_desc">';
    echo $memberlite_banner_desc;
    echo '</textarea>';
    echo '<input type="hidden" name="memberlite_banner_hide_title_present" value="1" />';
    echo '<label for="memberlite_banner_hide_title" class="selectit"><input name="memberlite_banner_hide_title" type="checkbox" id="memberlite_banner_hide_title" value="1" ' . checked($memberlite_banner_hide_title, 1, false) . '>' . __('Hide Page Title on Single View', 'memberlite') . '</label>';
    echo '<input type="hidden" name="memberlite_banner_hide_breadcrumbs_present" value="1" />';
    echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<label for="memberlite_banner_hide_breadcrumbs" class="selectit"><input name="memberlite_banner_hide_breadcrumbs" type="checkbox" id="memberlite_banner_hide_breadcrumbs" value="1" ' . checked($memberlite_banner_hide_breadcrumbs, 1, false) . '>' . __('Hide Breadcrumbs', 'memberlite') . '</label>';
    echo '<p style="margin: 1rem 0 0 0;"><strong>' . __('Banner Right Column', 'memberlite') . '</strong> <em>Right side of the masthead banner. (i.e. Video Embed, Image or Action Button)</em></p>';
    echo '<label class="screen-reader-text" for="memberlite_banner_right">';
    _e('Banner Right Column', 'memberlite');
    echo '</label> ';
    echo '<textarea class="large-text" rows="3" id="memberlite_banner_right" name="memberlite_banner_right">';
    echo $memberlite_banner_right;
    echo '</textarea>';
    echo '<p style="margin: 1rem 0 0 0;"><strong>' . __('Page Bottom Banner', 'memberlite') . '</strong> <em>Banner shown above footer on pages. (i.e. call to action)</em></p>';
    echo '<label class="screen-reader-text" for="memberlite_banner_bottom">';
    _e('Page Bottom Banner', 'memberlite');
    echo '</label> ';
    echo '<textarea class="large-text" rows="3" id="memberlite_banner_bottom" name="memberlite_banner_bottom">';
    echo $memberlite_banner_bottom;
    echo '</textarea>';
    if ($memberlite_page_template == 'templates/landing.php' && function_exists('pmpro_getAllLevels')) {
        echo '<hr />';
        echo '<h2>' . __('Landing Page Settings', 'memberlite') . '</h2>';
        $membership_levels = pmpro_getAllLevels();
        if (empty($membership_levels)) {
            echo '<div class="inline notice error"><p><a href="' . admin_url('admin.php?page=pmpro-membershiplevels') . '">Add a Membership Level to Use These Landing Page Features &raquo;</a></p>';
        } else {
            echo '<table class="form-table"><tbody>';
            echo '<tr><th scope="row">' . __('Membership Level', 'memberlite') . '</th>';
            echo '<td><label class="screen-reader-text" for="memberlite_landing_page_level">';
            _e('Landing Page Membership Level', 'memberlite');
            echo '</label> ';
            echo '<select id="memberlite_landing_page_level" name="memberlite_landing_page_level">';
            echo '<option value="blank" ' . selected($memberlite_landing_page_level, "blank") . '>- Select -</option>';
            foreach ($membership_levels as $level) {
                echo '<option value="' . $level->id . '"' . selected($memberlite_landing_page_level, $level->id) . '>' . $level->name . '</option>';
            }
            echo '</select></td></tr>';
            echo '<tr><th scope="row">' . __('Checkout Button Text', 'memberlite') . '</th>';
            echo '<td><label class="screen-reader-text" for="memberlite_landing_page_checkout_button">';
            _e('Checkout Button Text', 'memberlite');
            echo '</label> ';
            echo '<input type="text" id="memberlite_landing_page_checkout_button" name="memberlite_landing_page_checkout_button" value="' . $memberlite_landing_page_checkout_button . '"> <em>(default: "Select")</em></td></tr>';
            echo '<tr><th scope="row">' . __('Membership Level Upsell', 'memberlite') . '</th>';
            echo '<td><label class="screen-reader-text" for="memberlite_landing_page_upsell">';
            _e('Landing Page Membership Level Upsell', 'memberlite');
            echo '</label> ';
            echo '<select id="memberlite_landing_page_upsell" name="memberlite_landing_page_upsell">';
            echo '<option value="blank" ' . selected($memberlite_landing_page_upsell, "blank") . '>- Select -</option>';
            foreach ($membership_levels as $level) {
                echo '<option value="' . $level->id . '"' . selected($memberlite_landing_page_upsell, $level->id) . '>' . $level->name . '</option>';
            }
            echo '</select></td></tr>';
            echo '</tbody></table>';
        }
    }
}
function pmprosm_pmpro_email_body($body, $pmpro_email)
{
    global $wpdb, $pmprosm_sponsored_account_levels;
    //only checkout emails, not admins
    if (strpos($pmpro_email->template, "checkout") !== false && strpos($pmpro_email->template, "admin") === false && strpos($pmpro_email->template, "debug") === false) {
        //get the user_id from the email
        $user_id = $wpdb->get_var("SELECT ID FROM {$wpdb->users} WHERE user_email = '" . $pmpro_email->data['user_email'] . "' LIMIT 1");
        $level_id = $pmpro_email->data['membership_id'];
        $code_id = pmprosm_getCodeByUserID($user_id);
        if (!empty($user_id) && !empty($code_id) && pmprosm_isMainLevel($level_id)) {
            //get code
            $code = $wpdb->get_row("SELECT * FROM {$wpdb->pmpro_discount_codes} WHERE id = '" . esc_sql($code_id) . "' LIMIT 1");
            //get sponsored levels
            $pmprosm_values = pmprosm_getValuesByMainLevel($level_id);
            if (!is_array($pmprosm_values['sponsored_level_id'])) {
                $sponsored_level_ids = array($pmprosm_values['sponsored_level_id']);
            } else {
                $sponsored_level_ids = $pmprosm_values['sponsored_level_id'];
            }
            //no sponsored levels to use codes for
            if (empty($sponsored_level_ids) || empty($sponsored_level_ids[0])) {
                return $body;
            }
            //no uses for this code
            if (empty($code->uses)) {
                return $body;
            }
            //check if we should update confirmation email
            if (isset($pmprosm_values['add_code_to_confirmation_email']) && $pmprosm_values['add_code_to_confirmation_email'] === false) {
                return $body;
            }
            //figure out urls for code
            $code_urls = array();
            $pmpro_levels = pmpro_getAllLevels(true, true);
            foreach ($sponsored_level_ids as $sponsored_level_id) {
                $level_name = $pmpro_levels[$sponsored_level_id]->name;
                $code_urls[] = array("name" => $level_name, "url" => pmpro_url("checkout", "?level=" . $sponsored_level_id . "&discount_code=" . $code->code));
            }
            //build message
            $message = "<p>" . sprintf(__("Give this code to your sponsored members to use at checkout: %s", "pmpro_sponsored_members"), $code->code) . "<br />";
            if (count($code_urls) > 1) {
                $message .= __("Or provide one of these direct links to register:", "pmpro_sponsored_members") . "</p>";
            } else {
                $message .= __("Or provide this direct link to register:", "pmpro_sponsored_members") . "</p>";
            }
            $message .= "<ul>";
            foreach ($code_urls as $code_url) {
                $message .= "<li>" . $code_url['name'] . ": <strong>" . $code_url['url'] . "</strong></li>";
            }
            $message .= "</ul>";
            $body = $message . "<hr />" . $body;
        }
    }
    return $body;
}
function pmpropbc_cancel_overdue_orders()
{
    global $wpdb;
    //make sure we only run once a day
    $now = current_time('timestamp');
    $today = date("Y-m-d", $now);
    //have to run for each level, so get levels
    $levels = pmpro_getAllLevels(true, true);
    if (empty($levels)) {
        return;
    }
    foreach ($levels as $level) {
        //get options
        $options = pmpropbc_getOptions($level->id);
        if (!empty($options['cancel_days'])) {
            $date = date("Y-m-d", strtotime("+ " . $options['cancel_days'] . " days", $now));
        } else {
            $date = $today;
        }
        //need to get all combos of pay cycle and period
        $sqlQuery = "SELECT DISTINCT(CONCAT(cycle_number, ' ', cycle_period)) FROM {$wpdb->pmpro_memberships_users} WHERE membership_id = '" . $level->id . "' AND cycle_number > 0 AND status = 'active'";
        $combos = $wpdb->get_col($sqlQuery);
        if (empty($combos)) {
            continue;
        }
        foreach ($combos as $combo) {
            //get all check orders still pending after X days
            $sqlQuery = "\r\n\t\t\t\tSELECT id \r\n\t\t\t\tFROM {$wpdb->pmpro_membership_orders} \r\n\t\t\t\tWHERE membership_id = {$level->id} \r\n\t\t\t\t\tAND gateway = 'check' \r\n\t\t\t\t\tAND status = 'pending' \r\n\t\t\t\t\tAND DATE_ADD(timestamp, INTERVAL {$combo}) <= '" . $date . "'\r\n\t\t\t\t\tAND notes NOT LIKE '%Cancelled:%' AND notes NOT LIKE '%Cancellation Skipped:%'\r\n\t\t\t\tORDER BY id\r\n\t\t\t";
            if (defined('PMPRO_CRON_LIMIT')) {
                $sqlQuery .= " LIMIT " . PMPRO_CRON_LIMIT;
            }
            $orders = $wpdb->get_col($sqlQuery);
            if (empty($orders)) {
                continue;
            }
            foreach ($orders as $order_id) {
                //get the order and user data
                $order = new MemberOrder($order_id);
                $user = get_userdata($order->user_id);
                $user->membership_level = pmpro_getMembershipLevelForUser($order->user_id);
                //if they are no longer a member, let's not send them an email
                if (empty($user->membership_level) || empty($user->membership_level->ID) || $user->membership_level->id != $order->membership_id) {
                    //note when we send the reminder
                    $new_notes = $order->notes . "Cancellation Skipped:" . $today . "\n";
                    $wpdb->query("UPDATE {$wpdb->pmpro_membership_orders} SET notes = '" . esc_sql($new_notes) . "' WHERE id = '" . $order_id . "' LIMIT 1");
                    continue;
                }
                //cancel the order and subscription
                do_action("pmpro_membership_pre_membership_expiry", $order->user_id, $order->membership_id);
                //remove their membership
                pmpro_changeMembershipLevel(false, $order->user_id, 'expired');
                do_action("pmpro_membership_post_membership_expiry", $order->user_id, $order->membership_id);
                $send_email = apply_filters("pmpro_send_expiration_email", true, $order->user_id);
                if ($send_email) {
                    //send an email
                    $pmproemail = new PMProEmail();
                    $euser = get_userdata($order->user_id);
                    $pmproemail->sendMembershipExpiredEmail($euser);
                    if (current_user_can('manage_options')) {
                        printf(__("Membership expired email sent to %s. ", "pmpro"), $euser->user_email);
                    } else {
                        echo ". ";
                    }
                }
            }
        }
    }
}
Esempio n. 19
0
function memberlite_levels_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: [memberlite_levels levels="1,2,3" layout="table" hightlight="2" description="false" checkout_button="Register Now"]
    extract(shortcode_atts(array('account_button' => 'Your Level', 'back_link' => '1', 'checkout_button' => 'Select', 'compare' => NULL, 'description' => '1', 'discount_code' => NULL, 'expiration' => '1', 'highlight' => NULL, 'layout' => 'div', 'levels' => NULL, 'more_button' => NULL, 'price' => 'short', 'renew_button' => 'Renew'), $atts));
    global $wpdb, $pmpro_msg, $pmpro_msgt, $current_user, $pmpro_currency_symbol, $pmpro_all_levels, $pmpro_visible_levels, $current_user, $membership_levels;
    //turn 0's into falses
    if ($back_link === "0" || $back_link === "false" || $back_link === "no") {
        $back_link = false;
    } else {
        $back_link = true;
    }
    if ($compare === "0" || $compare === "false" || $compare === "no") {
        $compare = false;
    } else {
        $compareitems = explode(";", $compare);
    }
    if ($description === "0" || $description === "false" || $description === "no") {
        $description = false;
    } else {
        $description = true;
    }
    if ($expiration === "0" || $expiration === "false" || $expiration === "no") {
        $expiration = false;
    } else {
        $expiration = true;
    }
    if ($more_button === "0" || $more_button === "false" || $more_button === "no" || empty($more_button)) {
        $more_button = false;
    } elseif ($more_button === "1" || $more_button === "true" || $more_button === "yes") {
        $more_button = "Read More";
    }
    if ($price === "0" || $price === "false" || $price === "hide") {
        $show_price = false;
    } else {
        $show_price = true;
    }
    if (function_exists('pmpro_getAllLevels')) {
        ob_start();
        //make sure pmpro_levels has all levels
        if (!isset($pmpro_all_levels)) {
            $pmpro_all_levels = pmpro_getAllLevels(true, true);
        }
        if (!isset($pmpro_visible_levels)) {
            $pmpro_visible_levels = pmpro_getAllLevels(false, true);
        }
        if ($pmpro_msg) {
            ?>
			<div class="pmpro_message <?php 
            echo $pmpro_msgt;
            ?>
"><?php 
            echo $pmpro_msg;
            ?>
</div>
			<?php 
        }
        $pmpro_levels_filtered = array();
        if (!empty($levels)) {
            $levels_order = explode(",", $levels);
            //loop through $levels_order array and pull levels from $levels
            foreach ($levels_order as $level_id) {
                foreach ($pmpro_all_levels as $level) {
                    if ($level->id == $level_id) {
                        $pmpro_levels_filtered[$level->id] = $level;
                        break;
                    }
                }
            }
        } else {
            $pmpro_levels_filtered = $pmpro_visible_levels;
        }
        $pmpro_levels_filtered = apply_filters("pmpro_levels_array", $pmpro_levels_filtered);
        $numeric_levels_array = array_values($pmpro_levels_filtered);
        //update per discount code
        if (!empty($discount_code) && !empty($pmpro_levels_filtered)) {
            foreach ($pmpro_levels_filtered as $level_id => $level) {
                //check code for this level and update if applicable
                if (pmpro_checkDiscountCode($discount_code, $level->id)) {
                    $sqlQuery = "SELECT l.id, cl.*, l.name, l.description, l.allow_signups FROM {$wpdb->pmpro_discount_codes_levels} cl LEFT JOIN {$wpdb->pmpro_membership_levels} l ON cl.level_id = l.id LEFT JOIN {$wpdb->pmpro_discount_codes} dc ON dc.id = cl.code_id WHERE dc.code = '" . $discount_code . "' AND cl.level_id = '" . (int) $level->id . "' LIMIT 1";
                    $pmpro_levels_filtered[$level_id] = $wpdb->get_row($sqlQuery);
                    $pmpro_levels_filtered[$level_id]->base_level = $level;
                }
            }
        }
        if ($layout == 'table') {
            ?>
			<table id="pmpro_levels" class="pmpro_levels-table">
			<thead>
			  <tr>
				<th><?php 
            _e('Level', 'pmpro');
            ?>
</th>
				<?php 
            if (!empty($show_price)) {
                ?>
					<th><?php 
                _e('Price', 'pmpro');
                ?>
</th>	
				<?php 
            }
            ?>
				<?php 
            if (!empty($expiration)) {
                ?>
					<th><?php 
                _e('Expiration', 'pmpro');
                ?>
</th>
				<?php 
            }
            ?>
				<th>&nbsp;</th>
			  </tr>
			</thead>
			<tbody>
			<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                if (isset($current_user->membership_level->ID)) {
                    $current_level = $current_user->membership_level->ID == $level->id;
                } else {
                    $current_level = false;
                }
                ?>
				<tr class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
					<td>
						<h2><?php 
                echo $level->name;
                ?>
</h2>
						<?php 
                if (!empty($description)) {
                    echo wpautop($level->description);
                }
                ?>
						<?php 
                $level_page = memberlite_getLevelLandingPage($level->id);
                if (!empty($level_page)) {
                    ?>
								<p><a href="<?php 
                    echo get_permalink($level_page->ID);
                    ?>
"><?php 
                    echo $more_button;
                    ?>
</a></p>
								<?php 
                }
                ?>
					</td>
					<?php 
                if (!empty($show_price)) {
                    ?>
					<td>
						<?php 
                    if ($price === 'full') {
                        echo memberlite_getLevelCost($level, true, false);
                    } else {
                        echo memberlite_getLevelCost($level, true, true);
                    }
                    ?>
					</td>
					<?php 
                }
                ?>
					<?php 
                if (!empty($expiration)) {
                    ?>
							<td>
							<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
							</td>
							<?php 
                }
                ?>
					<td>
					<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
						<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
					<?php 
                } elseif (!$current_level) {
                    ?>
                	
						<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
					<?php 
                } elseif ($current_level) {
                    ?>
      
						
						<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
								<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
							<?php 
                    } else {
                        ?>
								<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
							<?php 
                    }
                    ?>
						
					<?php 
                }
                ?>
					</td>
				</tr>
				<?php 
            }
            ?>
			</tbody>
			</table>
			<?php 
        } elseif ($layout == 'compare_table') {
            ?>
			<table id="pmpro_levels" class="pmpro_levels-compare_table">
				<thead>
					<tr>
						<th><?php 
            _e('Level', 'pmpro');
            ?>
</th>
						<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<th class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
									<h2><?php 
                echo $level->name;
                ?>
</h2>
								</th>
								<?php 
            }
            ?>
					</tr>
					<?php 
            if (!empty($show_price)) {
                ?>
					<tr>
						<th><?php 
                _e('Price', 'pmpro');
                ?>
</th>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<th class="<?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<h1 class="primary">
									<?php 
                    if ($price === 'full') {
                        echo memberlite_getLevelCost($level, true, false);
                    } else {
                        echo memberlite_getLevelCost($level, true, true);
                    }
                    ?>
									</h1>
								</th>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					<?php 
            if (!empty($expiration)) {
                ?>
					<tr>
						<th><?php 
                _e('Expiration', 'pmpro');
                ?>
</th>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<th class="muted <?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
								</th>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					<tr>
						<th>&nbsp;</th>
						<?php 
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<th class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
								<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif (!$current_level) {
                    ?>
                	
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif ($current_level) {
                    ?>
      									
									<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
										<?php 
                    } else {
                        ?>
											<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
										<?php 
                    }
                    ?>
									
								<?php 
                }
                ?>
								</th>
								<?php 
            }
            ?>
					</tr>
				</thead>
				<tbody>
					<?php 
            if (!empty($compareitems)) {
                //var_dump($compareitems);
                foreach ($compareitems as $compareitem) {
                    ?>
							<tr>
							<?php 
                    $count = -1;
                    $compareitem_values = explode(",", $compareitem);
                    foreach ($compareitem_values as $compareitem_value) {
                        if ($count > 0 && !empty($numeric_levels_array[$count])) {
                            $level = $numeric_levels_array[$count];
                        } else {
                            $level = NULL;
                        }
                        $count++;
                        ?>
									<td class="<?php 
                        if ($current_level) {
                            echo 'pmpro_level-current ';
                        }
                        if (!empty($level) && $highlight == $level->id) {
                            echo 'pmpro_level-highlight ';
                        }
                        ?>
">
										<?php 
                        if ($compareitem_value == '1') {
                            echo '<i class="fa fa-check fa-2x success"></i>';
                        } elseif ($compareitem_value == '0') {
                            echo '<i class="fa fa-minus muted"></i>';
                        } else {
                            echo $compareitem_value;
                        }
                        ?>
									</td>
									<?php 
                    }
                    ?>
							</tr>
							<?php 
                }
            }
            ?>
				</tbody>
				<tfoot>
					<tr>
						<td>&nbsp;</td>
						<?php 
            foreach ($pmpro_levels_filtered as $level) {
                ?>
								<td class="<?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if (!empty($level) && $highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
								<?php 
                if (empty($current_user->membership_level->ID)) {
                    ?>
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif (!$current_level) {
                    ?>
                	
									<a class="pmpro_btn pmpro_btn-select" href="<?php 
                    echo pmpro_url("checkout", "?level=" . $level->id, "https");
                    ?>
"><?php 
                    echo $checkout_button;
                    ?>
</a>
								<?php 
                } elseif ($current_level) {
                    ?>
      									
									<?php 
                    //if it's a one-time-payment level, offer a link to renew
                    if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                        ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $renew_button;
                        ?>
</a>
										<?php 
                    } else {
                        ?>
											<a class="pmpro_btn disabled" href="<?php 
                        echo pmpro_url("account");
                        ?>
"><?php 
                        echo $account_button;
                        ?>
</a>
										<?php 
                    }
                    ?>
									
								<?php 
                }
                ?>
								</td>
								<?php 
            }
            ?>
					</tr>
					<?php 
            if (!empty($expiration)) {
                ?>
					<tr>
						<td><?php 
                _e('Expiration', 'pmpro');
                ?>
</td>
						<?php 
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<td class="muted <?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if ($highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_expiration = pmpro_getLevelExpiration($level);
                    if (empty($level_expiration)) {
                        _e('Membership Never Expires.', 'pmpro');
                    } else {
                        echo $level_expiration;
                    }
                    ?>
								</td>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					
					<?php 
            if (!empty($more_button)) {
                ?>
					<tr>
						<td><?php 
                _e('More Information', 'pmpro');
                ?>
</td>
						<?php 
                $count = 0;
                foreach ($pmpro_levels_filtered as $level) {
                    ?>
								<td class="<?php 
                    if ($current_level) {
                        echo 'pmpro_level-current ';
                    }
                    if (!empty($level) && $highlight == $level->id) {
                        echo 'pmpro_level-highlight ';
                    }
                    ?>
">
									<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
											<a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a>
											<?php 
                    }
                    ?>
								</td>
								<?php 
                }
                ?>
					</tr>
					<?php 
            }
            ?>
					
				</tfoot>
			</table>	
			<?php 
        } else {
            ?>
			<div id="pmpro_levels" class="pmpro_levels-<?php 
            echo $layout;
            ?>
 row">
			<?php 
            $count = 0;
            foreach ($pmpro_levels_filtered as $level) {
                $count++;
                if (isset($current_user->membership_level->ID)) {
                    $current_level = $current_user->membership_level->ID == $level->id;
                } else {
                    $current_level = false;
                }
                ?>
				<div class="medium-<?php 
                if ($layout == 'div' || empty($layout)) {
                    echo '12';
                } elseif ($layout == '2col') {
                    echo '6';
                } elseif ($layout == '3col') {
                    echo '4';
                } elseif ($layout == '4col') {
                    echo '3';
                } else {
                    if (count($pmpro_levels) > 1) {
                        echo '12';
                    }
                }
                //if($count == 1 || ($layout == 'div' || empty($layout))) { echo '12'; }
                ?>
 columns">
				<div class="hentry post <?php 
                if ($current_level) {
                    echo 'pmpro_level-current ';
                }
                if ($highlight == $level->id) {
                    echo 'pmpro_level-highlight ';
                }
                ?>
">
					<h2><?php 
                echo $level->name;
                ?>
</h2>
					<?php 
                if ((!empty($description) || !empty($more_button)) && ($layout == 'div' || $layout == '2col' || empty($layout))) {
                    ?>
						<div class="entry-content">
							<?php 
                    echo wpautop($level->description);
                    ?>
							<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
									<p><a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a></p>
									<?php 
                    }
                    ?>
						</div>
					<?php 
                }
                ?>
					<?php 
                if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                    ?>
						<footer class="entry-footer">	
						<?php 
                    if (empty($current_user->membership_level->ID)) {
                        ?>
								<a class="pmpro_btn pmpro_btn-select <?php 
                        if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                            echo 'alignright';
                        }
                        ?>
" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
								<?php 
                    } elseif (!$current_level) {
                        ?>
                	
								<a class="pmpro_btn pmpro_btn-select <?php 
                        if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                            echo 'alignright';
                        }
                        ?>
" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
								<?php 
                    } elseif ($current_level) {
                        //if it's a one-time-payment level, offer a link to renew
                        if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                            ?>
									<a class="pmpro_btn pmpro_btn-select <?php 
                            if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                                echo 'alignright';
                            }
                            ?>
" href="<?php 
                            echo pmpro_url("checkout", "?level=" . $level->id, "https");
                            ?>
"><?php 
                            echo $renew_button;
                            ?>
</a>
									<?php 
                        } else {
                            ?>
									<a class="pmpro_btn disabled <?php 
                            if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                                echo 'alignright';
                            }
                            ?>
" href="<?php 
                            echo pmpro_url("account");
                            ?>
"><?php 
                            echo $account_button;
                            ?>
</a>
									<?php 
                        }
                    }
                    ?>
						
						<?php 
                    if (!empty($show_price)) {
                        ?>
								<p class="pmpro_level-price">
								<?php 
                        if (pmpro_isLevelFree($level)) {
                            if (!empty($expiration)) {
                                ?>
											<strong><?php 
                                _e('Free.', 'pmpro');
                                ?>
</strong>
											<?php 
                            } else {
                                ?>
											<strong><?php 
                                _e('Free', 'pmpro');
                                ?>
</strong>
											<?php 
                            }
                        } elseif ($price === 'full') {
                            echo memberlite_getLevelCost($level, true, false);
                        } else {
                            echo memberlite_getLevelCost($level, true, true);
                        }
                        ?>
								</p>
								<?php 
                    }
                    ?>
		
						<?php 
                    if (!empty($expiration)) {
                        $level_expiration = pmpro_getLevelExpiration($level);
                        if (empty($level_expiration)) {
                            _e('Membership Never Expires.', 'pmpro');
                        } else {
                            echo $level_expiration;
                        }
                    }
                    ?>
						<?php 
                    if ($layout == 'div' || $layout == '2col' || empty($layout)) {
                        echo '<div class="clear"></div>';
                    }
                    ?>
						</footer> <!-- .entry-footer -->
						<?php 
                } else {
                    //This is a column-type div layout
                    ?>
							<div class="entry-content">
								<?php 
                    if (!empty($show_price)) {
                        ?>
										<p class="pmpro_level-price">
										<?php 
                        if ($price === 'full') {
                            echo memberlite_getLevelCost($level, true, false);
                        } else {
                            echo memberlite_getLevelCost($level, true, true);
                        }
                        ?>
										</p>
										<?php 
                    }
                    ?>
								
								<p class="pmpro_level-select"><?php 
                    if (empty($current_user->membership_level->ID)) {
                        ?>
										<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
										<?php 
                    } elseif (!$current_level) {
                        ?>
                	
										<a class="pmpro_btn pmpro_btn-select" href="<?php 
                        echo pmpro_url("checkout", "?level=" . $level->id, "https");
                        ?>
"><?php 
                        echo $checkout_button;
                        ?>
</a>
										<?php 
                    } elseif ($current_level) {
                        //if it's a one-time-payment level, offer a link to renew
                        if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                            ?>
											<a class="pmpro_btn pmpro_btn-select" href="<?php 
                            echo pmpro_url("checkout", "?level=" . $level->id, "https");
                            ?>
"><?php 
                            echo $renew_button;
                            ?>
</a>
											<?php 
                        } else {
                            ?>
											<a class="pmpro_btn disabled" href="<?php 
                            echo pmpro_url("account");
                            ?>
"><?php 
                            echo $account_button;
                            ?>
</a>
											<?php 
                        }
                    }
                    ?>
</p>

								<?php 
                    if (!empty($description)) {
                        echo wpautop($level->description);
                    }
                    ?>
								
								<?php 
                    $level_page = memberlite_getLevelLandingPage($level->id);
                    if (!empty($level_page)) {
                        ?>
										<p><a href="<?php 
                        echo get_permalink($level_page->ID);
                        ?>
"><?php 
                        echo $more_button;
                        ?>
</a></p>
										<?php 
                    }
                    ?>
						</div> <!-- .entry-content -->		
						<?php 
                    if (!empty($expiration)) {
                        echo '<footer class="entry-footer pmpro_level-expiration">';
                        $level_expiration = pmpro_getLevelExpiration($level);
                        if (empty($level_expiration)) {
                            _e('Membership Never Expires.', 'pmpro');
                        } else {
                            echo $level_expiration;
                        }
                        echo '</footer>';
                    }
                    ?>

							<?php 
                }
                ?>
				</div></div>
				<?php 
            }
            ?>
			</div> <!-- #pmpro_levels, .row -->
			<?php 
        }
        //end else if no layout specified, use 'div'
        ?>
			
		<?php 
        if (!is_page_template('templates/interstitial.php') && !empty($back_link)) {
            ?>
 
		<nav id="nav-below" class="navigation" role="navigation">
			<div class="nav-previous alignleft">
				<?php 
            if (!empty($current_user->membership_level->ID)) {
                ?>
					<a href="<?php 
                echo pmpro_url("account");
                ?>
"><?php 
                _e('&larr; Return to Your Account', 'pmpro');
                ?>
</a>
				<?php 
            } else {
                ?>
					<a href="<?php 
                echo home_url();
                ?>
"><?php 
                _e('&larr; Return to Home', 'pmpro');
                ?>
</a>
				<?php 
            }
            ?>
			</div>
		</nav>	
		<?php 
        }
        ?>
		
		<?php 
        $temp_content = ob_get_contents();
        ob_end_clean();
        return $temp_content;
    }
}
function getLevels()
{
    global $current_user;
    if ($current_user->ID) {
        $current_user->membership_level = pmpro_getMembershipLevelForUser($current_user->ID);
    }
    //is there a default level to redirect to?
    if (defined("PMPRO_DEFAULT_LEVEL")) {
        $default_level = intval(PMPRO_DEFAULT_LEVEL);
    } else {
        $default_level = false;
    }
    if ($default_level) {
        wp_redirect(pmpro_url("checkout", "?level=" . $default_level));
        exit;
    }
    global $wpdb, $pmpro_msg, $pmpro_msgt;
    if (isset($_REQUEST['msg'])) {
        if ($_REQUEST['msg'] == 1) {
            $pmpro_msg = __('Your membership status has been updated - Thank you!', 'pmpro');
        } else {
            $pmpro_msg = __('Sorry, your request could not be completed - please try again in a few moments.', 'pmpro');
            $pmpro_msgt = "pmpro_error";
        }
    } else {
        $pmpro_msg = false;
    }
    global $pmpro_levels;
    $pmpro_levels = pmpro_getAllLevels(false, true);
    $pmpro_levels = apply_filters("pmpro_levels_array", $pmpro_levels);
    if ($pmpro_msg) {
        ?>
        <div class="pmpro_message <?php 
        echo $pmpro_msgt;
        ?>
"><?php 
        echo $pmpro_msg;
        ?>
</div>
        <?php 
    }
    ?>

    <div id="main" class="site-main clr">
        <div id="membership-wrapper"> 
            <?php 
    $count = 0;
    $count_levels = count($pmpro_levels);
    $tmp = 0;
    foreach ($pmpro_levels as $level) {
        if (isset($current_user->membership_level->ID)) {
            $current_level = $current_user->membership_level->ID == $level->id;
        } else {
            $current_level = false;
        }
        ?>

                <?php 
        $last = $count_levels - $tmp;
        ?>
  
                <?php 
        $tmp = $tmp + 1;
        ?>

                <div class="box-level <?php 
        if ($count++ % 2 == 0) {
            ?>
odd<?php 
        } else {
            ?>
 even<?php 
        }
        if ($current_level == $level) {
            ?>
 active<?php 
        }
        if ($last == 2 || $last == 1) {
            ?>
 last-box<?php 
        }
        ?>
">
                    <h1><?php 
        echo $current_level ? "<strong>{$level->name}</strong>" : $level->name;
        ?>
</h1>
                    <div class="copy">
                        <?php 
        if (pmpro_isLevelFree($level)) {
            $cost_text = "<strong>Free</strong>";
        } else {
            $cost_text = pmpro_getLevelCost($level, true, true);
        }
        $expiration_text = pmpro_getLevelExpiration($level);
        if (!empty($cost_text) && !empty($expiration_text)) {
            echo $cost_text . "<br />" . $expiration_text;
        } elseif (!empty($cost_text)) {
            echo $cost_text;
        } elseif (!empty($expiration_text)) {
            echo $expiration_text;
        }
        ?>
                    </div>
                    <div class="links">
                        <?php 
        if (empty($current_user->membership_level->ID)) {
            ?>
                            <a class="pmpro_btn pmpro_btn-select sign-up" href="<?php 
            echo pmpro_url("checkout", "?level=" . $level->id, "https");
            ?>
"><?php 
            _e('Sign Up', 'pmpro');
            ?>
</a>
                        <?php 
        } elseif (!$current_level) {
            ?>
     
                            <!--
                            <a class="pmpro_btn pmpro_btn-select" href="<?php 
            //echo pmpro_url("checkout", "?level=" . $level->id, "https")
            ?>
"><?php 
            //_e('Change Subscription', 'pmpro');
            ?>
</a>
                            -->
                            <a class="pmpro_btn pmpro_btn-select change-subscription" href="<?php 
            echo "/billing/subscription-checkout?level=" . $level->id;
            ?>
"><?php 
            _e('Change Subscription', 'pmpro');
            ?>
</a>
                        <?php 
        } elseif ($current_level) {
            ?>
      
                            <?php 
            //if it's a one-time-payment level, offer a link to renew
            if (!pmpro_isLevelRecurring($current_user->membership_level) && !empty($current_user->membership_level->enddate)) {
                ?>
                                <a class="pmpro_btn pmpro_btn-select renew" href="<?php 
                echo pmpro_url("checkout", "?level=" . $level->id, "https");
                ?>
"><?php 
                _e('Renew', 'pmpro');
                ?>
</a>
                                <?php 
            } else {
                ?>
                                <a class="pmpro_btn disabled your-current-level" href="<?php 
                echo pmpro_url("account");
                ?>
"><?php 
                _e('Your&nbsp;Current&nbsp;Level', 'pmpro');
                ?>
</a>
                                <?php 
            }
            ?>
                        <?php 
        }
        ?>
                    </div>
                </div>
                <?php 
    }
    ?>
            <div class="clear clearfix"></div>
            <nav id="nav-below" class="navigation" role="navigation">
                <div class="nav-previous alignleft">
                    <?php 
    if (!empty($current_user->membership_level->ID)) {
        ?>
                        <!--
                            <a href="<?php 
        echo pmpro_url("account");
        ?>
"><?php 
        _e('&larr; Return to Your Account', 'pmpro');
        ?>
</a>
                        -->
                    <?php 
    } else {
        ?>
                        <a href="<?php 
        echo home_url();
        ?>
"><?php 
        _e('&larr; Return to Home', 'pmpro');
        ?>
</a>
                    <?php 
    }
    ?>
                </div>
            </nav>
        </div>
    </div>    

    <?php 
}
Esempio n. 21
0
						value="<?php 
    echo "Last Year";
    ?>
" <?php 
    selected($predefined_date, "Last Year");
    ?>
><?php 
    echo "Last Year";
    ?>
</option>

				</select>

				<?php 
    //Note: only orders belonging to current levels can be filtered. There is no option for orders belonging to deleted levels
    $levels = pmpro_getAllLevels(true, true);
    ?>
				<select id="l" name="l">
					<?php 
    foreach ($levels as $level) {
        ?>
						<option
							value="<?php 
        echo $level->id;
        ?>
" <?php 
        selected($l, $level->id);
        ?>
><?php 
        echo $level->name;
        ?>
Esempio n. 22
0
function pmpro_slack_levels_callback()
{
    $options = get_option('pmpro_slack');
    $levels = pmpro_getAllLevels(true, true);
    echo "<p>Which levels should notifications be sent for?</p>";
    echo "<select multiple='yes' name=\"pmpro_slack[levels][]\">";
    foreach ($levels as $level) {
        echo "<option value='" . $level->id . "' ";
        if (in_array($level->id, $options['levels'])) {
            echo "selected='selected'";
        }
        echo ">" . $level->name . "</option>";
    }
    echo "</select>";
}