예제 #1
0
파일: config.php 프로젝트: 6226/wp
 /**
  * Checks $area for applied restrictions based on user status(logged in, membership level)
  * and does the proper redirect
  * @global object $current_user
  * @param string $area
  * @param array $restrict_options
  * @since 2.0
  */
 function kleo_check_access($area, $restrict_options = null)
 {
     global $current_user;
     if (!$restrict_options) {
         $restrict_options = kleo_memberships();
     }
     if (pmpro_url("levels")) {
         $default_redirect = pmpro_url("levels");
     } else {
         $default_redirect = bp_get_signup_page();
     }
     $default_redirect = apply_filters('kleo_pmpro_url_redirect', $default_redirect);
     //no restriction
     if ($restrict_options[$area]['type'] == 0) {
         return;
     }
     //restrict all members -> go to home url
     if ($restrict_options[$area]['type'] == 1) {
         wp_redirect(apply_filters('kleo_pmpro_home_redirect', home_url()));
         exit;
     }
     //is a member
     if (isset($current_user->membership_level) && $current_user->membership_level->ID) {
         //if restrict my level
         if ($restrict_options[$area]['type'] == 2 && is_array($restrict_options[$area]['levels']) && !empty($restrict_options[$area]['levels']) && pmpro_hasMembershipLevel($restrict_options[$area]['levels'])) {
             wp_redirect($default_redirect);
             exit;
         }
         //logged in but not a member
     } else {
         if (is_user_logged_in()) {
             if ($restrict_options[$area]['type'] == 2 && isset($restrict_options[$area]['not_member']) && $restrict_options[$area]['not_member'] == 1) {
                 wp_redirect($default_redirect);
                 exit;
             }
         } else {
             if ($restrict_options[$area]['type'] == 2 && isset($restrict_options[$area]['guest']) && $restrict_options[$area]['guest'] == 1) {
                 wp_redirect($default_redirect);
                 exit;
             }
         }
     }
 }
예제 #2
0
파일: levels.php 프로젝트: 6226/wp
if ($pmpro_msg) {
    ?>
<div class="message <?php 
    echo $pmpro_msgt;
    ?>
"><?php 
    echo $pmpro_msg;
    ?>
</div>
<?php 
}
?>
<div class="row membership pricing-table">
    
	<?php 
$restrict_options = kleo_memberships();
$pmpro_levels = array_filter($pmpro_levels);
$levelsno = count($pmpro_levels);
$levelsno = $levelsno == 0 ? 1 : $levelsno;
$level_cols = 12 / $levelsno;
$newoptions = sq_option('membership');
$popular = $newoptions['kleo_membership_popular'];
$kleo_pmpro_levels_order = isset($newoptions['kleo_pmpro_levels_order']) ? $newoptions['kleo_pmpro_levels_order'] : NULL;
switch ($level_cols) {
    case "1":
        $level_cols = "1";
        break;
    case "2":
        $level_cols = "2";
        break;
    case "3":
예제 #3
0
파일: config.php 프로젝트: quyip8818/wps
    function kleo_pmpro_restrict_pm_email_content($email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud)
    {
        $restrict_message = false;
        $restrict_options = kleo_memberships();
        $area = 'pm';
        if (pmpro_getMembershipLevelForUser($ud->ID)) {
            $current_level_obj = pmpro_getMembershipLevelForUser($ud->ID);
            $current_level = $current_level_obj->ID;
            //if restrict my level
            if ($restrict_options[$area]['type'] == 2 && isset($restrict_options[$area]['levels']) && is_array($restrict_options[$area]['levels']) && !empty($restrict_options[$area]['levels']) && in_array($current_level, $restrict_options[$area]['levels'])) {
                $restrict_message = true;
            }
        } else {
            /* not a member */
            if ($restrict_options[$area]['type'] == 2 && isset($restrict_options[$area]['not_member']) && $restrict_options[$area]['not_member'] == 1) {
                $restrict_message = true;
            }
        }
        if ($restrict_message) {
            $content = 'Your current membership does not allow private messages access.';
            $email_content = sprintf(__('%1$s sent you a new message:

Subject: %2$s

"%3$s"

To view and read your messages please log in and visit: %4$s

---------------------
', 'buddypress'), $sender_name, $subject, $content, $message_link);
            // Only show the disable notifications line if the settings component is enabled
            if (bp_is_active('settings')) {
                $email_content .= sprintf(__('To disable these notifications, please log in and go to: %s', 'buddypress'), $settings_link);
            }
            return $email_content;
        }
        return $email_content;
    }