Forum Replies Created
-
In reply to: Easy Way to Make Friends with Everyone?
Hand out money and free beers
In reply to: Accidently emptied the wp_users tableThanks for the enlightening answer.
In reply to: About blog domainsI think that’s very much a WPMU issue.
In reply to: Accidently emptied the wp_users tableShould emptying the wp_users table ideally not also delete the connected user data in all the other tables, including xprofile? Or is that not how MySQL works?
In reply to: signup-description for core NameAs far as I know you can’t change anything about the registration form without hacking core files, including simple layout issues. The form itself is not in the templates, unlike for example the search form.
Or am I missing something again?
In reply to: is it possible to change the menus into drop down?I think originally the idea was to keep functionality and layout separate, so you could do whatever the hell you wanted with the templates without messing up the system. After upgrading you just reinstall your own template and everything should be fine.
Not sure if that’s still the case, with all the widget stuff etc. I just throw out anything that makes the templates too complex.
The phplist-dual-registration plugin also takes input from registration. It has this function:
function subscribe($input_data) {
if (!wpphplist_check_curl()) {
echo 'CURL library not detected on system. Need to compile php with cURL in order to use this plug-in';
return(0);
}
// $post_data = array();
foreach ($input_data as $varname => $varvalue) {
$post_data[$varname] = $varvalue;
}
// Ensure email is provided
$email = $post_data[$this->email_id];
// $tmp = $_POST['lid'];
// if ($tmp != '') {$lid = $tmp; } //user may override default list ID
if ($email == '') {
echo('You must supply an email address');
return(0);
}
// 3) Login to phplist as admin and save cookie using CURLOPT_COOKIEFILE
// NOTE: Must log in as admin in order to bypass email confirmation
$url = $this->domain . "admin/";
$ch=curl_init();
if (curl_errno($ch)) {
print '<h3 style="color:red">Init Error: ' . curl_error($ch) .' Errno: '. curl_errno($ch) . "</h3>";
return(0);
}
$post_data='action=subscribe&group_ids[]
'.$this->lid.'&email_address='.$this->email_id.'&firstname='.$this->name_id;Is the $post_data line what I need? Something like this?:
function subscribe($input_data) {
// $post_data = array();
foreach ($input_data as $varname => $varvalue) {
$post_data[$varname] = $varvalue;
}
$email = $post_data[$this->email_id];
$name = $post_data[$this->name_id];
}And then I could use $email and $name in my function to “do stuff” with?
Or can I use $post_data[$this->email_id] etc. directly? Is that the simple answer to my original question?
Why is the $post_data commented out?! Don’t I need it?
Do I need other pieces to make it work? For which fields would this work; only those from wp_users or xprofile as well? What about custom fields, including the real name/first name/last name mess?
Where exactly and when do you want your code to run?
Shorter version: In a plugin hooked to user_register or register_post – not sure which one.
Does anyone know how to intercept input from the registration form to “do stuff” with it?
In reply to: is it possible to change the menus into drop down?Here’s a very good one. It uses jQuery, which is included in WordPress.
Once you have the javascript and css in place the menu is not dramatically different from what comes with default templates – ul li etc.
Thanks for responding DJPaul!
I guess the hook would be this:
Runs when a user’s profile is first created. Action function argument: user ID.
Or maybe this?
Runs before a new user registration request is processed.
I have a wish list of things I need to do with input from the registration form:
1. synchronize fullname with wp_usermeta firstname + last name
2. autogenerate username/blogurl from fullname
3. add new user to the ListMessenger mailing list
They all require taking input from the registration form, processing the input and then storing the results in specific database tables. I’m trying to puzzle together one or more plugins to do that.
Anyone?
In reply to: How to redirect Home link to Profile PageGood idea!
As an alternative approach, how can I include some profile page content in the homepage? I’d probably have to use that is_user_logged_in() code, right?
I’ll look into that later and report back…
In reply to: Gender Specificremoved
In reply to: Generate username (+ blog url) from fullnameMy latest attempts were here, for a plugin for a related problem that will hopefully also lead to a solution for username/blogurl.
I have to decide first how I am going to put firstname + lastname into the database; split the fullname value out to wp_usermeta or turn fullname into firstname and add another xprofile field for lastname.
Again, I’m not really a php programmer. I’m trying to puzzle it together from code examples and googled bits and pieces. I’ll need all the help I can get!
I can’t figure out how the fullname moves from the registration form to the database; which pieces of code are involved and how to “intercept” it to “do stuff” with it. That’s where I’m stuck at the moment.
“user profile meta” is put “in a session ready to store”. Is that an “array”? Anyway, that’s higher level php to me. No clue how to extract the fullname value from that.
// put the user profile meta in a session ready to store.
for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) {
$bp_user_signup_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
}I really do appreciate all the work you do. I’m just really frustrated with the lack of synchronization and consistency between Buddypress xprofile and WordPress users/usermeta etc. Automattic needs to take a serious look at member management.
FYI, here’s the response from the WPMU forum:
Because if a spammer signs up, for instance, and you delete their username and blogs, if their registration member is also deleted, then they can sign up again.
I’m not satisfied with that answer. There must be cleaner ways to block/blacklist spammers.
Isn’t there a plugin that deletes users more thoroughly?
In reply to: Informations about our memberscomment removed
OK, thanks, I’ll post the question there.
But lack of synchronization between Buddypress xprofile and WordPress wp_usermeta etc. is also causing me lots of headaches, so I hope WPMU is not going to send me back here saying that it’s a Buddypress problem. Aren’t you all part of Automattic somehow?
This plugin attempt doesn’t break anything, but still doesn’t put first_name and last_name in wp_usermeta either:
`
<?php
/*
Plugin Name: Real Name Synchro
Plugin URI: http://
Version: v0.001
Author: peterverkooijen
Description: A plugin to store firstname and lastname from the fullname field in Buddypress registration in WPMU usermeta tables.
*/
function real_name_synchro() {
global $bp, $wpdb, $bp_user_signup_meta;
$fields = BP_XProfile_Field::get_signup_fields();
if ( $fields ) {
foreach ( $fields as $field ) {
$value = $_POST[‘field_’ . $field->id];
}
}
$field->id = ‘1’;
$fullname = $value;
$space = strpos( $fullname, ‘ ‘ );
if ( false === $space ) {
$firstname = $fullname;
$lastname = ”;
} else {
$firstname = substr( $fullname, 0, $space );
$lastname = trim( substr( $fullname, $space, strlen($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 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 ) );
}
//Actions
add_action(‘user_register’, ‘real_name_synchro’);
//Filters
?>`
Can anyone suggest fixes or am I fundamentally on the wrong track?
Data from the fullname field on the registration form is apparently stored in x-profile via this line:
// put the user profile meta in a session ready to store.
for ( $i = 0; $i < count($bp_xprofile_callback); $i++ ) {
$bp_user_signup_meta['field_' . $bp_xprofile_callback[$i]['field_id']] .= $bp_xprofile_callback[$i]['value'];
}How can I put the value from the fullname field into a function that does the same thing as xprofile_sync_wp_profile()?
I’d have to replace the BP_XPROFILE_FULLNAME_FIELD_NAME line with “something”. The fullname field_id seems to be 1.
So something like this?:
$bp_user_signup_meta['field_' . $bp_xprofile_callback['1'] .= $bp_xprofile_callback['value'];…?!
I guess function xprofile_sync_wp_profile() requires that the fullname (BP_XPROFILE_FULLNAME_FIELD_NAME) is already in the database and that the function can only be run after the user is already logged in.
So I guess I need to write another function that takes the fullname straight from the registration form and can be run with the user_register hook.
Where can I find the functions that take the data from the registration form and store them? I could probably use them as examples to come up with my own fuction for a plugin.
Edit: I guess all the magic happens in bp-xprofile-signup.php (function xprofile_load_signup_meta())? Is there a way to add a x-profile/wp_usermeta synchronization function to that file?
In reply to: Username and NameYes.
But I want only Username or only Name.
Or why not Username and Name is same.
Thank you
I still want to figure out a way to autogenerate the username from the name; full name with spaces stripped, all lower case.
I know it’s doable with simple PHP code, that I may have used before somewhere – have to dig through my older sites. But where/how could I insert that into the registration process? Would that have to be a plugin? Any pointers appreciated.
Or can I just add this to bp_custom.php?
function xprofile_sync_wp_profile() {
global $bp, $wpdb;
if ( (int)get_site_option( 'bp-disable-profile-sync' ) )
return true;
$fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id );
$space = strpos( $fullname, ' ' );
if ( false === $space ) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr( $fullname, 0, $space );
$lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
}
update_usermeta( $bp->loggedin_user->id, 'nickname', $fullname );
update_usermeta( $bp->loggedin_user->id, 'first_name', $firstname );
update_usermeta( $bp->loggedin_user->id, 'last_name', $lastname );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $bp->loggedin_user->id ), $bp->loggedin_user->id ) );
}
add_action( 'user_register', 'xprofile_sync_wp_profile' );Note the user_register edit in add_action.
Testing it now…
Edit: Apparently the function xprofile_sync_wp_profile() is already included in bp-xprofile/bp-xprofile-filters.php…
Trying that with the same edit:
add_action( 'user_register', 'xprofile_sync_wp_profile' );Edit: Still no separate first_name and last_name in wp_usermeta.

This is driving me nuts. Can anyone please help? Getting a first and last name in the database should not be this hard for a social network!
I had to remove this line of course:
add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' );Plugin now activated. Now testing to see if it does anything…
Edit: The plugin does not derail registration, but doesn’t do anything useful either. The first_name and last_name do not show up in wp_usermeta.

Why doesn’t it work? Any suggestions very much appreciated.
Is the hook to use this?:
Runs when a user’s profile is first created. Action function argument: user ID.
So something like this?:
<?php
/*
Plugin Name: Real Name Synchro
Plugin URI: http://
Version: v0.001
Author: peterverkooijen
Description: A plugin to store firstname and lastname from the fullname field in Buddypress registration in WPMU usermeta tables, based on examples in the <a href="http://www.devlounge.net">Devlounge</a> series.
*/
if (!class_exists("RealNameSynchro")) {
class RealNameSynchro {
function RealNameSynchro() { //constructor
}
function xprofile_sync_wp_profile() {
global $bp, $wpdb;
if ( (int)get_site_option( 'bp-disable-profile-sync' ) )
return true;
$fullname = xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id );
$space = strpos( $fullname, ' ' );
if ( false === $space ) {
$firstname = $fullname;
$lastname = '';
} else {
$firstname = substr( $fullname, 0, $space );
$lastname = trim( substr( $fullname, $space, strlen($fullname) ) );
}
update_usermeta( $bp->loggedin_user->id, 'nickname', $fullname );
update_usermeta( $bp->loggedin_user->id, 'first_name', $firstname );
update_usermeta( $bp->loggedin_user->id, 'last_name', $lastname );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET display_name = %s WHERE ID = %d", $fullname, $bp->loggedin_user->id ) );
$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->users} SET user_url = %s WHERE ID = %d", bp_core_get_user_domain( $bp->loggedin_user->id ), $bp->loggedin_user->id ) );
}
add_action( 'xprofile_updated_profile', 'xprofile_sync_wp_profile' );
}
} //End Class RealNameSynchro
if (class_exists("RealNameSynchro")) {
$dl_pluginSeries = new RealNameSynchro();
}
//Actions and Filters
if (isset($dl_pluginSeries)) {
//Actions
add_action('user_register', array(&$dl_pluginSeries, 'xprofile_sync_wp_profile'), 1);
//Filters
}
?>Testing it now…
Edit: Activating this plugin produces a white screen. Not a good start…

Where did I go wrong?
In reply to: Private NetworkThere have been several threads about this, including some useful code, but also lots of loose ends and confusion:
Securing components from non logged in users
Make access members/groups sections members-only
Plugin to show components to registered Users only
Apparently a “full-featured privacy (authorization) component for BuddyPress” is in the works for a future release.