function rcp_filter_restricted_content($content) { global $post, $user_ID, $rcp_options; if (rcp_is_paid_content($post->ID)) { $message = !empty($rcp_options['paid_message']) ? $rcp_options['paid_message'] : false; // message shown for premium content } else { $message = !empty($rcp_options['free_message']) ? $rcp_options['free_message'] : false; // message shown for free content } if (empty($message)) { $message = __('This content is restricted to subscribers', 'rcp'); } if (!rcp_user_can_access($user_ID, $post->ID)) { return rcp_format_teaser($message); } return $content; }
/** * Remove comments from posts/pages if user does not have access * * @since 2.6 * @param $template Path to template file to load * * @return string Path to template file to load */ function rcp_hide_comments($template) { $post_id = get_the_ID(); if (!empty($post_id)) { if (!rcp_user_can_access(get_current_user_id(), $post_id)) { $template = rcp_get_template_part('comments', 'no-access', false); } } return $template; }