Skip to:
Content
Pages
Categories
Search
Top
Bottom

Custom data at signup/ registration

  • Avatar of Tom(dB)
    Tom(dB)
    Participant

    @tomdebruin

    I’m trying to add a simple radio button to the signup form, and I’ve got as far as adding that to the signup form. On `bp_core_activate_account` the data goes into the meta of the `wp_signups` table. Then on activation that data is transferred into the `wp_usermeta` table – except the value of `notification_newsletter`.

    In the `newslettersignup_bp_activate` function I realise in the example below that I’m trying to pass in the POST data (which has long gone), but the data that is passed into that function only contains the user_id. Other examples of this process suggest that this is an array with all the registration meta in it – `print_r` returns nothing more than user_id.

    Why aren’t all the values in `wp_signups` -> `meta` transfered to `wp_usermeta` in the activation process? And what can I put into `update_user_meta` to get that value?

    My mind boggles, help gratefully accepted. Code snippet below:
    `/**
    * Add custom userdata from register.php
    */
    function newslettersignup_bp_signup_field( $usermeta ) {
    $usermeta = $_POST;

    return $usermeta;
    }
    add_filter( ‘bp_signup_usermeta’, ‘newslettersignup_bp_signup_field’ );

    /**
    * Update usermeta with custom registration data
    */
    function newslettersignup_bp_activate( $user ) {

    //print_r($user);

    update_user_meta( $user, ‘notification_newsletter’, $_POST );

    return $user;
    }
    add_filter( ‘bp_core_activate_account’, ‘newslettersignup_bp_activate’ );`

You must be logged in to reply to this topic.