Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'wp user activate'

Viewing 25 results - 826 through 850 (of 902 total)
  • Author
    Search Results
  • #51259
    peterverkooijen
    Participant

    This function for bp-custom.php adds fullname from xprofile field_1 to wp_usermeta.

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $fullname = $meta[field_1];
    $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 ) );
    }
    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    It shouldn’t be a big step to make the fullname lowercase, strip the spaces and store it as username.

    Make lowercase and strip space looks something like this:

    $str = strtolower($str);

    $str = str_replace(' ', '', $str);

    But does the system even allow changing the username at the wpmu_activate_user stage?

    The username is stored in four places in the database:

    wp_signups -> user_login

    wp_users -> user_login

    wp_users -> user_nicename (?!)

    wp_users -> user_url (as last part)

    Manually changing the username at these points in the database does NOT screw up my system. Login with email address continues to work fine with the same password. The profile page and links function as normal. :-)

    That is good news. It means it is possible to simply update the username from this same function.

    Now I just have to figure out the PHP and the queries for those four fields. Any pointers apprecriated!

    EDIT: Is $user_id a number or the username? That could complicate things…

    I assume $user_id is the username. Can I make this a two-stage rocket? First run the synchro_wp_usermeta function and then a separate function to deal with username, synchro_name_username? Put them in a plugin with something like this at the bottom?:

    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);
    add_action( 'wpmu_activate_user', 'synchro_name_username');

    Would that execute the functions in the right order?

    peterverkooijen
    Participant

    So how about this then, following DJPaul’s suggestions:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $fullname = $meta[field_1];
    $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 ) );
    }
    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    Can I simply replace $bp->loggedin_user->id with $user_id?

    Trying now…

    IT WORKS!!! HALLELUJA!!!

    Thanks DJPaul for all the essential clues!

    peterverkooijen
    Participant

    How can you identify the user on wpmu_activate_user? Only by the key from the activation link? How does that work?

    Then $bp->loggedin_user->id doesn’t work on activation either, does it?

    How is Lance Willet able to use $userid on wpmu_activate_user?

    Can I somehow use that to pull up the right meta row from wp_signups and store the values in wp_usermeta with the right user_id?

    Or can I use the email address as an identifier?

    peterverkooijen
    Participant

    This should work:

    function synchro_wp_usermeta( $user_id, $password, $meta ) {
    global $bp, $wpdb;

    $fullname = $meta[field_1];

    echo $fullname;

    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    BTW, I see Lance Willet here uses $userid with wpmu_activate_user, instead of $key.

    Does $bp->loggedin_user->id even work on activation? Shouldn’t everything be based on the activation key?

    peterverkooijen
    Participant

    This works!

    $array = $wpdb->get_var("SELECT meta FROM $wpdb->signups");

    $my_vars = unserialize($array);

    $fullname = $my_vars[field_1];

    echo $fullname;

    I know it’s basically DJPaul’s solution, twenty posts back, but minus the apostrophes.

    So now I know how to get the fullname, but still not how to get the fullname of the user that is activating = has the activation key?

    Why doesn’t this work then?:

    function synchro_wp_usermeta($key) {
    global $bp, $wpdb;

    $array = $wpdb->get_var("SELECT meta FROM $wpdb->signups WHERE activation_key = %s", $key);

    $my_vars = unserialize($array);

    $fullname = $my_vars[field_1];

    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 1);

    peterverkooijen
    Participant

    With this I get four missing argument errors again. Why?

    function synchro_wp_usermeta($key, $user_id, $password, $meta) {
    global $bp, $wpdb;

    $fullname = $wpdb->get_var("SELECT meta FROM $wpdb->signups WHERE activation_key = %s", $key);
    echo $fullname;

    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 4);

    #51121
    cbriere
    Participant

    Hi Korhan,

    In these thread the user states that some items failed to work:

    https://buddypress.org/forums/topic/buddypress-103-with-wpmu-284a#post-22006

    I just installed 2.8.4a and would like to install for the first time BP 1.0.3

    Don’t want to install BP until make sure it will work. If I install BP and fails to work, could it be a problem to Deactivate it?

    Thanks.

    peterverkooijen
    Participant

    This version also doesn’t work. No errors, registration goes through as normal, but still no first_name and last_name in wp_usermeta:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];

    $field = new BP_XProfile_ProfileData();
    $field->user_id = $user_id;
    $field->value = $field_value;
    $field->field_id = $field_ids[$i];
    $field->last_updated = time();

    $field->save();
    }

    $fullname = $field_value['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    Again, any suggestions that can move this along are very much appreciated.

    The problem really is how to extract the fullname data from the meta field in wp_signups. Can I do something similar to this:

    xprofile_get_field_data( BP_XPROFILE_FULLNAME_FIELD_NAME, $bp->loggedin_user->id );

    Is there a wp_signups_get_field_data I can tap into?

    Or some type of database query?:

    $wpdb->read( $wpdb->signups, array('???' => 1), array('??' => $key) );

    peterverkooijen
    Participant

    I had a good feeling about this attempt, but still nothing in wp_usermeta:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];
    }

    $fullname = $field_value['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    This version messes up registration:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp_user_signup_meta, $bp, $wpdb;

    $fields = BP_XProfile_Field::get_signup_fields();

    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];
    }

    $fullname = $field_value['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    Registration goes through as normal. The user gets one email with the activation link. But the page on the link says ‘Your account has already been activated. You can now log in with the account details that were emailed to you.’ No email arrives.

    So the above code hijacks activation without doing anything (probably because $bp_user_signup_meta was added). Still nothing in wp_usermeta either.

    My problem is getting the $fullname from $meta. I don’t understand the array stuff. I’m basically just guessing.

    If there are any php coders out there that can spot any obvious mistakes or can suggest other things to try, please help me out.

    peterverkooijen
    Participant

    You mean the 3 at the end of that line would fix that? I’ll try that next with a previous version of my code.

    Just for the record, this attempt again didn’t work. No errors, but nothing in wp_usermeta either:

    function synchro_wp_usermeta() {
    global $bp_user_signup_meta, $bp, $wpdb;

    $fields = BP_XProfile_Field::get_signup_fields();

    if ( $fields ) {
    foreach ( $fields as $field ) {

    $value = $_POST['field_' . $field->id];

    }
    }

    $fullname = $value['field_1'];
    $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( 'wpmu_new_user', 'synchro_wp_usermeta' );

    This fixes the missing arguments errors, but still nothing in wp_usermeta. I’ll need to figure out how to serialize (?) $meta and extract $fullname from it:

    function synchro_wp_usermeta($user_id, $password, $meta) {
    global $bp, $wpdb;

    $fullname = $meta['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    Paul Wong-Gibbs
    Keymaster

    Also when I put in the $user_id and $password arguments I got the error messages about missing arguments.

    add_action( ‘wpmu_activate_user’, ‘synchro_wp_usermeta’, 10, 3)

    peterverkooijen
    Participant

    Thanks for the additional clues DJPaul!

    In the latest attempt I was going back to my first approach, trying to catch the input straight from the form, so that has to run on initial user registration, not on activation.

    Or is user_register not used in Buddypress at all? Is there a wpmu or bp equivalent I could try? Should I use wpmu_create_user? According to this blog post:

    the do_action for wpmu_new_user is directly at the bottom of wpmu_create_user in the wp-includes/wpmu-functions.php the wpmu_create_user gets sent the username password and email and checks if the username or email exists, if not create the new user in the database and assign a user_id to the return, also assigning capabilities and level … this happens on *all* levels of registration and is the perfect hook point to add them into the database

    the do_action do_action( ‘wpmu_new_user’, $user_id ); so you get the immediate user_id soon as it’s created which you can use in your table

    Apparantly this is like a flowchart of registration events in wpmu (wp-includes/wpmu-default-filters.php):

    add_filter ( 'wpmu_validate_user_signup', 'signup_nonce_check' );
    add_action ( 'init', 'maybe_add_existing_user_to_blog' );
    add_filter ( 'xmlrpc_methods', 'attach_wpmu_xmlrpc' );
    add_filter ( 'wp_authenticate_user', 'wordpressmu_authenticate_siteadmin', 10, 2 );
    add_action ( 'wpmu_new_user', 'newuser_notify_siteadmin' );
    add_action ( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
    add_action ( 'sanitize_user', 'strtolower_usernames', 10, 3 );

    Should I focus on these wpmu action hooks instead of regular wp hook? Does bp have a list like this somewhere?

    I couldn’t figure out how to serialize that $meta data and extract the fullname from it, so I abandoned the approach hooking into wpmu_activate_user for now. Also when I put in the $user_id and $password arguments I got the error messages about missing arguments. wtf?!

    I think this bit of code grabs the input from the registration form:

    $fields = BP_XProfile_Field::get_signup_fields();

    if ( $fields ) {
    foreach ( $fields as $field ) {

    $value = $_POST['field_' . $field->id];

    fullname is the input from field_1, but I don’t know how to finish the php to get to $fullname = … . The two latest attempts above did not work.

    I have to give up for now. Deadline at my day job coming up…

    Paul Wong-Gibbs
    Keymaster

    add_action( 'wpmu_activate_user', 'synchro_wp_usermeta', 10, 3);

    function synchro_wp_usermeta( $user_id, $password, $meta ) { ... }

    You’re also going to need to hook into the ‘wpmu_activate_blog’ action, as activate_user is not called when the user chooses to create a blog on registration.

    peterverkooijen
    Participant

    You’ll need to have all three arguments, even if you don’t want to use them all. You can miss out ones AFTER the one you want, but you can’t miss anything out before the one you wish to use.

    Are you sure about that? With the three arguments I get two ‘Missing argument’ error messages. With only $meta there are no errors – although it doesn’t do anything either…

    EDIT: Tried the code below. Again one ‘Missing argument’ error. Registration goes through as normal, but nothing in wp_usermeta:

    function synchro_wp_usermeta($user_id, $meta) {
    global $bp, $wpdb;

    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];
    }

    $fullname = $meta['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta' );

    peterverkooijen
    Participant

    This latest attempt had no error messages, but also no first_name and last_name were added to wp_usermeta:

    function synchro_wp_usermeta($meta) {
    global $bp, $wpdb;

    $fullname = $meta['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta' );

    ?>

    I suspect I need some additional code to “unpack” $meta.

    In a previous attempt I tried this, based on a function in bp-xprofile-signup.php:

    // Extract signup meta fields to fill out profile
    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];

    $field = new BP_XProfile_ProfileData();
    $field->user_id = $user_id;
    $field->value = $field_value;
    $field->field_id = $field_ids[$i];
    $field->last_updated = time();
    }

    $fullname = $field->field_1;

    I think it crashed my server…

    I’ll need help (un?)serializing that $meta array. I’ll study up on that stuff later.

    But first I’ll try if bp_user_fullname() works. After some late lunch…

    peterverkooijen
    Participant

    Thanks Paul!

    $meta[‘field_1’] definitely looks like something to try, although I still totally don’t “get” serialized PHP arrays.

    I was also wondering if I could just bp_user_fullname() at this point, before activation.

    Trying both now…

    EDIT:

    function synchro_wp_usermeta($user_id, $meta) {
    global $bp, $wpdb;

    $fullname = $meta['field_1'];
    $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( 'wpmu_activate_user', 'synchro_wp_usermeta' );

    ?>

    Registration process works fine, but I with this error in the screen on activation:

    Warning: Missing argument 2 for synchro_wp_usermeta() in /serverpath/wp-content/mu-plugins/bp-custom.php on line 187

    I had taken $password out. Thought I didn’t need it. Will try again with it added back in….

    EDIT2: Adding $password only gives me a second error:

    Warning: Missing argument 2 for synchro_wp_usermeta() in /serverpath/wp-content/mu-plugins/bp-custom.php on line 187

    Warning: Missing argument 3 for synchro_wp_usermeta() in /serverpath/wp-content/mu-plugins/bp-custom.php on line 187

    Can I just take $user_id out? Is all the information I need already in that wpmu_activate_user action?

    I’ll try that next, after deleting test users. Running out of email addresses…

    Paul Wong-Gibbs
    Keymaster

    Hey, the entire best way to get a response from me is to give my plugins some advertising!

    Let’s see. Those thingies are called arguments. As you have probably figured out, ‘wpmu_activate_user’ action is called from wpmu-functions.php line 1208 (on my development server files, at least).

    First two arguments are obvious. When an account is registered, a new records is made in the wp_signups database table. There is a column called $meta, which is a seralized PHP array. $meta as in the wpmu_activate_user argument, is the unseralized version of that array for the user that has just activated his/her account.

    On one of my test users, it seems to contains keys: field_1, xprofile_fields_ids (not sure), avatar_image_resized (bool) and avatar_image_original (bool).

    So as you’ve suggested above, I reckon you can just use $meta[‘field_1’]. Let us know!

    EDIT: the code you’ve pasted above. You’ll need to have all three arguments, even if you don’t want to use them all. You can miss out ones AFTER the one you want, but you can’t miss anything out before the one you wish to use.

    peterverkooijen
    Participant

    bp-xprofile-signup.php has a promising looking function:

    xprofile_on_activate_user()

    When a user activates their account, move the extra field data to the correct tables.

    function xprofile_extract_signup_meta( $user_id, $meta ) {
    // Extract signup meta fields to fill out profile
    $field_ids = $meta['xprofile_field_ids'];
    $field_ids = explode( ',', $field_ids );

    // Loop through each bit of profile data and save it to profile.
    for ( $i = 0; $i < count($field_ids); $i++ ) {
    if ( empty( $field_ids[$i] ) ) continue;

    $field_value = $meta["field_{$field_ids[$i]}"];

    $field = new BP_XProfile_ProfileData();
    $field->user_id = $user_id;
    $field->value = $field_value;
    $field->field_id = $field_ids[$i];
    $field->last_updated = time();

    $field->save();
    }

    update_usermeta( $user_id, 'last_activity', time() );
    }

    Does $field->save(); have something to do with function save()?

    function update_usermeta actually updates wp_usermeta. So why is field_1 not stored in wp_usermeta?! Very confused…

    #50343
    azznonimous
    Participant

    … Just the last comment, the add_action works fine this way (last line, moved from the bp-example-admin.php to bp-example.php):

    function bp_example_check_installed() {
    global $wpdb, $bp;

    if ( !is_site_admin() )
    return false;

    /***
    * If you call your admin functionality here, it will only be loaded when the user is in the
    * wp-admin area, not on every page load.
    */
    require ( WP_PLUGIN_DIR . '/bp-example/bp-example-admin.php' );

    /* Need to check db tables exist, activate hook no-worky in mu-plugins folder. */
    if ( get_site_option('bp-example-db-version') < BP_EXAMPLE_DB_VERSION )
    bp_example_install();
    }
    add_action( 'admin_menu', 'bp_example_check_installed' );
    add_action( 'admin_menu', 'bp_example_add_admin_menu' );

    #50316
    Jeff Sayre
    Participant

    There is more overhead with WPMU, but the biggest issue is whether a site allows its members the option to create blogs and how many active blogs the site has. So, running single-version WP could help reduce the load in theory.

    But, BuddyPress can also be a bandwidth, memory, and harddrive-space intensive plugin suite. It all depends on a site’s user activity and what additional BP-dependent plugins a site installs and activates.

    For instance, if a site uses a media plugin that allows users to upload photos, mp3, and video files, then a low-powered hosting account could get swamped even if it is “just” running single-version WP.

    #50190
    Jeff Sayre
    Participant

    I know it’s a tad tricky to answer but there must be a rule of thumb somewhere?

    There is no rule of thumb that I know of. There are too many variables to say with certainty that a WPMU + BP install needs “X MB” of DB space. It depends on the number of users, the activity level of each user, the overall site activity, whether you give them each a blog (or more), and what plugins you have installed and activated.

    But, I suspect that having a DB size limit of 150 MB is a stretch just on a low-trafficked WPMU site. Add in BuddyPress and 100 active users, and you’ll quickly shoot through that limit.

    As an example, on one of my WPMU + BP test platforms, I have 5 users and only two MU blogs with very few test blog posts. Since it is a test install only used by myself, it has very little activity thus very little data written to the DB.

    The DB size of that simple setup is 1.8 MB. Imagine an active site with many blogs and 100 users. Your host’s DB limit of 150 MB would be quickly reached.

    #50127
    Lriggle
    Participant

    @JohnJamesJacoby

    I don’t believe we have any issues with sub domains in that respect. We’ve had users sign up to the site and create blogs at the same time, and the blogs and their sub-domains seem to be created and work just fine. We’ve also manually created blogs (not via buddypress but in WPMU) and those also work just fine.

    @Brajesh Singh

    Here are the plugins we have activated:

    – WordPress Video Plugin

    – Buddypress

    – BPDEV Core

    — BPDEV Flickr

    — BPDEV YouTube

    – Featured Member Widget

    peterverkooijen
    Participant

    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.

    Graeme
    Participant

    I have finally been able to duplicate the installation.

    Here’s a relatively complete set of steps for guidance. This took me several hours to prepare and it can be easy to make a stupid error along the way. Just take it slow.

    These steps are for WordPress MU 2.8.1, bbPress 1.0.1 and buddyPress 1.0.3.

    1. Download and install WordPress MU 2.8.1

    2. Install the “bbPress Integration” plugin version 1.0 via the “Plugins” -> “Add New” menu of your wordpress mu installation.

    In the search box enter ‘bbPress Integration” and click “Search Plugins”.

    Click the “Install” link for the “bbPress Integration” version 1.0 plugin.

    Click the orange “Install Now” button.

    Click the “Activate Plugin” link.

    3. Download and install bbPress 1.0.1 in a sub-directory of your wordpress installation.

    I chose the sub-directory “/forums/”.

    4. Load up the bbPress installation script by going to http://<yourdomain>/forums/

    5. Click “Go to step 1”.

    6. Enter the database name, database user and database password that you used for your wordpress installation.

    You will not usually need to click “Show advanced settings”.

    7. Click “Save database configuration file”.

    You should see a message “Your settings have been saved to the file bb-config.php. You can now continue to the next step.”

    8. Click “Go to step 2”.

    9. Next you add the integration settings. This is the important part!

    – click “Add integration settings”

    – click “Add cookie integration settings”

    – you will be presented with a list of eight text entry fields

    – the first two are for your wordpress and blog url. For each of these enter your exact urls. I just used the same value for each. They need to commence with http://

    – for all the cookie values just enter “COMMENT OUT”. These will become reference points in the bbpress config file for later.

    10. Click “Add user database integration settings”. This step is also important!

    Leave the existing value in the “User database table prefix” field.

    Enter the WordPress Primary blog id value “1” – THIS IS IMPORTANT.

    11. Click “Save WordPress integration settings”

    If all is well you should see this message.

    Your WordPress integration cookie and database settings have been successfully validated. They will be saved after the next step.

    Once you have finished installing, you should visit the WordPress integration section of the bbPress admin area for further options and integration instructions, including user mapping and the correct cookie settings to add to your WordPress configuration file.

    12. Click “Go to step 3”.

    – enter your site name

    – enter your site url. I entered the url to the forums including the http://

    e.g. http://bp.dev/forums/

    – select the “admin” user for your wordpress installation

    – enter a name for your first forum e.g. “Announcements”

    13. Click the “Save site settings” button

    14. Click the “Complete the installation” button

    15. You should see a screen indicating installation has completed.

    – click the “Show installation messages” option. Scroll through and see of any errors are reported.

    16. At this point you should be able to login to your bbpress installation with your wordpress admin username and password.

    17. Login to bbPress

    18. Click the “Admin” link to go to the admin screen

    19. Go to “Settings” -> “Writing” and enable XML-RPC publishing protocol (this is needed by buddyPress)

    20. Go to “Settings” -> “Discussion” and enable pingbacks (I think this is needed by buddyPress ….?)

    21. Go to “Users”

    22. Go to “Settings” -> “WordPress Integration”

    Set the mapping of bbPress roles to WordPress users roles

    For the WordPress Administrator role select “bbPress Key Master”.

    For all the others select “bbPress Member”.

    Click “Save Changes”

    23. Login to WordPress MU as the admin.

    24. Go to “Plugins -> Add New”

    25. Enter “bbPress Integration” and click “Search Plugins”.

    – you should see “bbPress Integration” 1.0 listed

    – click “install”

    – click the orange “Install Now” button

    – click “Acrivate Plugin”

    26. Go to “Settings” -> “bbPress Integration”

    Ensure there is a full url for the bbPress forums entered.

    Select WordPress type “WordPress MU”

    Click “Save Changes”

    Copy the values listed in the dark grey box at the bottom of your page into your clipboard. There will be four lines that look something like this:

    define( ‘COOKIEHASH’, ‘da4672dda66fd60a6b80e420d32ef26c’ );

    define( ‘COOKIE_DOMAIN’, ‘.bp.dev’ );

    define( ‘SITECOOKIEPATH’, ‘/’ );

    define( ‘COOKIEPATH’, ‘/’ );

    Don’t worry – these values will be different for your installation.

    Open wp-config.php in an editor and insert these lines immediately after the opening “<?php” line.

    Whilst you have wp-config.php open, copy the authentication keys to your clipboard. They look like this:

    define(‘AUTH_KEY’, ‘800345c011dfad9261cedec0a3d914ffa1b40d67b23b66e4809797ce728f0b80’);

    define(‘SECURE_AUTH_KEY’, ‘5d6d3f657c9fb496e3f5488044fc174c238554a1b5347eb633ea8baecf0dcc7c’);

    define(‘LOGGED_IN_KEY’, ‘6749832494719d8217e06c233326cb86da9ec040b16f705156660e1642a5f0e8’);

    define(‘NONCE_KEY’, ’87a5b149e95e0a13020541040353548eaf65b68452be91c685e96a7fbab685bc’);

    define(‘AUTH_SALT’, ‘8ff197cc15f311c975bd14ce131e7872eb390706bd316f72435c081836d14f34’);

    define(‘LOGGED_IN_SALT’, ‘642683992ae38da46082bf9850ab90273deb7d5d1034baf80a3fd32871b5e04a’);

    define(‘SECURE_AUTH_SALT’, ‘7c066b9c14bd558737b74b76c77f928e3612935832a6a47bd70842e118c947fa’);

    They will be different for your installation.

    Save wp-config.php

    27. Open bb-config.php

    Find the lines containing the Authentication Unique Keys. They will have the values “COMMENT OUT” if you followed the instructions above. Comment these lines out!

    Insert the lines from your clipboard into bb-config.php below the lines you commented out.

    You need to edit each line you inserted and prefix the name of each constant with “BB_”

    After doing that, the lines will be something like:

    define(‘BB_AUTH_KEY’, ‘800345c011dfad9261cedec0a3d914ffa1b40d67b23b66e4809797ce728f0b80’);

    define(‘BB_SECURE_AUTH_KEY’, ‘5d6d3f657c9fb496e3f5488044fc174c238554a1b5347eb633ea8baecf0dcc7c’);

    define(‘BB_LOGGED_IN_KEY’, ‘6749832494719d8217e06c233326cb86da9ec040b16f705156660e1642a5f0e8’);

    define(‘BB_NONCE_KEY’, ’87a5b149e95e0a13020541040353548eaf65b68452be91c685e96a7fbab685bc’);

    define(‘BB_AUTH_SALT’, ‘8ff197cc15f311c975bd14ce131e7872eb390706bd316f72435c081836d14f34’);

    define(‘BB_LOGGED_IN_SALT’, ‘642683992ae38da46082bf9850ab90273deb7d5d1034baf80a3fd32871b5e04a’);

    define(‘BB_SECURE_AUTH_SALT’, ‘7c066b9c14bd558737b74b76c77f928e3612935832a6a47bd70842e118c947fa’);

    Save the file and exit.

    28. Clear cookies and Refresh for your domain. In Firefox you can clear cookies for a specific domain pattern.

    29. Login to your wordpress installation as the wordpress admin user.

    30. Assuming you managed to follow the setps above, If you go to your bbPress page you should find that you are logged in!

    31. From WordPress Admin go to “Plugins” -> “Add New”

    – in the search box enter “BuddyPress” and click “Search Plugins”

    – find BuddyPress 1.0.3 in the list

    – click “Install”

    – click the orange “Install Now” button

    – click “Activate Plugin”

    32. BuddyPress is now installed. Follow the BuddyPress instructions for installing the themes to the correct locations and activate them.

    33. In wp-admin go to “BuddyPress” -> “Component Setup” and check that the “bbPress Forums” component is enabled.

    34. In wp-admin go tp “BuddyPress” -> “Forums Setup”

    – ensure that the URL for the forums is entered

    – ensure that the bbPress username and password details have been setup

    – click “Save Settings”

    35. Create a group with option selected for a forum.

    36. Check that you can post topics in the group forum!

    37. Take a break!

    #49510
    danbpfr
    Participant

    wpmu 2.8.1

    bp 1.0.3 trunk version

    bbpress 1.0.1

    here is my bug list. I read the trac message mentionned above and made my own change. Anyway all i listed here is already not working.

    I suggest you go to the site and terst yourself (it’s a test site straigth out of the box)

    May this help.

    Group page – main content

    http://buddypress-fr.net/bpdemo/groups/groupe-de-tests/home/

    Topic list is showing well.

    This is a link from one of the topic. When click on it, it brings me to the homepage.

    http://buddypress-fr.net/bpdemo/groups/groupe-de-tests/forum/topic/25

    Same thing with the “view all topics” link

    http://buddypress-fr.net/bpdemo/groups/groupe-de-tests/forum

    Group page – Forum button

    http://buddypress-fr.net/bpdemo/groups/groupe-de-tests/group-forum/

    Menu is ok, but when i click on “forum”, the right col “main content” becames blank.

    The admin bar disapear also

    Group page – Wire

    http://buddypress-fr.net/bpdemo/groups/groupe-de-tests/group-wire/

    “view all” brings me to the homepage

    Group page – create a group

    http://buddypress-fr.net/bpdemo/members/admin/groups/create/step/group-details

    The 4 menu options (details, settings,…)in maincontent are no more translated

    After the group is created, when i go to the new group admin, the options are translated.

    on step 2, the forum option is deactivated.

    The permanent warning message about configuration is not necessary for ordinary user, because they can’t never install bbPress, even if they are blog admin or there own group forum master.

    Anyway, this means to create a group first, then finish the whole register process, saving and to come back to the group to activate the forum. Not sure if this is a bug, but it’s anoying.

    Once the group is created, the forum option is not appearing at all.

    Group page – wire

    unable to create a message. When posting, i flip to the homepage without any error message.

    Group page – change group avatar

    This is impossible ! I load a new image, loader is turning a little, and… nothing happens.

    *****

    I uploaded the 1.0.3 latest release version and changed the whole bp-theme/group folder from trunk to latest release.

    Now, i can change group avatar.

    Also, can you explain me the difference between the two folder, the trunk version has a very different content.

Viewing 25 results - 826 through 850 (of 902 total)
Skip to toolbar