Forum Replies Created
-
Author
-
stevejenkinsParticipant
It was SLIGHTLY more complex than that, Sharmstr. 🙂
First, keep in mind that my site is subscription only and for a private non-profit association with a couple thousand members, so we don’t have problems exposing personal info to each other. Your standard user isn’t going to want their email address exposed to the world.
First, I’ve added these functions to my functions.php:
COPY CODE// Put Profile User's Email Address in Profile Header function DisplayedUserEmail() { global $bp; echo '<br /><div class="bp_header_email"><a href="mailto:'. $bp->displayed_user->userdata->user_email .'" target="_blank">'. $bp->displayed_user->userdata->user_email .'</a></div>'; } //add_action( 'bp_before_member_header_meta', 'DisplayedUserEmail' ); // Put Profile User's Display Name at top of profile function DisplayedUserFullName() { global $bp; echo '<h2 class="user-nicenmame bp_header_displayname">'. $bp->displayed_user->fullname. '</h2>'; } add_action( 'bp_before_member_header', 'DisplayedUserFullName' );
Then you can apply your own custom CSS to the bp_header_email and bp_header_displayname classes.
Next, copy
/wp-content/themes/kleo/buddypress/members/single/member-header.php
to
/wp-content/themes/kleo-child/buddypress/members/single/member-header.php
This will allow the child theme version of the file to override.
Then edit the member-header.php file so it contains what you want. For those who like diff, here are the differences between the original and my edits:
COPY CODE# diff /www/vhosts/example.com/htdocs/wp-content/themes/kleo-child/buddypress/members/single/member-header.php /www/vhosts/example.com/htdocs/wp-content/themes/kleo/buddypress/members/single/member-header.php 24,25d23 < <div> < <h4 class="user-nicename"><?php echo xprofile_get_field_data('31'); ?><br> 27,36c25,29 < <?php < global $bp; < echo '<a href="mailto:'. $bp->displayed_user->userdata->user_email .'" target="_blank">'.$bp->displayed_user->userdata->user_email .'</a>'; ?> < </h4> < </div> < < <span class="activity"> < <?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?> < @<?php bp_displayed_user_mentionname(); ?>: <?php bp_last_activity( bp_displayed_user_id() ); ?></span> < <?php endif; ?> --- > <?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?> > <h4 class="user-nicename">@<?php bp_displayed_user_mentionname(); ?></h4> > <?php endif; ?> > > <span class="activity"><?php bp_last_activity( bp_displayed_user_id() ); ?></span>
My entire member-header.php (in its edited state) looks like this:
COPY CODE<?php /** * BuddyPress - Users Header * * @package BuddyPress * @subpackage bp-legacy */ ?> <?php do_action( 'bp_before_member_header' ); ?> <div id="item-header-avatar" class="rounded"> <a href="<?php bp_displayed_user_link(); ?>"> <?php bp_displayed_user_avatar( 'type=full' ); ?> </a> <?php do_action('bp_member_online_status', bp_displayed_user_id()); ?> </div><!-- #item-header-avatar --> <div id="item-header-content" <?php if (isset($_COOKIE['bp-profile-header']) && $_COOKIE['bp-profile-header'] == 'small') {echo 'style="display:none;"';} ?>> <div> <h4 class="user-nicename"><?php echo xprofile_get_field_data('31'); ?><br> <?php global $bp; echo '<a href="mailto:'. $bp->displayed_user->userdata->user_email .'" target="_blank">'.$bp->displayed_user->userdata->user_email .'</a>'; ?> </h4> </div> <span class="activity"> <?php if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() ) : ?> @<?php bp_displayed_user_mentionname(); ?>: <?php bp_last_activity( bp_displayed_user_id() ); ?></span> <?php endif; ?> <?php do_action( 'bp_before_member_header_meta' ); ?> <div id="item-meta"> <?php if ( bp_is_active( 'activity' ) ) : ?> <div id="latest-update"> <?php bp_activity_latest_update( bp_displayed_user_id() ); ?> </div> <?php endif; ?> <div id="item-buttons"> <?php do_action( 'bp_member_header_actions' ); ?> </div><!-- #item-buttons --> <?php /*** * If you'd like to show specific profile fields here use: * bp_member_profile_data( 'field=About Me' ); -- Pass the name of the field */ do_action( 'bp_profile_header_meta' ); ?> </div><!-- #item-meta --> </div><!-- #item-header-content --> <?php do_action( 'bp_after_member_header' ); ?> <?php do_action( 'template_notices' ); ?>
-
AuthorPosts