Dynamically Display HTML depending on User
-
Hi,
I’m trying to find a function I can hook into to.
I have two types of users on my BuddyPress site, employees and employers. These are defined in the user area of S2 Members.
I have made a custom profile page in my child theme labeled buddypress.php.
Everything is working fine, but I want to hide the make a payment button if the user’s profile is an employer profile.
<?php if(is_user_logged_in() && 4 == S2MEMBER_CURRENT_USER_ACCESS_LEVEL){ ?> <div class="paybox"> <h3>Make Payment with PayPal®</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 as the employEES asre listed as number 2 as well. Ideally, I could just do it like this$type === $s2member_level1
as that’s how they are listed in the backend of WordPress, but that doesn’t work.
- The topic ‘Dynamically Display HTML depending on User’ is closed to new replies.