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.

Switch privileges with click of a button

June 20, 2011 3:05pm

Subscribe [3]
  • #1 / Jun 20, 2011 3:05pm

    Victoriaz

    19 posts

    Hi

    I am setting up a site where members will have two type of options. One where they will see detailed contents and another one where they will see basic contents.

    There will be a simple radio button to switch between options. Their choice will have to be stored during their entire visit or until they click on the button again.

    Would I need some sort of session to remember the choice, if so how do I create one? Or is there a simpler way to set this up?

    Thanks

  • #2 / Jun 21, 2011 7:02am

    John Henry Donovan

    12339 posts

    Victoriaz,

    To confirm. This is a choice your visitor makes and not you the admin?

    If the visitor, then definitely go down the session route if you need it remembered for a short length of time or a cookie if longer. There is a session add-on available here or a few cookie add-ons hereif you wish that choice to be remembered longer

    This is more of a how to question so moving to Community Help forums for you

  • #3 / Jun 21, 2011 8:15am

    Kernon

    173 posts

    Yes, you could store a session variable, see Session plug-in, but you could also have a custom member profile field.  The later would enable the choice to stay across logins.  You could also use a cookie, which could also be set up to persist.

    A potential nice thing about a custom profile field is that you could then allow people to edit (update) that choice in the regular member profile area, which would be convenient, especially if members are already used to going there to update other things.

  • #4 / Jun 21, 2011 11:38am

    Victoriaz

    19 posts

    I believe it would be better for stats purposes to make a custom member profile field.
    I am therefore thinking of making a new Member Group and depending on their choice the member’s group ID gets updated. Would that be right? If so, how do I write SQL statements on my EE templates.

    Thanks

  • #5 / Jun 21, 2011 11:51am

    Kernon

    173 posts

    I don’t know if managing two user groups makes sense or not in your context.

    If the only difference between the two types of users is detailed versus not detailed output, and if you want members to be able to switch between these on their own, my first reaction is that user groups is not necessary.  It’s possible to use conditionals on custom member profile fields, which would enable you to control the output displayed.

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

ExpressionEngine News!

#eecms, #events, #releases