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.

Displaying different entries for different member groups

July 06, 2007 6:59am

Subscribe [3]
  • #1 / Jul 06, 2007 6:59am

    lithiumdave

    215 posts

    Forgive me if this is a bit of a no-brainer.  I’ve read several posts that might be related to this issue but none that really answer the question.  I’ll try to explain…

    I’m building a site that has a product catalogue.  Each product is a weblog entry in the ‘products’ weblog. Simple so far.

    The client has several different ‘groups’ of customers that will need to log-in to view the catalogue - currently there are only 3 different such groups, but there may be more in future. Ease of setting up new groups in future is fairly important. I’m thinking that your standard member groups will handle this nicely, on the face of it at least.

    However, the client needs to be able to give permission, on a ‘per-entry’ basis, for which member group can see each product.  For example:

    Product A

    Can be seen by group 1 and 2

    Product B

    Can be seen by group 2 only

    Product C

    Can be seen by groups 1, 2 and 3

    etc.  So then when, say, a member of group 2 logs in, the display of products they see will be anything designated as ‘viewable by group 2’ - in this example, all 3 products.

    You get the idea!

    Ordinarily I’d simply go with categories for this, with each ‘group’ being a category - easy to assign categories to a weblog entry. However, the bit I can’t get my head around is how that would tie in with member groups so that each group would only see entries viewable by them.

    Any help appreciated!  Many thanks : )

  • #2 / Jul 09, 2007 4:46am

    lithiumdave

    215 posts

    B-b-b-bump 😊

  • #3 / Jul 09, 2007 10:15am

    PXLated

    1800 posts

    If you used categories you could use conditionals to determine which products show…

    [if member_group == “1” OR member_group == “2”}
    {exp:weblog:entries weblog="products" category="1"}
    [if:elseif member_group == “2”}
    {exp:weblog:entries weblog="products" category="2"}
    [if:else}
    {exp:weblog:entries weblog="products" category="3"}
    {/if}

    Would that type of thing work?

  • #4 / Jul 09, 2007 10:29am

    PXLated

    1800 posts

    Not sure about my previous suggestion, needs some futher thought…this looks better…

    [if member_group == “1”}
    {exp:weblog:entries weblog="products" category="1|3"}
    [if:elseif member_group == “2”}
    {exp:weblog:entries weblog="products" category="1|2|3"}
    [if:elseif member_group == “3”}
    {exp:weblog:entries weblog="products" category="3"}
    {/if}

    Would that work?

  • #5 / Jul 10, 2007 4:48am

    lithiumdave

    215 posts

    Hi PXLated - yes, I think the 2nd suggestion would definitely work.  There aren’t likely to be too many member groups in the end anyway, so that would work perfectly.  I suppose I could also use a dropdown custom field instead of categories, and use Mark Huot’s ‘custom field as parameter’ extension to do the same thing.

    A simple solution that I just couldn’t see : )

    Thanks for your time, much appreciated!

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

ExpressionEngine News!

#eecms, #events, #releases