Display badges/images based on xprofile field value
-
Hello!
I would like to display a badge on the member’s cover photo based on a xprofile field he’s chosen.
The profile field is a dropdown.
I’ve searched in many places, including this forum, but I can’t figure it out..
I’m not a coder, but I’ve put together something based on several topics I’ve found, so please forgive me for any non sense you might see!function show_badge() { if ( bp_get_the_profile_field_name() == 'Talent' ) { global $field; if ( bp_unserialize_profile_field( $field->data->value ) == "Photography" ) { echo '<div class="badge1"><img src="http://www.mysite.com/wp-content/uploads/photobadge.png"></div>'; } } } add_action('bp_init', 'show_user_badge'); function show_user_badge () { if (bp_is_user()){ add_action('bp_after_member_header', 'show_badge'); } }
Could someone advise me what is wrong with this code and how I could make it work?
I would really appreciate any help with that!Thank you!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.