James posted an update 1 year, 2 months ago
I thought I would just share these buddypress codes for you guys to help you all out if your using buddypress ( to be honest im really posting these codes here so I don’t forget them myself!)
Basically if you want a to display a users cover image then this code echoes out the users url of the cover image if the user has one outside of the buddypress loop
<?php $image_url = bp_attachments_get_attachment(‘url’, array( ‘item_id’ => bp_displayed_user_id() ) ); ?>
so then all you have to do is echo $image_url out into a divs background style like so…bp_displayed_user_id() ) ); echo $image_url; ?> )”>
Some more really useful code is this
<a href=”<?php echo bp_loggedin_user_domain(); ?>/profile”><?php _e(“profile”)?></a>
Basically this code creates a link that you can drop anywhere in your theme that will direct you to certain pages specific to the logged in user..
You can change the ending of the link from /profile to friends, notifications and so on!
This link code goes really well with using the buddypress count functions for example adding in a friend or notification counter next to the link to the friend or notifications… to do this use this code:
I hope this helps… as there doesn’t really seem to be any information about doing this anywhere (well for ultra noobs that is like me).. not even on the buddypress forums!
@the-james active 4 months, 1 week ago
Want to show a welcome message to logged out users only? There are a few ways you can do this but the easier ways are: Embedding this code into your theme in the place you want the message to display and using this code *Note: The code will be overwritten the next time you update your theme so it is advised to create a child theme and […] View