Display image conditional statement
-
Hello & thank you again for this wonderful plugin & support. Probably the best dev I have seen on here yet!
I placed some code in my bp-custom file, but I am not sure if it written properly.. I modified some of your code posted elsewhere to get the results I needed. It works, although the next morning I logged into my cpanel and my CPU limits where going crazy…Just want to check and make sure this looks correct, because nothing else was changed prior to the many index.php processes running except this..
I want to display the image they have uploaded to the ‘Signature’ profile field, and if they have not uploaded one I want it to display the default one I have set.
add_filter( 'bxcft_show_field_value', 'my_show_field', 15, 4); function my_show_field($value_to_return, $type, $id, $value) { if ($type == 'image') { if ($value != '') { echo ''; } else { return '<p><img src="https://ngx2gaming.com/wp-content/uploads/profiles/default_signature.png" /></p>'; } } return $value_to_return; }
I am also running this code on the front end in a widget, that should do the same thing, does this look ok?
<?php //global $current_user; get_currentuserinfo(); echo xprofile_get_field_data( "Signature" , $current_user->ID );?>
Thank you!
https://www.ads-software.com/plugins/buddypress-xprofile-custom-fields-type/
- The topic ‘Display image conditional statement’ is closed to new replies.