Access to custom profile fields

Access to custom profile fields

Craig Douglas發表於
Number of replies: 4
I've set up a couple of custom profile fields which I access in php using $USER->field_id where field_id is the unique name chosen when creating the field.

This works ok, but when the user changes the value of this field, php doesn't seem to see the change until the user logs out and back in again. Why is this happening or (better) how can I make the change instant on the next page load.

For testing at the minute, I've just got it printing out the value of the field at the top of the page so I can check the value.

Thanks
Craig
評比平均分數: -
In reply to Craig Douglas

Re: Access to custom profile fields

Patrick Pollet發表於
Hello,

This bug has been signaled on the tracker as http://tracker.moodle.org/browse/MDL-18964 and seems not yet fixed. I gave a patch for file user/profile/lib.php for Moodle 1.9.3...

Please vote for it

Cheers.
In reply to Patrick Pollet

Re: Access to custom profile fields

Craig Douglas發表於
Hi Patrick,

Thanks - thought I was going mad at first! I've voted for it.

I've also attached our current user/profile/lib.php. Would you be able to tell me what to add where or make the changes please? I've tried piecing it together from the diff with no success.

Thanks
Craig
In reply to Craig Douglas

Re: Access to custom profile fields

Patrick Pollet發表於
yes; the diff file was for Moodle 1.9.3 and few things have changed in 1.9.7

see attached lib.php with the 5 lines correctly added.

Cheers
In reply to Patrick Pollet

Re: Access to custom profile fields

Craig Douglas發表於
I'd just figured it out, came on to tell you not to bother and you've already done it! Many thanks for your help, works great now!

Thanks
Craig