Properties

$singular_page

$singular_page : bool

If true then we use individual restrict content options for post

Type

normal

$redirect_handler

$redirect_handler : bool

Type

normal

$allow_access

$allow_access : bool

Type

normal

$ignore_exclude

$ignore_exclude

Methods

__construct()

__construct() : mixed

Access constructor.

Returns

mixed

initialize_hooks()

initialize_hooks() : mixed

Rollback function for old business logic to avoid security enhancements with 404 errors

Returns

mixed

exclude_posts_array()

exclude_posts_array(bool  $force = false, bool|array|string  $post_types = false) : array

Get array with restricted posts

Parameters

bool $force
bool|array|string $post_types

Returns

array

exclude_terms_array()

exclude_terms_array(\WP_Term_Query  $query) : array

Get array with restricted terms

Parameters

\WP_Term_Query $query

Returns

array

exclude_hidden_terms_query()

exclude_hidden_terms_query(\WP_Term_Query  $query) : mixed

Parameters

\WP_Term_Query $query

Returns

mixed

exclude_posts()

exclude_posts(\WP_Query  $query) : mixed

Parameters

\WP_Query $query

Returns

mixed

exclude_posts_where()

exclude_posts_where(string  $where, \WP_Query  $query) : mixed

Exclude restricted post from query if there is a single query that exclude post_not_in by default in WP_Query

Parameters

string $where
\WP_Query $query

Returns

mixed

custom_count_posts_handler()

custom_count_posts_handler(object  $counts, string  $type = 'post', string  $perm = '') : object

Change the posts count based on restriction settings

Parameters

object $counts

Post counts

string $type

Post type

string $perm

The permission to determine if the posts are 'readable' by the current user.

Returns

object

exclude_restricted_posts_widget()

exclude_restricted_posts_widget(array  $array) : array

Exclude restricted posts in Recent Posts widget

Parameters

array $array

Query args

Returns

array

exclude_restricted_pages()

exclude_restricted_pages(array  $array) : array

Exclude restricted posts in Recent Posts widget

Parameters

array $array

Query args

Returns

array

exclude_restricted_posts_archives_widget()

exclude_restricted_posts_archives_widget(string  $sql_where, array  $parsed_args = array()) : string

Exclude restricted posts in widgets

Parameters

string $sql_where
array $parsed_args

Returns

string

exclude_navigation_posts()

exclude_navigation_posts(string  $where, bool  $in_same_term = false, string|array  $excluded_terms = '', string  $taxonomy = 'category', null|\WP_Post  $post = null) : string

Exclude posts from next, previous navigation

Parameters

string $where
bool $in_same_term
string|array $excluded_terms
string $taxonomy
null|\WP_Post $post

Returns

string

filter_restricted_post_title()

filter_restricted_post_title(string  $title, int|null  $id = null) : string

Replace titles of restricted posts.

Parameters

string $title

Post title.

int|null $id

Post ID.

Returns

string

filter_restricted_post_content()

filter_restricted_post_content(string  $content) : string

Replace content of restricted posts.

Parameters

string $content

Post Content.

Returns

string

filter_restricted_post_excerpt()

filter_restricted_post_excerpt(string  $post_excerpt = '', \WP_Post  $post = null) : string

Replace excerpt of restricted posts.

Parameters

string $post_excerpt

Post Excerpt.

\WP_Post $post

WP_Post instance.

Returns

string

filter_attachment()

filter_attachment(string  $url, int  $attachment_id) : bool|string

Hide attachment if the post is restricted

Parameters

string $url
int $attachment_id

Returns

bool|string

filter_post_thumbnail()

filter_post_thumbnail( $has_thumbnail,  $post = null,  $thumbnail_id = false) : bool

Hide attachment if the post is restricted

Parameters

$has_thumbnail
$post
$thumbnail_id

Returns

bool

exclude_posts_comments()

exclude_posts_comments(\WP_Comment_Query  $query) : mixed

Exclude comments from restricted posts in widgets

Parameters

\WP_Comment_Query $query

Returns

mixed

get_available_comments_post_types()

get_available_comments_post_types() : array

Returns

array

exclude_posts_comments_feed()

exclude_posts_comments_feed(string  $where, \WP_Query  $query) : string

Exclude comments from comments feed

Parameters

string $where
\WP_Query $query

Returns

string

custom_comments_count_handler()

custom_comments_count_handler(array|object  $stats = array(), int  $post_id) : object

Parameters

array|object $stats
int $post_id

Post ID. Can be 0 for the whole website

Returns

object

get_comment_count()

get_comment_count(int  $post_id, array  $exclude_posts = array()) : array

Parameters

int $post_id
array $exclude_posts

Returns

array

disable_comments_open()

disable_comments_open(mixed  $open, int  $post_id) : bool

Disable comments if user has not permission to access this post

Parameters

mixed $open
int $post_id

Returns

bool

disable_comments_open_number()

disable_comments_open_number(int  $count, int  $post_id) : bool

Disable comments if user has not permission to access this post

Parameters

int $count
int $post_id

Returns

bool

filter_menu()

filter_menu(array  $menu_items, array  $args = array()) : array

Protect Post Types in menu query Restrict content new logic

Parameters

array $menu_items
array $args

Returns

array

restrict_blocks()

restrict_blocks( $block_content,  $block) : string

Parameters

$block_content
$block

Returns

string

maybe_replace_title()

maybe_replace_title(\WP_Post  $post) : \WP_Post

Parameters

\WP_Post $post

Returns

\WP_Post

maybe_replace_nav_menu_title()

maybe_replace_nav_menu_title(\WP_Post  $nav_item) : \WP_Post

Parameters

\WP_Post $nav_item

Returns

\WP_Post

filter_protected_posts()

filter_protected_posts(array  $posts, array|\WP_Query  $query) : array

Protect Post Types in query Restrict content new logic

Parameters

array $posts

Posts query result.

array|\WP_Query $query

WP_Query instance.

Returns

array

template_redirect()

template_redirect() : mixed

Set custom access actions and redirection

Old global restrict content logic

Returns

mixed

um_access_check_blog_page_settings()

um_access_check_blog_page_settings() : mixed

Check Blog page Content Restriction settings

Returns

mixed

um_access_check_individual_term_settings()

um_access_check_individual_term_settings() : mixed

Check individual term Content Restriction settings

Returns

mixed

taxonomy_message()

taxonomy_message( $template,  $type,  $templates) : string

Parameters

$template
$type
$templates

Returns

string

blog_message()

blog_message( $template,  $type,  $templates) : string

Parameters

$template
$type
$templates

Returns

string

um_access_check_global_settings()

um_access_check_global_settings() : mixed

Check global accessible settings

Returns

mixed

check_access()

check_access() : bool

Check access

Returns

bool

send_frame_options_header()

send_frame_options_header() : mixed

Sends a HTTP header to limit rendering of pages to same origin iframes when loading sensitive pages.

Can be disabled with: remove_action( 'template_redirect', array( UM()->access(), 'send_frame_options_header' ), 1010 );

Returns

mixed

set_referer()

set_referer(string  $url, string  $referer) : string

Sets a custom access referer in a redirect URL

Parameters

string $url
string $referer

Returns

string

get_post_privacy_settings()

get_post_privacy_settings(\WP_Post|int  $post) : bool|array

Get privacy settings for post return false if post is not private Restrict content new logic

Parameters

\WP_Post|int $post

Post ID or object

Returns

bool|array

user_can()

user_can( $user_id,  $roles) : bool

Helper for checking if the user can some of the roles array

Parameters

$user_id
$roles

Returns

bool

um_custom_restriction()

um_custom_restriction(array  $restriction) : bool

Helper for 3rd-party integrations with content restriction settings

Parameters

array $restriction

Returns

bool

is_restricted()

is_restricted(int  $post_id, bool  $on_single_page = false, bool  $ignore_cache = false) : bool

Is post restricted?

Parameters

int $post_id
bool $on_single_page
bool $ignore_cache

Returns

bool

is_restricted_term()

is_restricted_term(int  $term_id, bool  $on_term_page = false, bool  $ignore_cache = false) : bool

Is term restricted?

Parameters

int $term_id
bool $on_term_page
bool $ignore_cache

Returns

bool