Forum Replies Created

Viewing 15 posts - 406 through 420 (of 2,511 total)
  • Author
    Posts
  • Vladimir
    Keymaster

    Is ‘Site Manager’ role created by some plugin? I suppose the situation when that plugin recreates this role every time its loaded.
    What if you add ‘manage_options’ to any other role? Will it stay there?
    If Yes, use workaround – assign role with ‘manage_options’ to the user with ‘Site Manager’ role as the 2nd one.

    in reply to: Allow access to asset cleanup pro plugin #7263
    Vladimir
    Keymaster

    Hi,

    Share plugin .zip with support [at-sign] role-editor.com via DropBox, Google Drive or similar service. I will look what permissions it requires. I install such software locally and use in the investigation purpose only.

    in reply to: Defining Posts View Access in php #7260
    Vladimir
    Keymaster

    Look if 99 post has category, which also has view restriction at category level. It’s just assumption about possible conflict with a hook. It should not take place though.

    It it will not help. I can look at your data on site tomorrow. If it’s applicable send URL and admin login credentials to support [at-sign] role-editor.com

    in reply to: Defining Posts View Access in php #7258
    Vladimir
    Keymaster

    Really, when you create new role as a copy of ‘none’, URE adds to it at least one capability – ‘read’. Does your role has it? I did not make tests with absolutely empty roles.

    It should not have difference what role do you use built-in or custom one. Role should exist and current user should have it.

    I used ‘author’ role as an example only, it does not play a key role, what role to use.

    in reply to: Defining Posts View Access in php #7256
    Vladimir
    Keymaster

    Btw., if you use any caching plugin, try to use different computers for testing view access.

    in reply to: Defining Posts View Access in php #7255
    Vladimir
    Keymaster

    OK. I made own test.
    Set for the post ID=3267 at the post editor these values:
    – View Access: Prohibit view;
    – For Users: All visitors (logged in or not);
    – Action: Return HTTP 404 error.

    As a result the post is not accessible for not logged-in and logged-in users.
    Then I added the code:

    
    add_filter( 'ure_content_view_access_data_for_role', 'my_content_view_access_data_for_role', 10, 2 );
     
    function my_content_view_access_data_for_role( $restriction, $role_id ) {
        if ( $role_id=='author' ) {
            $restriction['access_model'] = 2;
            $restriction['access_error_action'] = 1;
            $restriction['data']['posts'] = array( 3267 );   // posts/pages ID list
        } 
     
        return $restriction;
    }
    

    The post is not accessible for not logged-in and logged-in users with any role except administrator and author.

    in reply to: Defining Posts View Access in php #7252
    Vladimir
    Keymaster

    Hi,

    I need first to allow “All user login” to view these Posts

    Why do you need this? Did you try to prohibit view for all user login for those posts at the post level and overwrite the condition via hook for select role(s) only? I mean restriction define at the hook will be final and overwrite one which define earlier at the post editor.

    in reply to: Defining Posts View Access in php #7249
    Vladimir
    Keymaster

    Hi,

    Yes, it’s possible. Just select suitable access model:

    $restriction[‘access_model’] = 1; // Prohibit view
    and
    $restriction[‘access_model’] = 2; // Allow view

    $restriction[‘data’][‘posts’] = array( 10, 20, 30 ); // posts/pages/custom post types ID list

    Post ID array works for any post type: as WordPress built-in posts and page, as any custom post type.

    in reply to: Hide "Other Roles" control #7245
    Vladimir
    Keymaster

    While code version above work for the user with ‘user-manager’ role only, this version works for all users including one with ‘administrator’ role:

    
    add_filter('ure_show_additional_capabilities_section', 'ure_show_additional_capabilities_section');
    
    function ure_show_additional_capabilities_section( $show ) {
    
    /*  Remove comment if do not wish to apply this for administrators also  
        $lib = URE_Lib::get_instance();
        if ($lib->is_super_admin()) {
            return $show;
        }
    */            
        return false;
    }
    
    Vladimir
    Keymaster

    “Popup Builder” plugin has own permissions settings. You have to add web_master role to the list of roles, for which “Popup Builder” is available at its “Settings” page.

    Vladimir
    Keymaster

    Hi,

    Is it possible to look at your site with admin permissions?
    If Yes, send URL and credentials to support[at-sign] role-editor.com

    in reply to: Post View Restrictions by Category #7234
    Vladimir
    Keymaster

    Yes, ‘block’ rule has a higher priority. If post has few categories assigned and at least 1 of them is prohibited for view to the current user role – user can not see this post.
    Look if you can to re-structure your categories to exclude the mentioned overlapping.

    in reply to: Including Tablepress in a Role #7233
    Vladimir
    Keymaster

    Hi,

    It’s possible. Code below redefines gTranslate menu with ‘manage_options’ capability:

    
    add_action('plugins_loaded', 'redefine_gtranslate_menu');
    
    function redefine_gtranslate_menu() {
        
        remove_action('admin_menu', array('GTranslate', 'admin_menu'), 10 );
        add_action('admin_menu', 'replace_gtranslate_menu' );
        
    }
    
    function replace_gtranslate_menu() {
        
        add_options_page(__('GTranslate Options', 'gtranslate'), 'GTranslate', 'manage_options', 'gtranslate_options', array('GTranslate', 'options') );
        
    }
    
    in reply to: restrict/hide Gutenberg blocks by role #7232
    Vladimir
    Keymaster

    Hi Wolfgang,

    You can try this version:

    
    add_filter( 'allowed_block_types', 'misha_allowed_block_types', 10, 2 );
     
    function misha_allowed_block_types( $allowed_blocks, $post ) {
        
        $user = wp_get_current_user();
        
        if ( in_array('administrator', $user->roles ) ) {
            // Do not change the list of default blocks for user with administrator role
            return $allowed_blocks;
        }
    
        if ( in_array('author', $user->roles ) ) {
            // Customize the list of allowed blockes for user with role author
            $allowed_blocks = array(
                'core/image',
                'core/paragraph',
                'core/heading',
                'core/list'
            );    
            return $allowed_blocks;
        }
    	  
    	return $allowed_blocks;
    } 
    
    Vladimir
    Keymaster

    Hi,

    Try beta version 4.58.3.b1. It’s available from the Download page after login and contains related fix:

    Fix: Content View Restrictions add-on: Posts with “Show 404 HTTP error” option were available via AJAX requests.

    The single .php file was changed: pro/includes/classes/content-view-restrictions-posts-list.php.

Viewing 15 posts - 406 through 420 (of 2,511 total)