2 Replies Latest reply on Oct 10, 2008 9:54 PM by 921creative

    Session Variables

      I'm trying to understand this and it's probably very simple...

      I want to show a page with information that is specific to both 1) the user who is logged in and 2) the group to which he belongs.

      I know that I can use kt_login_id as a session variable for the user's information. Can I, on the same page at the same time, use another session variable for the group information? Where do I register this variable and do I simply set it within a new recordset?

      Thanks for any clarification you can give me!
        • 1. Re: Session Variables
          Günter Schenk Level 4

          Where do I register this variable

          I´d define a new global session variable in ADDT´s Control panel and name it, say, "user_group" -- like all other default session variables it will be available whereevr you need it.

          Can I, on the same page at the same time, use another session variable for the group information?

          Let´s assume you´d like to display a certain page segment to a user who´s logged in *and* has the "user_group" session value of 2:

          1. wrap this segment in a "Show IF Conditional Region" behaviour which checks if ADDT´s default session variable "kt_login_id" is set

          2. switch to Code View and append a second condition which checks the "user_group" session value, e.g. $_SESSION['user_group'] == "2"

          In order to make this a combined condition, you´ll need to concatenate both individual conditions with "&&", what should read like this:

          if (isset($_SESSION['kt_login_id']) && $_SESSION['user_group'] == "2")

          Works ?

          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Session Variables
            921creative Level 1
            This solution works great if each user only belongs to one group. However, each user could potentially belong to any number of different groups, each with different IDs. What I need is for the group page being displayed to only show content for the group that the user wants to view based on a link he clicks on a page of his groups. Therefore, the user_group session variable would be different depending on which group he clicks. I can obviously create a recordset on the group page that says group_id = kt_user_group (session variable). However, on the list of the user's groups, I need to somehow make the group names link to the group page with the correct session variable loaded. How would I do that? Does this make sense? I don't want to use a URL parameter to display the group page because I don't want users to be able to jump to any group that they're not a member of.