Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)
  • @manohark

    Participant

    Hi Everyone,

    Here is the solution on half part of the saving custom value in the user meta table:

    /* Add sign-up field to BuddyPress sign-up array */

    function bp_custom_user_signup_field( $usermeta ) {
    $usermeta[‘expertise’] = $_POST[‘expertise’];
    return $usermeta;
    }

    add_filter( ‘bp_signup_usermeta’, ‘bp_custom_user_signup_field’ );

    /* Add field_name from sign-up to usermeta on activation */
    function setMeta($user_id, $password, $meta)
    {
    global $wpdb;
    $signup_tbl = $wpdb->prefix.”signups”;
    $users_tbl = $wpdb->prefix.”users”;

    //Query to get the custom field store in the signup table here I have set it to expertise
    $metadata = $wpdb->get_var(“SELECT meta FROM “.$signup_tbl.” WHERE user_login=(SELECT user_login FROM $users_tbl WHERE ID=”.$user_id.”)”);

    $user_exprts = unserialize($metadata);
    update_usermeta( $user_id, ‘expertise’, $user_exprts[‘expertise’] );
    }
    add_action( ‘wpmu_activate_user’, ‘setMeta’, 10, 3);

Viewing 1 replies (of 1 total)
Skip to toolbar