Search Results for 'profile fields'
-
Search Results
-
Topic: X-Profile Fields
Just installed a fresh WP/BP in my test environment with WP2.8.5.2 and BP1.1.2. I’m having an issue setting up certain custom profile fields.
In our live environment, which is a bit older and running BP 1.0.3, there were some pre-built fields available for things like State and Country pulldowns. I’ve been able to find the CSV files where this info resides in 1.1.2, but the pre-built fields don’t seem to be available.
Have these been phased out of use in this version of BP, or did I mess something up? I don’t relish the idea of creating 50 pulldown items for the US states…
Topic: html in profile fields
I have a need where I want to add html to the bp profile fields. I am using WP 2.8.4 and BP 1.1.1. Per a different thread, I’ve tried….
function stuff_i_want_triggered_after_bp_loads(){
remove_filter( 'xprofile_get_field_data', 'wp_filter_kses', 1 );
}
add_action('wp', 'stuff_i_want_triggered_after_bp_loads');…but it generates an error. Since the thread was older, I’m guessing something changed in 1x version.
How can I enable html in profile fields?
Thanks,
Phil
My first custom field_1 is for fullname. I want to capitalize that input. I already have a function that does that – nameize(). Where should I apply it?
I’ve gone through a lot of trouble to also update the full name in wp_usermeta and elsewhere upon activation, so those fields all have nicely formatted names.
But the display name is apparently stored in xprofile before activation. Where is the code that does that? Or is there a way to update the xprofile field with capitalized versions in the same custom function I use to update wp_usermeta?:
function synchro_wp_usermeta($user_id, $password, $meta) {
global $bp, $wpdb;
$uid = get_userdata($user_id);
$email = $uid->user_email;
$fullname = $meta[field_1];
$space = strpos( $fullname, ' ' );
$company = $meta[field_2];
if ( false === $space ) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr( $fullname, 0, $space );
$lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
}
$firstname = nameize($firstname);
$lastname = nameize($lastname);
$autousername = str_replace('-', '', str_replace("'", "", str_replace('.', '', str_replace(' ', '', strtolower($fullname)))));
update_usermeta( $user_id, 'nickname', $fullname );
update_usermeta( $user_id, 'first_name', $firstname );
update_usermeta( $user_id, 'last_name', $lastname );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_login = %s WHERE ID = %d", $autousername, $user_id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_nicename = %s WHERE ID = %d", $autousername, $user_id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $user_id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $user_id ), $user_id ) );
}
add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);Hi,
I have WPMU 2.8.4 and tried upgrading to BP 1.1.2, the upgrade didn’t work, gave some error during activation, so I deleted the previous BP (1.0.3) installation and installed + activated BP 1.1.2.
Rest all seems to be working fine so far, until it came to saving additional profile data. I have added some custom profile fields, they show up fine on my register page, but in spite of saving them, I see them as empty when I log in as the user and check out my public profile. No data is saved! Only when I fill in the data again, does it get saved.
I am still using the older 2-theme architecture, I have a separate WPMU theme and I’m using my old default member theme for the BP part. I am not sure, could this be the reason for the above issue? I tested this out on my local system with BP 1.1.1 and its working fine, the fields get saved, but doesn’t work on my server with 1.1.2. Is it a bug or something?
Thanks,
Sib.
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…