Forum breadcrumbs – You are here:Asgaros Support ForumSupportShow Email in Profile
Please or Register to create posts and topics.

Show Email in Profile

Hey guys,

can someone tell how i can show at the profile view the users email address with a mailto: ahref?

Maybe a Snipped?

Thanks a lot.

Regards

Uploaded files:
  • Unbenannt.JPG
cauesocial has reacted to this post.
cauesocial

@mochkal

Try one of these.  Second option is simpler but doesn’t make the email a hyperlink.

# Add user email to profile

# OPTION 1
add_action( 'asgarosforum_profile_row', 'af_add_email_to_profile_view' );
function af_add_email_to_profile_view( $userData ) {
    $user_email = $userData->user_email;
    echo '<div class="profile-row">';
    echo '<div>Email</div>';
    	echo '<div>';
      echo '<a href = "mailto:' . wp_kses_post($user_email) . '">' . wp_kses_post($user_email) . '</a><br>';
    echo '</div>';
  echo '</div>';
}

# OPTION 2, this is simpler but doesn't make the email a link

add_filter( 'asgarosforum_filter_profile_row', 'af_add_email_to_profile_view', 10, 2 );
function af_add_email_to_profile_view( $profileRows, $userData ) {
    $user_email = $userData->user_email;
    $profileRows['email'] = array(
                            'title' => 'Email:',
                            'value' => trim(wpautop(esc_html($user_email))),
                        );
  return $profileRows;
}
cauesocial has reacted to this post.
cauesocial

@jim you are awesome.

Thanks a lot.

cauesocial has reacted to this post.
cauesocial