This module has saved the day!!

But, I am looking to add a hidden field to user bio profile (field name random_mem). This will be created on registration. I want this hidden textfield to house a random number generated by PHP rand();. I plan on using this to generate a membership ID number that in turn will be referenced and or printed to a membership card using views(already working).

I have looked to hook form alter, and CCK computed field/PHP in field. I have been able to achieve this with the Hide Title module but this only generates the ID when a user comes back to edit their profile not when registration happens. I have also looked at creating a module with hook_form_alter but can't seem to edit user_register and find the correct form fields.

Any suggestions or directions would be greatly appreciated as this is the only outstanding issue for my member registration, I am in desperate need.

Kind Regards,

Comments

R0ger’s picture

Status: Active » Closed (fixed)

Found the error of my ways.

You can generate a randon form field using php rand(), in my case i wanted a membership id to print on the members card that was aside from the user id generated by drupal. Using CCK content type (for me text field), Select Default value > PHP Code.

Here you can apply an array using PHP. Here is the example that I used in hopes that it helps someone else because I spend a ton of time on this.

return array(0 => array('value' => rand(21070, 1000000)));

Regards,