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

  • Author
  • #165610
     internetservice
    Participant

    hi support, so I am wondering if I am able to create below restrictions in my dating site for those who haven’t upgrade their level using pmpro?

    •when a user Try to write a message
    •when a user Try to answer a message
    •when a user Try to see who have poke them
    •when a user Try to see the whole event post.
    •when a user Try to take part in “forum” when they click on a post, it should also not be allowed to create a post.

    so every time a user does any of the above things then the price list membership page would show up instead? essentially buddypress components would not work without paying for the membership level in pmpro? so those free users might need to upgrade their levels to be able to interact with each other using buddypress components.

    any idea how to do it?

    #165730
     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 🙂

    #165743
     internetservice
    Participant

    yes very good. please do that.

    thank you

    #166272
     Radu
    Moderator

    Hi,

    All theme available restrictions options are located under wp-admin -> theme options -> memberships.

    If you need any other restriction on certain action other than it’s listed in the theme options you should hire a develop those for you since they require dedicated time.

    Here it’s a snippet that maybe will help you in future

    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() );
            }
        }
    }
    
    

    This code will check if logged in user have any membership and if not will be redirected to the pmpro levels page to buy access.

    Cheers
    R.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Ticket solution
    #166282
     internetservice
    Participant

    yes, thank you for your help. actually, I had solved it though by joining in the pmpro forum. and by using this code below.

    COPY CODE
    if ( pmpro_hasMembershipLevel() ) { //if the user has a membership level or an admin, show the 'add friend button'.
            return $button;
        }

    but the code above will hide the button for free users and administrator. so paying members will be able to see the button but it seems that administrator will be imposed the same restrictions as a free user in which the button won’t show up.

    so my question is what is the code function that will allow administrator to have the same rights as those paying membership?

    any idea?

    #166354
     internetservice
    Participant

    btw I had solved this problem by using this code.

    COPY CODE
    if( !current_user_can( 'manage_options) ){
        if( !pmpro_hasMembershipLevel() ){
            return;
        }
    }

    so you can close this ticket.
    thanks

    #166504
     Radu
    Moderator

    Ok then

    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 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?