This topic has 29 replies, 2 voices, and was last updated 9 years by sharmstr.

  • Author
  • #58718
     contemplate
    Participant

    I have PmPro installed with 3 membership levels. I want all BuddyPress functionality restricted to only one of the levels. When I go to Theme Options -> Memberships and select all levels except the one that should have access it doesn’t work. I’ve tried doing the reverse as well and nothing. I have a test user who has one of the levels which does NOT grant access to Buddypress but he can see everything… groups, members, etc. See screenshot.

    I did read in another thread that the PMPRo Registration Helper is causing issues with this theme. I deactivated that plugin and resaved the Theme Options but it still doesn’t work.

    Attachments:
    You must be logged in to view attached files.
    #58751
     sharmstr
    Moderator

    Respond privately with a link and admin credentials

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58756
     contemplate
    Participant
    This reply has been set as private.
    #58758
     sharmstr
    Moderator

    I’ve done some testing and I cant recreate your issues on my test site. So, its either a plugin conflict or the custom PMPro functions in your functions.php file.

    A quick way to test if its something you added to your functions.php file is to enable the parent Kleo theme. Before doing that, export your theme options settings so you can reimport them in the kleo parent. Or if you dont want to do that, just do a quick test and restrict the groups directory.

    Obviously testing for plugin conflicts means disabling all the extra plugins you have. And since we are on the subject, I strongly suggest that you dont use bp like. Clicking like spawns several ajax calls. Click another like doubles it. Clicking another like triples it and so on. Bring up the page inspector and go to the network tab. Click a like. Then click unlike. You’ll see what I mean.

    Make sure you empty all your caches all well.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58759
     sharmstr
    Moderator

    I was just looking through your custom functions again and I dont really see anything that would cause this. Its all pretty generic stuff. So, if I were you, I’d go with the plugin route first.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58770
     sharmstr
    Moderator

    I just tested having the levels page as your home page and that’s not the issue either.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58771
     sharmstr
    Moderator

    The only plugin that I see that’s out of date is Visual Composer. You should upgrade that. It probably wont fix your issues, but there are problems with it for sure. https://archived.seventhqueen.com/forums/topic/steps-to-update-kleo-theme

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58774
     contemplate
    Participant

    Thanks for the tip about BP Like.

    So I commented out all my custom functions. Disabled all the plugins except for PMPro & BuddyPress. I cleared the Object Cache. But it’s still doing the same thing πŸ™

    #58780
     sharmstr
    Moderator

    Hmmm. I’v been testing different settings and I cant get it to NOT work. I was keeping an eye on what you were doing and it didnt appear that you disabled ALL plugins. Looked like you still had some BP plugins enabled.

    You can try adding custom functions to do it for you instead of relying on Kleo I suppose. I’ve tested this code on my site, so I know it works. What it does is redirects you to the home page (your levels page) if anyone besides level 3 tries to view a profile that’s not theirs. Put it your functions file and turn off profile blocking in theme options > memberships before testing it. Again, you might have to clear your cache as well.

    COPY CODE
    
    function custom_deny_access() {
    	if ( bp_is_member() && !bp_is_my_profile() && !pmpro_hasMembershipLevel(3) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    	}
    
    }
    add_action( 'template_redirect', 'custom_deny_access' );
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58781
     contemplate
    Participant

    Thanks for the code. So I turned off the restrictions in Theme Options -> Memberships. I inserted the code into functions.php and changed the level to “2” which should be the only level which has access. I also disabled the PMPro Registration Helper and cleared caches. It still didn’t work πŸ™

    It’s odd because regular page restrictions are working fine. It’s just the BuddyPress directories aren’t being restricted. Logins are the same. Thanks for any help in looking into this.

    #58786
     sharmstr
    Moderator

    Then it has to be a plugin issue or similar. You just took Kleo out of the picture by adding the custom code. You didnt say if you tested with ALL plugins disabled or not, meaning all the extra buddyrpess plugins. And for my sanity, please update VC. It has real issues with WP 4.2+

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58788
     contemplate
    Participant

    Ok I’ve updated VC. I then disabled everything except Buddypress & PMPro. I commented out all the functions except the one above. I cleared all caches. I re-saved Theme Options. I tried a different browser. Still no difference ?!? I’m totally at a loss here.

    If you want to check it out I’ll keep it all disabled for the next 10 minutes.

    #58791
     contemplate
    Participant

    Ok I re-enabled the coming soon page but the rest is disabled.

    #58792
     sharmstr
    Moderator

    Its working for me on your site. I’ve enabled a few plugins and its still working. You should go through and enable one by one until you find the one that breaks the site.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58794
     contemplate
    Participant

    Ok it seems to be partially working in not letting me open a member’s profile. But I can still get into the members directory, group directory, individual groups, etc..

    #58797
     sharmstr
    Moderator

    I know.

    What it does is redirects you to the home page (your levels page) if anyone besides level 3 tries to view a profile that’s not theirs.

    Baby steps. We are trying to ID the issue.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58798
     contemplate
    Participant

    ah yes! Sorry I didn’t ready careful enough. Do you want me to continue to enable plugins? Or are you still working on it? Thanks for your help!

    #58799
     sharmstr
    Moderator

    Start enabling them. We are trying to find the issue (conflict). LOL

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58800
     sharmstr
    Moderator

    Also, can I have ftp access to your site? Respond privately. I want to check out a few Kleo files.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58801
     contemplate
    Participant

    OK so most likely I was just testing the custom function wrong. All plugins are enabled & all functions re-enabled and the custom function works. So maybe it is a Kleo conflict.

    FTP to follow.

    #58802
     contemplate
    Participant
    This reply has been set as private.
    #58804
     sharmstr
    Moderator

    Okay. Give me some time. I have my real job to attend to for a bit. (I dont work here, in case you didnt know)

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58805
     sharmstr
    Moderator

    Well, let me clarify, I sorta work here. I didnt want to freak you out thinking you just gave the keys to the kingdom to some random person πŸ™‚

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58806
     contemplate
    Participant

    LOL Gotta pay the bills somehow. πŸ™‚

    #58809
     sharmstr
    Moderator

    If you see some whacky stuff, its me πŸ™‚

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58812
     sharmstr
    Moderator

    Wow that took forever. I cant determine whats wrong. But this should get you close. I didnt want to add it because you’ll have to make sure your admin(s) are in the correct level. Also, change the 1 to whatever level its supposed to be. The code is from my site so I used 1. I purposely put each component in its own if statement so you can easily see what they do and disable/change if necessary.

    COPY CODE
    
    function custom_deny_access() {
    	global $bp;
    	
    	if ( bp_is_user() && !bp_is_my_profile() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}
    	
    	if ( bp_is_activity_directory() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}	
    	
    	if ( bp_is_members_directory() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}
    	
    	if ( bp_is_group() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}	
    	
    	if ( bp_is_groups_directory() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}
    	
    	if ( bp_is_messages_compose_screen() && !pmpro_hasMembershipLevel(1) ) {
    		wp_redirect( get_bloginfo( 'url' ) );
    		exit;
    	}	
    
    }
    add_action( 'template_redirect', 'custom_deny_access' );
    
    
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58813
     contemplate
    Participant

    WOW excellent! Thanks for all you hard work!

    #58821
     sharmstr
    Moderator

    How’s it looking over there?

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #58822
     contemplate
    Participant

    The code seems to work well!

    #58826
     sharmstr
    Moderator

    Sweet. Good luck with the launch.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

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

The forum ‘KLEO’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?