This topic has 12 replies, 3 voices, and was last updated 7 years by Radu.

  • Author
  • #173422
     btolle89
    Participant

    hello,

    I would like to restrict access to the one’s profile page for all non-members. in other words, i do not want to allow someone to access and update their profile until after they are a member.

    #173559
     Laura
    Moderator

    Hello, this may be possible using a custom plugin, but i would need to edit it at your website, can you hare ftp and wp-admin?

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #173600
     btolle89
    Participant
    This reply has been set as private.
    #173725
     Laura
    Moderator

    Hello, added this plugin with a few modifications

    COPY CODE
    
    <?php
    /*
    Plugin Name: PMPro BuddyPress Customizations
    Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-buddypress-customizations/
    Description: Example code to lock down parts of BuddyPress with PMPro
    Version: 0.2
    Author: Stranger Studios
    Author URI: http://www.strangerstudios.com
    */
    /*	
    	Copyright 2010	Stranger Studios	(email : jason@strangerstudios.com)	 
    */
    //hide some pages in buddypress
    function pmpros_hide_buddy_press_pages()
    {
    	$uri = $_SERVER['REQUEST_URI'];	
    	$not_allowed = array(
    		//"/members/",
    		"/members/*/profile/"
    	);
    	foreach($not_allowed as $check)
    	{
    		//prep for regex
    		$check = str_replace("/", "[\/]+", $check);					//replace /
    		$check = str_replace("*\/", "[^\/]*\/", $check);			//replace * in middle of URIs
    		$check = str_replace("+*", "+.*", $check);					//replace * at end of URIs
    		$check = "/^" . $check . "\/?$/";							//add start/end /
    				
    		if(preg_match($check, $uri))
    		{			
    			wp_redirect( 'http://etraveldate.com/membership-checkout/' );
    			exit;
    		}
    	}
    }
    add_action("init", "pmpros_hide_buddy_press_pages");
    //add_action("init", "pmpros_add_members");
    add_action("pmpro_after_change_membership_level", "pmpros_pmpro_after_change_membership_level", 10, 2);
    ?>
    

    Now your users will be redirected to Membership Levels when they try to access the profile

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #173772
     btolle89
    Participant

    hi! thank you so much! but it doesn’t seem to work. I just registered as a new user and was able to go directly to my profile.

    #173863
     Laura
    Moderator

    Hello, i see, hmmm maybe we can do it another way, using some php at the header with css, and show a message that the profile is for vip users, would that be fine ?

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #173891
     btolle89
    Participant

    sure thing. the idea is just to point them to the membership page, so if the message can do that, even if with a link that would be great! thank you so much for your help!

    #173973
     Laura
    Moderator

    Hello, i see an error when trying to view your site, let me know 🙂

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #174028
     btolle89
    Participant

    hello, try again. sorry for the error.

    #174090
     Laura
    Moderator

    Hello, trying to access by ftp but seems like the password is not valid

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #176860
     btolle89
    Participant
    This reply has been set as private.
    #176984
     Laura
    Moderator

    Hello, will assign the ticket to a higher support level who can help and advise you in your query.
    Thanks! ?

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

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

    #177052
     Radu
    Moderator

    Hi,

    Using the next code will makes your users to register normally and then after activation to be locked in the membership levels page until they buy something

    COPY CODE
    
    add_action( 'template_redirect', 'my_membersip_restrict' );
     
    function my_membersip_restrict() {
        global $pmpro_pages, $post;
     
        if ( is_user_logged_in() && !pmpro_hasMembershipLevel() ) {
            if (isset($post->ID) && !in_array($post->ID, $pmpro_pages)) {
                wp_redirect( pmpro_url() );
            }
        }
    }
    
    

    The snippet will be pasted in wp-content/themes/kleo-child/functions.php

    NOTE : The Kleo Child Theme needs to be installed and activated.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 13 posts - 1 through 13 (of 13 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?