<![CDATA[ Login Custom Fields and array - My Forums]]> https://forums.modx.com/thread/?thread=96986 <![CDATA[Login Custom Fields and array]]> https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524735
I'm looking to create some 'favourite' functionality for a website I'm working on. If someone is logged in (using the Login extra), I'd like for them to be able to 'favourite' certain pages with the relevant resource id added to a custom field. Is it possible for me to store an array within the custom fields that I can use with GetResources to output a list of their favourites?

Phillip]]>
phillipd Apr 22, 2015, 09:19 AM https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524735
<![CDATA[Re: Login Custom Fields and array]]> https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524757
Thanks for the reply. I'll go with the first option you have suggested and create a comma separated list of Resource ID's as an extended field of the users profile.]]>
phillipd Apr 23, 2015, 12:41 AM https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524757
<![CDATA[Re: Login Custom Fields and array (Best Answer)]]> https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524752
Another way to go would be to 'tag' each resource with the user's username in a TV (or a MIGX TV). Then search for them with MIGX or with something like getResourcesTag (part of the TagLister package). I think you'd still need a custom snippet to save the user's "likes." The problem with this method is speed. The algorithm has to search through all the resources to find the user's favorites. With the method above, you just grab that one field of the Profile and you've got them all.

Either way, you've got a separate issue of creating a method to let users select a page as a favorite. The best method would probably be a button that triggered an Ajax call to a processor that would save the preference.]]>
BobRay Apr 22, 2015, 11:40 PM https://forums.modx.com/thread/96986/login-custom-fields-and-array#dis-post-524752