示例#1
0
function accesspress_profile_content($atts, $content = '')
{
    add_filter('comments_open', '__return_false');
    if (!is_user_logged_in()) {
        return sprintf(__('Please <a href="%s">Log in</a> to view your account.', 'premise'), memberaccess_login_redirect(get_permalink()));
    }
    $user = wp_get_current_user();
    $args = array('heading_text' => '', 'first-name' => $user->first_name, 'last-name' => $user->last_name, 'show_email_address' => false, 'show_username' => false, 'label_separator' => ':');
    ob_start();
    accesspress_checkout_form_account($args);
    return '<div class="premise-checkout-wrap">' . ob_get_clean() . '</div>';
}
示例#2
0
 function post_content_filter($content)
 {
     global $post;
     $protected = accesspress_get_custom_field('_acp_protection');
     if (!$protected) {
         return $content;
     }
     // close comments on protected content
     add_filter('comments_open', '__return_false', 99);
     if ($post->post_status == 'draft' && 'true' == $_GET['preview']) {
         return $content;
     }
     if (!is_user_logged_in()) {
         return sprintf(__('Please <a href="%s">Log in</a> to view this content.', 'premise'), memberaccess_login_redirect(get_permalink()));
     }
     $user = wp_get_current_user();
     $cap = 'edit_other_' . ('page' == $post->post_type ? 'post' : $post->post_type) . 's';
     if ($user->ID == $post->post_author || current_user_can($cap)) {
         return $content;
     }
     $access_level = get_post_meta($post->ID, '_acp_access_levels', true);
     if (member_has_access_level($access_level)) {
         if ('member' == $protected) {
             return $content;
         }
     } elseif ('nonmember' == $protected) {
         return $content;
     }
     return '';
 }
示例#3
0
文件: shortcodes.php 项目: juslee/e27
function accesspress_profile_content($atts, $content = '')
{
    global $post;
    add_filter('comments_open', '__return_false');
    $message = isset($_REQUEST['password-changed']) && $_REQUEST['password-changed'] == 'true' ? '<span class="premise-message">' . __('Password Changed.', 'premise') . '</span> ' : '';
    if (!is_user_logged_in()) {
        return $message . sprintf(__('Please <a href="%s">Log in</a> to view your account.', 'premise'), memberaccess_login_redirect(get_permalink()));
    }
    $user = wp_get_current_user();
    /** Get shortcode $atts */
    $atts = shortcode_atts(array('heading_text' => __('Your Account', 'premise'), 'show_email_address' => false, 'show_username' => false, 'label_separator' => ':'), $atts);
    /** Merge $atts with $args */
    $args = wp_parse_args($atts, array('account_box_heading' => $atts['heading_text'], 'first-name' => $user->first_name, 'last-name' => $user->last_name, 'disabled' => !isset($post->ID) || $post->ID != accesspress_get_option('member_page')));
    $submit = '';
    if (!$args['disabled']) {
        $submit = sprintf('<input type="submit" value="%s" class="input-submit" />', __('Update', 'premise'));
        $args['nonce_key'] = 'premise-member-profile-' . $user->ID;
    }
    ob_start();
    accesspress_checkout_form_account($args);
    return $message . '<form method="post"><div class="premise-checkout-wrap">' . ob_get_clean() . $submit . '</div></form>';
}
示例#4
0
 function post_content_filter($content)
 {
     if (!premise_is_protected_content()) {
         return $content;
     }
     // close comments on protected content
     add_filter('comments_open', '__return_false', 99);
     if (!is_user_logged_in()) {
         return sprintf(__('Please <a href="%s">Log in</a> to view this content.', 'premise'), memberaccess_login_redirect(get_permalink()));
     }
     if (premise_has_content_access()) {
         return $content;
     }
     return '';
 }