Q&A is not assigning WP Q&A capabilities

Q&A is only saving assigned capabilities for traditional WordPress roles.

capabilities for any other roles defined for the site such as s2member membership levels are not being saved.

How can this be corrected?


  • 11 Plus for Parents

    I am not sure.

    I would have to do some research on that.

    In the mean time, is it possible for me to manually change the settings? Say in a file or with some other utility?

    This configuration is basically a set and forget situation. I won't be needing to change them again anytime soon. So if there is a place or a method that I can change them manually I would appreciate knowing.


  • 11 Plus for Parents

    How do I go forward?


    Here is what I found:

    Membership Levels (required, please customize these)

    The default Membership Levels are labeled generically; feel free to modify them as needed. s2Member supports Free Subscribers (at Level #0), along with several Primary Roles for paid Membership (i.e. Levels 1-4), created by the s2Member plugin.

    s2Member also supports unlimited Custom Capability Packages (see s2Member -› API Scripting -› Custom Capabilities). That being said, you don't have to use all of the Membership Levels if you don't want to. To use only 1 or 2 of these Levels, just design your Membership Options Page, so it only includes Payment Buttons for the Levels being used.

    TIP: Unlimited Membership Levels are only possible with s2Member Pro. However, Custom Capabilities are possible in all versions of s2Member, including the free version.

    Custom Capabilities are a great way to extend s2Member in creative ways. If you're an advanced site owner, a theme designer, or a web developer integrating s2Member for a client, please check your Dashboard, under: s2Member -› API Scripting -› Custom Capabilities. We also recommend this video tutorial.

    See also: These KB articles: s2Member® Roles/Capabilities and Simple Shortcode Conditionals.

  • 11 Plus for Parents

    Yes this is the case.

    One workaround could involve setting the values in the code below for each user_id from s2member that I want to allow privileges.

    I am going to output some s2member user ids to see what values they have. They must be constant in order to track user level.

    If you can give me an example of how to set one value I could probably figure out the rest and solve the problem myself based on my specific requirements.

    Please also tell me what value/values should QA_TEXTDOMAIN have.


    function QA_Core_Admin() {
    		// Settings page ID
    		$this->page = 'question_page_qa_settings';
    		$this->capability_map = array(
    			'read_questions'             	=> __( 'View questions', QA_TEXTDOMAIN ),
    			'publish_questions'          	=> __( 'Ask questions', QA_TEXTDOMAIN ),
    			'immediately_publish_questions'	=> __( 'Immediately publish questions and answers (Otherwise they will be saved as pending)', QA_TEXTDOMAIN ),
    			'edit_published_questions'   	=> __( 'Edit own questions', QA_TEXTDOMAIN ),
    			'delete_published_questions' 	=> __( 'Delete own questions', QA_TEXTDOMAIN ),
    			'edit_others_questions'      	=> __( 'Edit others\' questions', QA_TEXTDOMAIN ),
    			'delete_others_questions'    	=> __( 'Delete others\' questions', QA_TEXTDOMAIN ),
    			'subscribe_to_new_questions' 	=> __( 'Subscribe to new questions', QA_TEXTDOMAIN ),
    			'read_answers'               	=> __( 'View answers', QA_TEXTDOMAIN ),
    			'publish_answers'            	=> __( 'Add answers', QA_TEXTDOMAIN ),
    			'edit_published_answers'     	=> __( 'Edit own answers', QA_TEXTDOMAIN ),
    			'delete_published_answers'   	=> __( 'Delete own answers', QA_TEXTDOMAIN ),
    			'edit_others_answers'        	=> __( 'Edit others\' answers', QA_TEXTDOMAIN ),
    			'delete_others_answers'      	=> __( 'Delete others\' answers', QA_TEXTDOMAIN ),
    			'flag_questions'				=> __( 'Report questions and answers', QA_TEXTDOMAIN ),
    	 * Intiate hooks.
    	 * @return void
  • aristath

    Please also tell me what value/values should QA_TEXTDOMAIN have.

    To find the value of QA_TEXTDOMAIN all you have to do is add <?php echo QA_TEXTDOMAIN; ?> in your footer.php for example and you shall see it there. :wink:

    To manually add capabilities to user roles, you can use the add_cap WordPress function.

    You can see how it's done on the plugin itself by opening up the core/admin.php file (though admitedly that implementation is a bit complex).

    You can however hard-code the add_cap functions that you want in your theme's functions.php file.

    I hope that helps...


  • 11 Plus for Parents

    You're right again :slight_smile:

    I've upgraded you so that you can see for yourself.

    Thanks again

    P.S. Here is the code

    // SPAC s2member roles and caps
    		$s2droles = array( 's2member_level1', 's2member_level2', 's2member_level3', 's2member_level4' );
    		$s2dcaps = array( 'read_questions', 'read_answers', 'publish_questions', 'immediately_publish_questions', 'publish_answers' );
    // SPAC define s2member capabilities
    	foreach ( $s2droles as $s2drole ) {
    		foreach ( $s2dcaps as $s2dcap ) {
    			$wp_roles->add_cap( $s2drole, $s2dcap );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.