Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to make 10 digit ID for each new member, and echo it out on members info page

  • I am building a network, and one of the member fields needs to be a unique 10 digit number. I need it to echo out on the members info page with their email, hometown, etc. Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Okay, I found rand in php, how do I get it into the registration process so it’s not random after it’s chosen for each member?

    Okay, well, thanks anyway!


    modemlooper
    Moderator

    @modemlooper

    Search BuddyPress register hook, you can add code to the registration process. Possibly add a hidden sign up field that generates your number


    modemlooper
    Moderator

    @modemlooper

    This code is not tested but it’s an example of adding a field and then getting results.

    `function bp_numb_add_reg_field() {
    $rand_numb = //php to generate number here ;
    echo ”;
    }
    add_action( ‘bp_before_registration_submit_buttons’, ‘bp_numb_add_reg_field’ );

    function bp_numb_get_reg_data() {
    if ( isset( $_POST ) ) {

    $numb_value = $_GET;
    // do something with the custom data
    }
    }
    add_action( ‘bp_complete_signup’, ‘bp_numb_get_reg_data’ );`

    Thanks! I will work with that.

    I think I can use rand(1, 1000000);
    but I don’t know what to do with it after that. I created a custom-fields area in my members-header.php file, where I echo out fields with variables, but I don’t know how to get this function from functions.php to members-header.php.


    rich
    Member

    @etivite

    use one of the various action hooks within members-header.php template file

    http://etivite.com/api-hooks/buddypress/path/bp-themesbp-defaultmemberssinglemember-header-php/

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to make 10 digit ID for each new member, and echo it out on members info page’ is closed to new replies.
Skip to toolbar