Viewing 5 replies - 1 through 5 (of 5 total)
  • Think about your latest activity on the site, which can do that… Some settings, maybe?

    may be broken permissions, try the s2member reset role permissions function, but be aware this may break any custom role capabilities you might have set up

    Thread Starter fevz23

    (@fevz23)

    It doesn′t work. It still is not allowing me to get to those posts.

    What else could it be?

    Try disabling all your other plugins. If you can’t login, you should still be able to do this by using FTP and renaming their folders (e.g. just add 1 to their names). Now see if you can login.

    If you can, you have a plugin conflict. Turn on each of the other plugins one by one and re-test until the problem recurs. (You might want to do this using a second browser so as not to lock yourself out again.) When it does recur, you will have discovered the culprit.

    definitely test disabling other plugins and using default WP theme first, but otherwise…

    i had some permission issues on a somewhat complex site with custom post types and caps and custom posting permissions for CPT per role etc, and once i got it all working i wanted everything hard coded to help ensure it would not mysteriously break somehow, here is an abbreviated version of my code (without all of my custom caps), paste this into a text file and name it s2member-custom-caps.php (or similar) and drop in mu-plugins or regular plugins folder and it should set all s2 caps properly

    you could also add any other desired standard WP or custom caps etc per role in this file

    sam

    <?php
    /*
    Plugin Name:S2Member Custom Capabilities
    Plugin URI:
    Description: Hardcoded Custom WordPress Member Role Capbilities for S2Member
    Version: 1.0 ?
    Author: Sam Rohn
    Author URI: https://www.samrohn.com/
    */
    
    // ***
    //  ADMIN S2Member capablities
    // ***
    
    function s2_custom_admin_caps (){
    global $wp_roles;
    $role = get_role( 'administrator' );
    
    // s2member caps, in case they break somhow
    $role->add_cap( 'access_s2member_level4' );
    $role->add_cap( 'access_s2member_level3' );
    $role->add_cap( 'access_s2member_level2' );
    $role->add_cap( 'access_s2member_level1' );
    $role->add_cap( 'restrict_content' );
    
    // other caps could be added per-role like this -
    // $role->add_cap( 'edit_posts' );
    
    }
    add_action('init', 's2_custom_admin_caps');
    
    // ***
    // S2member level 4 capablities
    // ***
    
    function s2member_level4_caps (){
    global $wp_roles;
    $role = get_role( 's2member_level4' );
    
    $role->add_cap( 'access_s2member_level4' );
    $role->add_cap( 'access_s2member_level3' );
    $role->add_cap( 'access_s2member_level2' );
    $role->add_cap( 'access_s2member_level1' );
    
    }
    add_action('init', 's2member_level4_caps');
    
    // ***
    // S2member level 3 capablities
    // ***
    
    function s2member_level3_caps (){
    global $wp_roles;
    $role = get_role( 's2member_level3' );
    
    $role->add_cap( 'access_s2member_level3' );
    $role->add_cap( 'access_s2member_level2' );
    $role->add_cap( 'access_s2member_level1' );
    
    }
    add_action('init', 's2member_level3_caps');
    
    // ***
    // S2member level 2 capablities
    // ***
    
    function s2member_level2_caps (){
    global $wp_roles;
    $role = get_role( 's2member_level2' );
    
    $role->add_cap( 'access_s2member_level2' );
    $role->add_cap( 'access_s2member_level1' );
    
    }
    add_action('init', 's2member_level2_caps');
    
    // ***
    // S2member level 1 capablities
    // ***
    
    function s2member_level1_caps (){
    global $wp_roles;
    $role = get_role( 's2member_level1' );
    
    $role->add_cap( 'access_s2member_level1' );
    
    }
    add_action('init', 's2member_level1_caps');
    
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cannot access any of my protected posts’ is closed to new replies.