bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile

I’ve been trying to set a conditional for specific users (e.g. http://www.mywebsite.org/forum/users/john/) to display a custom “Contributor” graphic within their user profiles. The graphic would be displayed directly underneath the specified profile pics using the template file (bbpress/templates/default/bbpress/user-details.php).

I was also thinking that it might be easier to set the conditional based on their WordPress user role (e.g. Contributor), so that I wouldn’t have to write each user in the condition manually.

Read More

Here’s what I’ve tried so far:

<?php if(current_user_can('contributor')) { ?>
<img src="/wp-content/uploads/contributor.jpg" />
<?php } ?>

I’ve also tried:

<?php if(bb_user_id('15')) { ?>
<img src="/wp-content/uploads/contributor.jpg" />
<?php } ?>

I’m very new to PHP, and I’ve been trying very hard to find the answer. If you can help me, I would appreciate it very much! Thanks.

Related posts

Leave a Reply