Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)

  • cameck
    Participant

    @cameck

    All right thank you everyone, I finally figured it out.

    I was not able to find an S2 Member function that worked for my specific task.

    Luckily I had a custom BuddyPress field that also designated the user Level.

    I got the field ID of “55” by hovering over the edit portion of the custom profile field.

    This is the final working code:

    <?php if(is_user_logged_in() && xprofile_get_field_data( 55 ) == 'Employee'){ ?>
    
    <div class="paybox">
    <h3>Make Payment with PayPal&reg;</h3>
    <?php $uemail = getDisplayedUserEmail(); ?>
    <?php echo do_shortcode('[gravityforms id="7" field_values="recip-email=' . $uemail . '"]'); ?>
    </div><!-- .paybox -->
    <?php } ?>

    cameck
    Participant

    @cameck

    Ok I think I’m realizing the problem here, all of theses codes are outputting the user access level of the person who is logged in, not the profile. I need to check the user access level of the user who’s profile is being viewed. Do I make sense? I feel I might be being a little confusing


    cameck
    Participant

    @cameck

    You’re right! I didn’t realize it at first…. I appreciate all the help you’ve given so far. I can continue this on the S2 Member Forum if you like, you’re just doing such an awesome job though :D.

    Regarding the $s2member_level1 , I was just pulling that out of my butt and it was only thing I put there that didn’t break the pages.

    But if you’re curious, this is what I have now:

    <?php if(is_user_logged_in() && 4 == S2MEMBER_CURRENT_USER_ACCESS_LEVEL){ ?>
    
    <div class="paybox">
    <h3>Make Payment with PayPal&reg;</h3>
    <?php $uemail = getDisplayedUserEmail(); ?>
    <?php echo do_shortcode('[gravityforms id="7" field_values="recip-email=' . $uemail . '"]'); ?>
    </div><!-- .paybox -->
    
    <?php } ?>

    This is working for the most part, but oddly enough there are a few more employers that are still showing the paypal button. So, I started using this:
    <?php echo S2MEMBER_CURRENT_USER_ACCESS_LEVEL; ?>
    to see the output and most employers are the number 2, but a few are listed as 4 – which creates the problem. Ideally, I could just do it like in the previous code I had put up $type === $s2member_level1 as that’s how they are listed in the backend of WordPress.


    cameck
    Participant

    @cameck

    OK, that helps, I feel I’m getting closer.

    Here’s what I have:

    <?php if(is_user_logged_in() && $type === $s2member_level1){ ?>
    
    <div class="paybox">
    <h3>Make Payment with PayPal&reg;</h3>
    <?php $uemail = getDisplayedUserEmail(); ?>
    <?php echo do_shortcode('[gravityforms id="7" field_values="recip-email=' . $uemail . '"]'); ?>
    </div><!-- .paybox -->
    <?php } ?>

    Now, it is still displaying on both users pages (employee and employer)…

Viewing 4 replies - 1 through 4 (of 4 total)
Skip to toolbar