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');
?>