Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function can_access( $element ) {
- if( is_admin() ) {
- return true;
- }
- $widget_tags = $element->get_settings( 'wpf_tags' );
- $widget_tags_not = $element->get_settings( 'wpf_tags_not' );
- if( empty( $widget_tags ) && empty( $widget_tags_not ) ) {
- return true;
- }
- if ( wp_fusion()->settings->get( 'exclude_admins' ) == true && current_user_can( 'manage_options' ) ) {
- return true;
- }
- $can_access = true;
- if( is_user_logged_in() ) {
- // See if user has required tags
- $user_tags = wp_fusion()->user->get_tags();
- if( ! empty( $widget_tags ) ) {
- $result = array_intersect( $widget_tags, $user_tags );
- if( empty( $result ) ) {
- $can_access = false;
- }
- }
- if( $can_access == true && ! empty( $widget_tags_not ) ) {
- $result = array_intersect( $widget_tags_not, $user_tags );
- if( ! empty( $result ) ) {
- $can_access = false;
- }
- }
- } else {
- // Not logged in
- $can_access = false;
- }
- $can_access = apply_filters( 'wpf_elementor_can_access', $can_access, $element, $user_tags );
- if( $can_access ) {
- return true;
- } else {
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement