HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Showing secondary usergroups on the member profile view screen

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#29125 (In Topic #6683)
Avatar

Here's a modification to show secondary usergroup membership for users being viewed (OCF). It'll be included in the next patch release…

Change line 94 of OCF_MEMBER_PROFILE_PAGE.tpl from:

Code

      {+START,IF_NON_EMPTY,{GALLERIES}}
to:

Code

      {+START,IF_ARRAY_NON_EMPTY,SECONDARY_GROUPS}
         <h2>{!SECONDARY_GROUP_MEMBERSHIP}</h2>

         <p>{!_SECONDARY_GROUP_MEMBERSHIP,{USERNAME*}}</p>
         <ul>
         {+START,LOOP,SECONDARY_GROUPS}
            <li><a href="{$PAGE_LINK*,_SEARCH:groups:view:{loop_key}}">{loop_var*}</a></li>
         {+END}
         </ul>
      {+END}

      {+START,IF_NON_EMPTY,{GALLERIES}}

Add this to the bottom of ocf.ini:

Code

SECONDARY_GROUP_MEMBERSHIP=Additional usergroup membership
_SECONDARY_GROUP_MEMBERSHIP={1} is also a member of the following secondary usergroups:

Change line 375 of site/pages/modules/members.php from:

Code

               'ACTIONS_content'=>$actions['content'],
to:

Code

               'ACTIONS_content'=>$actions['content'],
               'USERNAME'=>$username,
               'SECONDARY_GROUPS'=>$secondary_groups,

Change line 344 of the same file from:

Code

      return do_template('OCF_MEMBER_PROFILE_PAGE',
to:

Code

      $secondary_groups=ocf_get_members_groups($member_id);
      unset($secondary_groups[$primary_group_id]);
      if (count($secondary_groups)>0)
      {
         $_secondary_groups=array();
         $all_groups=$GLOBALS['FORUM_DRIVER']->get_usergroup_list();
         foreach (array_keys($secondary_groups) as $key)
         {
            $_secondary_groups[$key]=$all_groups[$key];
         }
         $secondary_groups=$_secondary_groups;
      }

      return do_template('OCF_MEMBER_PROFILE_PAGE',


Last edit: by Chris Graham


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: