Reply To: Membership Codes
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.