How to Show Extended Profile BuddyPress Names in Membership Admin Panel

Hi there,

I'm not sure if this is possible or not, but on our site eatrightpittsburgh.org we are using WPMU Membership to create a member's only content area. We are also using BuddyPress Extended Profiles to capture information (such as first/last name, ID #, etc.) whenever a new member registers. The client is asking if there is a way to display the name of the member in the ALL MEMBERS panel of the Membership plugin, because they find it difficult to do work with the memberships using just the username the member registered with (which can be anything, an email, a number, something random, etc.). Please advise how best to proceed.

Kind regards,

AD

  • Jack Kitterhing
    • Code Norris

    Hi there @Adrian,

    Hope you're well today and thanks for your question.

    This isn't currently possible out of the box, but I have added this as a feature request for you.

    I will include one of our developers @Hoang Ngo but I believe this will require a lot of custom coding.

    Thanks!

    Kind Regards
    Jack.

  • Adrian
    • The Crimson Coder

    Thanks Jack - yes I think that'd be a great feature for the new plugin update. If Hoang can suggest some custom coding that'd be great, otherwise Ill see if the client thinks its worth developing with an outsourced developer. Much obliged.

    Ill close the thread, but Hoang if you come up with anything please dont hesitate to paste in this thread.

    Tahnks!

    Kind regards,

    AD

  • Adrian
    • The Crimson Coder

    Yes, the All Members screen is where client would like to somehow display first/last names. Honestly, the BUddyPress name would be preferred since Extended Fields is already configured, but if there's a way to do it with WordPress native that'd be OK too i think. Probably would just have to manually enter them in somehow? Rather than them being collected by the registration process?

    Thansk very much for the prompt response!

    Best,

    AD

  • Hoang Ngo
    • Code Slayer

    Hi @Adrian,

    I hope you are well today,

    Please take a look at the screenshot, the column Name.

    When register, if user fill in their First name and Last name, it will show up there.

    We can update the plugin to make it show up follow BP fields, but in this case, we will need to modify the core code. And I will need to have a look at your fields config, to prepare the modify code for you :slight_smile:

    Could you enable support staff login in WPMU DEV dashboard > support > support access > grant access, please :slight_smile:

    Best Regards,
    Hoang

  • Hoang Ngo
    • Code Slayer

    Hi @Adrian,

    I hope you are well today.

    Line 2397 of the file wp-content/plugins/membership/membershipincludes/classes/membershipadmin.php

    You will see the code like this

    <td <?php echo $style; ?>>
    						<?php echo $user_object->first_name . " " . $user_object->last_name; ?></td>

    Please update it to:

    <td <?php echo $style; ?>>
    <?php
    						$full_name = '';
    						if(function_exists('bp_get_profile_field_data')){
    							$firstname = bp_get_profile_field_data(array(
    								'field'=>'First Name',
    								'user_id'=>$user_object->ID
    							));
    							$lastname = bp_get_profile_field_data(array(
    								'field'=>'Last Name',
    								'user_id'=>$user_object->ID
    							));
    							$full_name = trim($firstname.' '.$lastname);
    
    						};
    						if(empty($full_name))
    							$full_name=$user_object->first_name . " " . $user_object->last_name;
    						?>
    
    						<?php echo $full_name ?>
    </td>

    So this will check and use the buddypress fields first, and will fallback to native wordpress fields if the buddypress not install or empty :slight_smile:

    Best Regards,
    Hoang

  • Adrian
    • The Crimson Coder

    omg you're amazing! so this is working now?? thank you thank you thank you!! one tiny, super quick question, will it be safe to update theme/plugin/core with this new code there? Or should i refrain from updating those things?

    thanks again!! =D!

  • Hoang Ngo
    • Code Slayer

    Hi @Adrian,

    Yes, you can upgrade the theme, plugin, core etc.
    But when you upgrade membership to new version, you have to add the code to the plugin again :slight_frown:.

    Sorry for the inconvenience, currently the plugin doesn't have a suitable filter for that specific part.

    Best Regards,
    Hoang

  • Adrian
    • The Crimson Coder

    Sorry to keep bugging you - but I was able to manually add the First/Last name of the Member into the wordpress native user fields and it shows up on the All Members screen (yay!) but, for example, the user schoollunchmom did have her name in the Extended Profile, but it was not pulled to the All Members display area? Any thoughts are very much appreciated thank you

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.