Problems, need help? Have a tip or advice? Post it here.
5 posts Page 1 of 1
I have two classes of membership to deal with: ordinary members, and committee members. I'd like to be able to send emails by class of user - so a general email goes to all members, but committee business goes only to committee members.

I'm using Extended Users, and the ordinary members are set as 'authenticated user', committee members are set as 'authenticated user (special)'.

So I need to build a list of email addresses from the list of extended users. This code builds a list of email addresses for all users, adding commas between them:

Code: Select all
<cms:set email_list='' scope='global'/>
<cms:set email_count='0' scope='global'/>
<cms:pages masterpage="users/index.php">
  <cms:if email_count gt '0'>
     <cms:set email_list="<cms:show email_list />," scope='global'/>
  </cms:if>
  <cms:set email_list="<cms:show email_list /> <cms:show extended_user_email />" scope='global'/>
  <cms:set email_count="<cms:add email_count '1' />" scope='global'/>
</cms:pages>


So all I need now is to filter on the access level of the extended user. What field name contains that information?
No field contains that information, unfortunately. Maybe it is a good idea to add this variable. If you also think so please ping @KK about it. Meanwhile some workaround should be invented.

My suggestion is to have all users as 'Authenticated user' and add a custom dropdown - regular user / committee member. Next, filter users by custom_field param - custom_field="role==regular", where 'role' is a name of imaginary dropdown editable. Can you try that?
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
For curious minds, here is a workaround to add access_level info in context of cms:pages tag:

Code: Select all
<cms:pages masterpage=k_user_template>

    <cms:php>
        global $CTX;
        $user = new KUser( $CTX->get('extended_user_id'), 1);
        $CTX->set('extended_user_access_level', $user->access_level);
    </cms:php>

    User <b><cms:show k_page_title /></b><br/>
    Access level: <cms:show extended_user_access_level /><br/>
</cms:pages>



Alternative version with a function:
Code: Select all
<cms:func 'get_access_level' id=''><cms:ignore>

    // Find access level for a given Extended User
    // Sample: <cms:call 'get_access_level' id=extended_user_id />

    </cms:ignore>
    <cms:php>
        global $CTX;
        $extended_user_id = $CTX->get('id');
        if( !$extended_user_id ) return 0;
        $user = new KUser( $extended_user_id, 1);
        echo $user->access_level;
    </cms:php>
</cms:func>


<cms:pages masterpage=k_user_template>
    User <b><cms:show k_page_title /></b><br/>
    Access level: <cms:call 'get_access_level' id=extended_user_id /><br/>
</cms:pages>


Does it help?
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
It certainly does! Thanks, once again, @trendoman.
daldred wrote: It certainly does! Thanks, once again, @trendoman.

Great :)
Say `Please!` [̲̅$̲̅(̲̅ ͡° ͜ʖ ͡°̲̅)̲̅$̲̅]..... Active topics [Forum posts from previous 7 days].... helpcouch@mail.ru [My email for friends]
5 posts Page 1 of 1

Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 5 guests