Retrieving CPF Fields

Post

Posted
Rating:
#4551 (In Topic #918)
Hi,
Can someone give me some advise on how ( in php) would you return a specific CPF field for a member.

ie $_username = $GLOBALS['CNS_DRIVER']->get_member_row_field($member_id, 'm_username');
returns the Username

if I had a CPF called "ScreenName" how would i get that using the $member_id.


The end goal ( if im feeling brave) is to try and modify the forum system to display the CPF "ScreenName", rather than the username. Its only the displayed text i want to change rather than any underlying links or the functionality

This is both for security to prevent people who use their e-mail address as their user name from it obviously being displayed, and convienience as some usernames are not always clear to the user.

As a fall back if the CPF is null/blank, then i would aim to continue to display the username.
Thanks
Chris

Post

Posted
Rating:
#4552
Not to answer your question directly, but there is already a 'Display name generator' feature which you can tie to a existing CPF and will likely do what you want here. Admin Zone → Setup → Configuration → User/usergroup options

Post

Posted
Rating:
#4553
Wow, that's cool - Thanks

I missed that config option completely. I'll give it a go

Chris

Post

Posted
Rating:
Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 (Liked by Adam Edington)
#4554
Thanks Kingbast.

Works a treat.

Post

Posted
Rating:
#4555
Glad to hear it ;)

Post

Posted
Rating:
Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 Item has a rating of 5 (Liked by Adam Edington)
#4556
For reference, I think $GLOBALS['CNS_DRIVER']->get_member_row_field($member_id, 'field_10'); works, where 10 is the field ID. There are a few ways for reading in CPFs for members.
1 guest and 0 members have recently viewed this.