Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Show WordPress email on BuddyPress user xprofiles page
<?php // do not copy this line, doing so will give you a fatal error when you run this script
If you are using this code, please be aware of privacy laws in your region and also beware of spambots harvesting your users'
emails from your website.
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">Email</td> // You can give any title you want here instead of 'Email'
<td class="data"><a href="mailto:<?php bp_displayed_user_email(); ?>"><?php bp_displayed_user_email(); ?></a></td>
add_action('bp_profile_field_buttons', 'tiquality_add_custom_field');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment