Displaying email address in profile
-
I added the following code (from this post) to enable email addresses in user profiles – which works but only when a user is logged in.
How can I change it to show the email address regardless of whether one is logged in or not?
function tiquality_add_custom_field() { if ( bp_is_active( 'xprofile' ) ) : if ( is_user_logged_in() ) { ?> <div class="bp-widget <?php bp_the_profile_group_slug(); ?>"> <table class="profile-fields"> <tr class="my_mail"> <td class="label">Contact me</td> <td class="data"><a href="mailto:<?php bp_displayed_user_email(); ?>"><?php bp_displayed_user_email(); ?></a></td> </tr> </table> </div> <?php } endif; } add_action('bp_profile_field_buttons', 'tiquality_add_custom_field');
I tried deleting the line…
if ( is_user_logged_in() ) {
but it took down the whole site.
WP v 4.7.1
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.