Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
Hello KK,
I want to know if it's possible to filter pages by extended user email like this:
Code: Select all
<cms:pages masterpage=k_user_template custom_field="extended_user_email=adimpressions@live.com" >
.....
</cms:pages>


Thank you
Hi @adimpressions,

Did you ever happen to solve this one? I'm trying to figure this one out myself, to no avail.
@mwlarkin1, I gave this issue a fair bit of thought and it is proving to be a sticky one.

Problem is that the 'extended_user_email' field has been defined as searchable='0'.
This has been done to prevent the emails from inadvertently appearing in search results of <cms:search>.

The query formulated by <cms:pages>, while searching for custom fields, uses the same field where the 'search value' mentioned above is stored and so comes up empty for emails.

To solve this quandary, my initial thought was to hook into the query and change it on-the-fly to use the field that stores the actual value (instead of the cleaned-up 'search value').
However, this field is not indexed and so could lead to performance issue if there are a large number of users.

So, now I think it'd be better if you go ahead and declare the 'extended_user_email' as searchable (taking care to exclude the users template for <cms:search> if your site happens to use it).

To do that, find the add_hidden_fields() function in 'addons\extended\extended-users.php' and modify the following line to make searchable='1' -
Code: Select all
<cms:editable label='Extended-User Email' name='extended_user_email' type='text' searchable='0' />

Visiting the users template as super-admin will persist the change and now the email field should become searchable.

Mind you, if there are existing user records, the previously empty search field will not automatically be populated.
You'll need to save each page anew for this happen (if there are many existing pages, you may tweak the csv importer to do this in a staggered manner for you).

I am sorry there is no clean solution available but hope this tweak helps.
@KK, it makes sense to have this change permanent (searchable='1') in the addon on top of a hook to 'alter_page_save' or 'alter_page_save_full_text' to exclude the emails from the cms:search.
@KK, thank you for clarifying! Should not be too difficult to recreate existing accounts à la the useful CSV importer.

Being able to filter via user email will be so handy, and I'm just happy to see it's possible! :)
@trendoman
it makes sense to have this change permanent (searchable='1') in the addon

Yes, I agree Anton. I'll try and see what can be done about it.
Nice, the alter_page_save hook sounds like a decent solution @trendoman! :ugeek:
7 posts Page 1 of 1