Forum for discussing general topics related to Couch.
3 posts Page 1 of 1
Hi,
Is there a way to set up the page custom_field to be equal to checkbox values?

While using extended users, i want to set up some notifications and these are for select groups (always different) of users each time, therefore i set up a clonable page to be used for each notification with a checkbox field with the user id's, and if the if a user id is selected as a part of that notification, it will show to them.

Right now I am doing it as such:

Code: Select all
<cms:pages masterpage="notifications_module/notification.php" >
            <cms:if "<cms:arr_val_exists "<cms:show k_extended_user_id />" in=__who />">
              <p><cms:show k_page_title /></p>
            </cms:if>
          </cms:pages>


Though I believe using the custom_field would be a lot more efficient instead of loading all the pages set for notifications and then checking to see if the user's id is checked in each page.
Hi,

I think using 'relations' is precisely what is needed in this use case -
Within your notifications template, create a one-to-many relation with the extended-users template; this will allow you to select multiple users for each notification page.

To find out if a user has any notification related to it, we can query through "Enhanced cms:pages tag" as documented here -
viewtopic.php?f=5&t=8581

Does this help?
KK wrote: viewtopic.php?f=5&t=8581

Does this help?


Actually, it does, i never thought of using relations for this as I never tried using db_persist with relations, but, i will try it.

I am using db_persist for it becayse notifications are triggered and sent automatically when another user performs some specific actions on the front-end.

But something like this should work:


Code: Select all
        <cms:db_persist 
        _masterpage=k_template_name
        _page_id=k_page_id
        _mode='edit'
        who="<cms:show who/>,<cms:show k_user_id />"
        />


Thank you for the help.
3 posts Page 1 of 1