Log in

View Full Version : Getting User Input in Profile


zanis
11-23-2005, 08:26 AM
Hello,

I have created a custom field for the users profile. I need to get that value when they save their changes so I created a plugin that gets executed on the profileupdate event.

However I cannot work out how to get the value that was entered in the custom field - which is field6

I have tried:

$mf_access_code = $post['field6'];
$mf_nick_name = & $vbulletin->userinfo['username'];

and

$mf_access_code = & $vbulletin->userfield['field6'];;
$mf_nick_name = & $vbulletin->userinfo['username'];

But they do not work. Its basically getting the value of the custom field on input.

Can someone please tell me what object or var I need to access to get the posted field value.

Cheers

Marc

peterska2
11-23-2005, 08:37 AM
erm,

if you want it in your postbit, you can use the existing code $post[fieldx] in your postbit template

if you want it in the profile or members list then use the existing code $userinfo[fieldx] in the template.

No need to write your own plugin to pull info that is already available at the touch of a few keys

Marco van Herwaarden
11-23-2005, 09:14 AM
The best to do this would be to use hook location 'userdata_presave' ('userdata_postsave' is probably also possible). You will be hooking directly into the Data Manager, so it will even work if you change the field from the AdminCP.

New value: $this->userfield['fieldX']
Old value: $this->existing['fieldX']

zanis
11-23-2005, 05:33 PM
Hello MarcoH64,

Than you very much for responding - your solution worked 100% !

Cheers

Marc

Hello peterska2,

Thank you for responding.

Could you please tell me where I can get information on what is a postbit.

Cheers

Marc

Marco van Herwaarden
11-23-2005, 08:44 PM
'postbit' or 'postbit_legacy' is the template used to display a post. She misunderstood your question i think.

peterska2
11-25-2005, 12:06 AM
I did. I thought you meant getting it to display. It's what I get for replying when I'm awake instead of asleep!