This topic has 17 replies, 8 voices, and was last updated 7 years by Abe.

  • Author

    Tagged: 

  • #5419
     SQadmin
    Keymaster

    This topic show how to change the default check-marks in the Paid Memberships Pro (PMPRO) Levels page with your own and an example on how to add restriction to the user messages page

    #5420
     SQadmin
    Keymaster

    The following codes goes to sweetdate-child/functions.php

    This manipulates the text that shows in the memberhips page:

    COPY CODE
    
    
    /* These restrictions will appear to be configured in Sweetdate - Memberships */
    add_filter('kleo_pmpro_level_restrictions', 'kleo_my_levels_checkmarks');
    function kleo_my_levels_checkmarks($settings) {
     
        $settings = array (
    		//NEW RESTRICTION MESSAGES page with name: message
            array(
                'title' => __('Restrict Messages page','kleo_framework'),
                'front' => __('Access messages page','kleo_framework'),
                'name' => 'message'
            ),
    		//NEW RESTRICTION SHOP page with name: shop
            array(
                'title' => __('Restrict Shop page','kleo_framework'),
                'front' => __('Access Shop page','kleo_framework'),
                'name' => 'shop'
            ),
            array(
                'title' => __('Restrict members directory','kleo_framework'),
                'front' => __('View members directory','kleo_framework'),
                'name' => 'members_dir'
            ),
            array(
                'title' => __('Restrict viewing other profiles','kleo_framework'),
                'front' => __('View members profile','kleo_framework'),
                'name' => 'view_profiles'
            ),
            array(
                'title' => __('Restrict access to groups directory','kleo_framework'),
                'front' => __('Access group directory','kleo_framework'),
                'name' => 'groups_dir'
            ),
            array(
                'title' => __('Restrict access to single group page','kleo_framework'),
                'front' => __('Access to groups','kleo_framework'),
                'name' => 'view_groups'
            ),
            array(
                'title' => __('Restrict users from viewing site activity','kleo_framework'),
                'front' => __('View site activity','kleo_framework'),
                'name' => 'show_activity'
            ),
            array(
                'title' => __('Restrict users from sending private messages','kleo_framework'),
                'front' => __('Send Private messages','kleo_framework'),
                'name' => 'pm'
            ),
            array(
                'title' => __('Restrict users from adding media to their profile using rtMedia or bpAlbum','kleo_framework'),
                'front' => __('Add media to your profile','kleo_framework'),
                'name' => 'add_media'
            )
        );
        return $settings;
    }
    

    This makes the messages page restriction to happen:

    COPY CODE
    
    // restrict profile area - Messages page
    add_action('kleo_pmro_extra_restriction_before_my_profile','kleo_my_custom_restrict1');
    
    function kleo_my_custom_restrict1()
    {
    	//full current url
    	$actual_link = kleo_full_url();
    	//our request uri
    	$uri = str_replace(untrailingslashit(home_url()),"",$actual_link);
    
    	//restrict messaging page url
    	if(preg_match("/^\/".bp_get_members_root_slug()."\/". bp_get_loggedin_user_username()."\/messages\/?/", $uri))
    	{
    		
    		$my_restrictions =  array('message' => array(
    				//2 - restrict certain levels. 0 -restrict none; 1 - restrict all
    				'type' => 2,
    				//levels that you apply the restrictions to
    				'levels' => array(2,3),
    				//'not_member' => 1, //restrict users without a membership level
    				//'guest' => 1 // restrict not logged in users
    			)
    		);
    		//We use the name "message" from the new restriction added above
    		kleo_check_access('message',$my_restrictions);
    	}
    }
    
    //Restrict Shop page
    add_filter('kleo_pmpro_match_rules', 'kleo_my_custom_restrict2');
    
    function kleo_my_custom_restrict2($restrictions) {
    	//regular expression for shop page
    	$restrictions["/^\/shop\/?$/"] = array('name' => 'shop');
    	return $restrictions;
    }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #40504
     wannabe
    Participant

    How do we add restrictions on other plugins? I installed the ‘poke’ plugin ( https://wordpress.org/plugins/bp-poke/ ) and i want to restrict the use of this plugin to paid members only.

    thanks in advance,
    J

    #40626
     Abe
    Keymaster

    @wannabe you need to come with a custom code since it depends on the plugin to restrict or allow something it generates.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #76172
     liam62244
    Participant

    I dont know how to use code. Is there any other way or can you help me? I need to add extra features on the membership levels that is show on the levels page

    #78334
     Abe
    Keymaster

    Hi,

    @liam62244
    you need a bit of coding skills or editing skills. You need to take the codes as their are and paste them one after the another in the file specified. You should talk with someone that can help you customize the theme as you need.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #92786
     Fatbeatz
    Participant

    Hi , I’m from Germany and use the translater . Hope you can understand me 🙂

    In any case this does not work with the Site activities not right . So so that a free users , the site activity can not see . I ask for help , many thanks !

    #93528
     Abe
    Keymaster

    Hi @fatbeatz
    to restrict the activity only you need to make some custom restrictions that are not covered by our theme options.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #111335
     ignacio123
    Participant

    Hi,
    I´m looking for this code, but i think that it is different now, because i found the first part of the article, where you put the different arrays, but i can not found where put the code to the page restriction.

    Thanks!

    #112231
     Abe
    Keymaster

    both codes should go to child theme/ functions.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #113417
     lalmira
    Participant
    This reply has been set as private.
    #114110
     Abe
    Keymaster

    Hi there, I think you played with the restrictions settings from Paid Membership pro or another plugin. On the level edit page make sure you haven’t checked categories to restrict

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #173739
     solokco
    Participant

    Is there a way to SHOW different restrictions according to the levels?

    I just need the way to make different takes to show in the list, for example:
    LEVEL 1 -> list -> 5% discount
    LEVEL 2 -> list -> 15% discount

    And so on.

    #173765
     Abe
    Keymaster

    Hi, I don’t fully understand the question? Can you try to repharase?

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #173846
     solokco
    Participant

    Hi Abe, sure, let me repharase…

    So there is a section in the THEME OPTIONS where you can tell witch sections the members are allowed to access, and these show at the LEVELs page (https://seventhqueen.com/themes/kleo/membership-account/membership-levels/)

    I see in the link above, that all levels have the text “SEND PRIVATE MESSAGES” but this text in the BRONZE level shows as if it where OFF or not available.

    The question is that… How do I turn OFF some features for some levels and leave them on for the rest.

    Hope this explains better my question.

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #174053
     Abe
    Keymaster

    Hi, Those are affected by the settings from Theme options – Memberships

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #174532
     solokco
    Participant

    Hi Abe,

    Yes I know that, the question is HOW can I add MORE options (custom options) to show on these lists.

    Thanks

    #175089
     Abe
    Keymaster

    This current topic gives you the exact info you need: https://archived.seventhqueen.com/forums/topic/extra-membership-restrictions-how-to/#post-5420

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

Viewing 18 posts - 1 through 18 (of 18 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?