Skip to:
Content
Pages
Categories
Search
Top
Bottom

Membership Codes


  • maganiza
    Participant

    @maganiza

    Hi guys thank you for such a great plugin.

    Is it possible for this plugin to assign unique 4-10 digit codes to users upon registration? I want each and every new registered user to automatically receive a unique code within the registration activation email. This code should also appear in their profile.

    Regards

Viewing 6 replies - 1 through 6 (of 6 total)

  • Henry Wright
    Moderator

    @henrywright

    Each member is assigned a user ID. The very first user will get 1 and then that number is incremented as each new user signs up. Does that help?


    maganiza
    Participant

    @maganiza

    yes that would do for now, so were do i activate the numbering?


    Henry Wright
    Moderator

    @henrywright

    User IDs are assigned automatically so you don’t need to activate them. With reference to displaying the number on your BuddyPress site, check out this article:

    Playing with the user’s ID in different contexts


    maganiza
    Participant

    @maganiza

    thank you for the speedy response. If I am not mistaken the article is more related to signed in/loggen in user IDs.

    I am looking at a solution whereby I will even view the member ID numbers on the list with the backend buddypress/wordpress system. Also I would like for these numbers to be static. For example if I run a search I want the numbers to be populated. Is this possible?


    Henry Wright
    Moderator

    @henrywright

    Yes. Every member in your install will have a user ID. So both BuddyPress and WordPress users will get a number. In fact, at the back end WordPress users and BuddyPress members are the same thing.


    danbp
    Participant

    @danbp

    @maganiza,

    it’s possible. I suppose you need a unique code for some later user specific actions. But that code exist nowhere when a user register. What can we do ?

    1) generate a 6 digit code and show it on the register page
    2) asign that code to the user
    3) show the code on his profile

    1 – we use php mt_rand to generate the code and one of the available action hook on the register page for his output. Add this snippet to bp-custom.php

    function bpfr_digit_generator() {
    $num = mt_rand ( 0, 0xffffff ); 
    $output = sprintf ( "%06x" , $num );
     
    	echo '<strong>Your personnal code: '. $output .'</strong>';
    
    }
    add_action( 'bp_after_account_details_fields', 'bpfr_digit_generator' );

    2) create a new xprofile field, call it Personnal Code or whatever. Make it mandatory and asign it the visibility level you want. In field description, ask the user to copy/paste in the code.

    3) as the user entered the code in a xprofile field, you get automagically this field on his profile.

    I’m a bit unsure how to insert this field value in the activation email, or if it’s even possible. Perhaps somebody else can help you. See email on codex.

    A bit raw, but at least you have a start point how to do that.

    Here also another method, you may use if you don’t want the user to copy/paste the code.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar