Search Results for 'profile fields'
-
Search Results
-
Hi,
This is my first time with BP and my very first post in the BP forums. I have a query related to the members-loop.
We have grouped our bp members role-wise. They choose a role from a set of four predefined roles while signing up (it’s a custom profile field).
I have provided 4 tabs for 4 roles on my members page and clicking on a particular tab should only show the members belonging to THAT role. How can this elegantly be achieved with BP 1.1? Is there any template tag available?
I basically want to collect the members-array that is returned by bp_site_members() and further filter it by ‘role’.
I suppose I can hack the core, or maybe add my own function in bp-custom.php file to retrieve the members by whatever clause I want or maybe there is already a way in BP of doing this that I’m just not aware of.
Not sure, if this is much simpler in logic than in my head right now.
Any help much appreciated
Thanks,
Sib
Here’s a piece of code I wrote to sync the
-name (core field)
-last name (custom field)
-first name (custom field)
from BP with WPMU :
-BP name becomes WPMU display name
-BP first name becomes WPMU first name
-BP last name becomes WPMU last name
You have to create those 2 fields in the xprofile admin; then set their ids in the functions
$first_name_field_id=…;
$name_field_id=…;
They have to be set in the BASE group of xprofile (group id #1).
function sync_wp_bp_names() {
global $bp;
if (bp_get_current_profile_group_id()!=1) return false;
require_once( ABSPATH . WPINC . ‘/registration.php’);
$user = new WP_User($bp->displayed_user->id);
$first_name_field_id=40;
$name_field_id=39;
//DISPLAY NAME == BP NAME
if ( isset( $_POST[‘field_1’] ))
$user->display_name = esc_html( trim( $_POST[‘field_1’] ));
//FIRST NAME
if ( isset( $_POST[‘field_’.$first_name_field_id] ))
$user->first_name = esc_html( trim( $_POST[‘field_’.$first_name_field_id] ));
//LAST NAME
if ( isset( $_POST[‘field_’.$name_field_id] ))
$user->last_name = esc_html( trim( $_POST[‘field_’.$name_field_id] ));
wp_update_user( get_object_vars( $user ) );
}
add_action( ‘xprofile_updated_profile’, ‘sync_wp_bp_names’ );
What do you think of that ?
I also don’t understand the differences between display name and nicename in WPMU…
Topic: Profile Field Linking
In the default profile-loop, field data is linked so that you can click on “Chicago” and every member that lists “Chicago” as her location will be listed. However, linking is gone when I use the following to extract data from specific fields:
echo xprofile_field_data('field#');
How do I retain the normal field data linking?
I want to display the data of individual profile fields, rather than printing them all at one time. For instance, I have a “location” field in the base profile area.
Hello.
In the wp-admin under “buddyPress” and “Profile Field Setup” i have created two custom fields “Location” and “Favorite Grape”,
When i user resgisters these fields are shown on the registration page but the data isn’t saved.
But when the user edits the profile the two boxes appear (but blank) and if the data is entered then it is saved.
I have noticed that the table “wp_bp_xprofile_data” isn’t storing these details until they edit their profile.
Does anyone know what i need to do to make it work.
Thank you
When a user registers and adds the custom profile date information, they cannot be seen on the profile. However if you go into edit profile mode later, and enter the information, it then becomes viewable.
wp_bp_xprofile_data table does not get filled with the custom profile data. However once user edits the profile, that data is then entered.
Is this a bug? I am using 1.1.1 of BP and wordpress 2.8.4a
I checked the database and all I saw was some arrays in the wp_signups meta info.
Any clean method of getting that info out ?
Topic: Removing Profile Field Links
Hi Everyone,
I think this question was asked a while back but I cannot find it in the forums.
I am wondering how to remove the auto linking in the profile info fields on the member page. I want to remove the link for the members name and replace it with the link the user enters for the URL.
So the members name in the profile info area links to they specify when signing up.
Thanks
Dan
Below is an example of how to add a simple text field to a new users usermeta when they register…
In a new plugin file, your functions.php, or bp-custom.php put…
/* Add sign-up field to BuddyPress sign-up array */
function bp_custom_user_signup_field( $usermeta ) {
$usermeta['field_name'] = $_POST['name_of_field_in_template'];
return $usermeta;
}
add_filter( 'bp_signup_usermeta', 'bp_custom_user_signup_field' );
/* Add field_name from sign-up to usermeta on activation */
function bp_user_activate_field( $signup ) {
update_usermeta( $signup['user_id'], 'field_name', $signup['meta']['name_of_field_in_template'] );
return $signup;
}
add_filter( 'bp_core_activate_account', 'bp_user_activate_field' );Then somewhere in your custom register.php file, put…
<input type="input" name="name_of_field_in_template" id="name_of_field_in_template" value="" />
Replace “name_of_field_in_template” and “field_name” with what you need, and rename the functions if you want to, etc… Now when people sign up on your website, you can have custom usermeta that gets entered when they activate their account!
If you wanted to pump this up a notch, it’s possible to create a function to retain the value and send/receive field formatting errors also, so you can expand this to do something like youtube or twitter id’s on sign-up, outside of tying the fields into xprofile. Obvious uses for this would be to integrate BP with existing plugins that use usermeta already, letting your sign-up process get the headstart on setting up user accounts with the information those plugins want/need.
Have fun! Happy hacking!
I might make an example plugin for people to tear apart later if there’s interest.