<![CDATA[ Register and ClassExtender - MODX Community Forums]]> https://forums.modx.com/thread/?thread=103727 <![CDATA[Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557969
I used ClassExtender to create several new User Profile fields, and as I understand it that requires adding the following two properties to the Register call:

Am I correct that "useExtended=0" prevents extended fields from being added to the "Extended" tab of the user profile page? Because as far as I can tell that seems to be exactly what's happening when someone registers.]]>
todd.b Apr 11, 2018, 10:54 PM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557969
<![CDATA[Re: Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-558000 ]]> BobRay Apr 13, 2018, 05:03 PM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-558000 <![CDATA[Re: Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557991
Bob, it works perfectly.

Thank you.]]>
todd.b Apr 12, 2018, 09:04 PM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557991
<![CDATA[Re: Register and ClassExtender (Best Answer)]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557988
$data = $modx->getObject('userData', array('userdata_id' => $modx->user->get('id')));
$firstName = $data->get('firstName');
$folder_message = "<strong>Hi " . $firstName . "</strong>, this is your custom media folder...
BobRay Apr 12, 2018, 07:36 PM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557988
<![CDATA[Re: Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557974
The section that might help has the heading 'Your Own Code'.

andytough Apr 12, 2018, 06:20 AM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557974
<![CDATA[Re: Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557972
Generally speaking I'm never certain if and/or when the property order matters, regardless of snippet. Yet I always seem to get caught out every now and then. Some rules or guidelines regarding property order would not go amiss.

Anyway, getting back to my original question. I'm asking about useExtended=0 because I'm using a customized TW responsivePersonalConfig Chunk to personalize the RFM folder message.

It grabs the extended field (firstName) for the message.
$myProfile = $modx->user->getOne('Profile');
$myProfile = $myProfile->get('extended');
$myProfile = $myProfile['firstName'];
$folder_message = "Hi " . $myProfile . " This is your custom media folder...

It was working fine when I was only using User > Extended Fields.

The problem now is this (when using ClassExtender with Register):
The useExtended=0 property in the Register (and UpdateProfile) calls prevent the firstName (and other fields) from being saved in User > Extended Fields which is where the above code looks for the firstName value. Hence it's not being displayed in the RFM message.

Assuming useExtended=0 and postHooks=ExtUserRegisterPosthook are in fact required when using ClassExtender fields, then my question is simply this:

How can I grab the firstName value from the ClassExtender field and use it in the custom RFM folder message (above)?]]>
todd.b Apr 12, 2018, 03:48 AM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557972
<![CDATA[Re: Register and ClassExtender]]> https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557971
andytough Apr 12, 2018, 02:06 AM https://forums.modx.com/thread/103727/register-and-classextender#dis-post-557971