ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Generate content dynamically based on member group

June 03, 2010 10:44am

Subscribe [2]
  • #1 / Jun 03, 2010 10:44am

    dapacreative

    21 posts

    I have a couple of sections on my site that I would like to dynamically display content based on the member group of the currently logged in user. I plan on setting up categories that correspond to the different member groups to display this information.

    The problem I am having is trying to create some relationship between the member_group id and the category id/name. Maybe there is better way to go about this but I am at a loss.

    Any help would be great.

    Thanks.

  • #2 / Jun 03, 2010 12:15pm

    lebisol

    2234 posts

    You can use a simple condition of:
    {if member_group =='2'}
    In other words…you don’t necessarily need to mirror the cat name = group name just use the condition to build your category parameters....on top of my head:

    {if member_group =='2'}
     {exp:weblog:entries weblog="my_weblog" category="2|7|9"...}
    {/if}
    {if member_group =='7'}
     {exp:weblog:entries weblog="my_weblog" category="12|17|19"...}
    {/if}
      {title}
      {body}
     {/exp:weblog:entries}
  • #3 / Jun 03, 2010 12:19pm

    dapacreative

    21 posts

    I was hoping to avoid doing it this way seeing as I will have 30-40 member groups. That is why I want to build it out dynamically.

  • #4 / Jun 03, 2010 12:25pm

    lebisol

    2234 posts

    Well, this is dynamically 😊
    There has to be some logical trigger…that is set.
    Can you use the logic of if member_group >= 10 or something that will eliminate differentiating each member group? Otherwise, I am afraid you will have to test for as many conditions.

    There was also a plugin that allows you to pull member_id of logged in user that use can use in sql query if you want to write something raw…

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases