7 Replies Latest reply on Aug 10, 2007 8:14 PM by (Daniel_O)

    Passing URL variable on login redirect

      I first want to say thank you for all the great help I have received on these forums over the past couple months - it has been very helpful and saved me countless days.

      Saying that, I do have another problem. I would like to pass a URL variable to the success redirect page when users login. I want to have a recordset on the login page that retrieves an issueid for the most current article and then passes it on the URL to the page that is loaded when a user successfully logins. I have tried adding the recordset to the login page and then changing the URL for the successful redirect on the tNG_config.inc.php file to:

      $tNG_login_config_redirect_success["5"] = 'dashboard_issue.php?issueid=' . $currentIssueId . '';

      but it isn't working. I have a tried as many variations of that syntax as I could think of or find searching online but still no luck. There might be a much easier way to do this but the way the dashboard_issue page is set up is that it is looking for the issueid in the url. The benefit being that the same page can be used for any issue that the user wants to change to once he is logged in.

      I hope this is making some sense. If not please let me know.
      Thanks!

      -Dan
        • 1. Re: Passing URL variable on login redirect
          Günter Schenk Level 4
          Hi Dan,

          it *might* well be that this isn´t supported on login pages - I´m not sure, but...

          >>
          the page that is loaded when a user successfully logins
          >>

          why don´t you simply display the most current article on *that* page, means create the recordset there ?

          Günter Schenk,
          Adobe Community Expert, Dreamweaver
          • 2. Re: Passing URL variable on login redirect
            Level 1
            I originally did create the recordset on the result page but then ran into trouble reusing that same page when I wanted to switch to view different issues since none of the code was based on recordsets looking for a URL variable. Perhaps there is a way to use the URL issueid variable and that recordset and if there is none, then use the next issue recordset that I specify. Though I am not exactly sure how I would go about implementing that.
            • 3. Re: Passing URL variable on login redirect
              Günter Schenk Level 4
              well,

              if I get it right, your "most current issue" will be the latest one submitted to the database, correct ? If yes, a query like...

              SELECT * FROM issue_table ORDER BY issueid DESC LIMIT 1

              ...*will* always display the most recent record, and this will free you from having to pass variables via URL parameter.

              would that help ?

              Günter Schenk,
              Adobe Community Expert, Dreamweaver
              • 4. Re: Passing URL variable on login redirect
                Level 1
                The most current issue is actually just the one that is closest to today's date in the future. Users are free to add as many issues as they want in the past and future so I really can't go by issueid to sort since it might come in any order. Right now I have the most current issue found with this query:

                SELECT issueid, DATE_FORMAT(date, '%W, %M %d, %Y') 'date' FROM issues WHERE date >= CURDATE() LIMIT 0,1

                I will try to explain the problem a little more. This works great for what I need to do for this page as soon as they log in since it doesn't even look at the URL at all. If a user wants to go to a different issue I display a different page (which is this page just renamed) where the recordset looks at the URL issueid variable instead of the most recent issue recordset. The problem with this setup is that it is hard to maintain 2 pages all the time and would be great if I can just have one page to handle everything.

                Is it possible to do something like this?:

                IF issueid url variable EXISTS THEN use recordset1
                IF issueid url variable DOES NOT EXISTS use recordset2

                with recordset1 being the one that grabs the most current issue and recordset2 being the one that pulls the issue information based on the url issueid.
                • 5. Re: Passing URL variable on login redirect
                  Günter Schenk Level 4
                  >>
                  IF issueid url variable EXISTS THEN use recordset1
                  IF issueid url variable DOES NOT EXISTS use recordset2
                  >>

                  DW itself regretfully doesn´t support switching between 2 recordsets -- you could always code something like that manually, but it may well be that DW doesn´t recognize e.g. a query any more and shows an exclamation mark or even deletes the recordset from the panels.

                  I think the most "DW friendly" approach would be to indeed prepare the two recordset alternatives and then apply ADDT´s "Show If Conditional Region" behaviour to a certain "dynamic text" instance, and here switch between the possible alternatives like this:

                  IF
                  isset($_GET['issueid']) (an "advanced" condition checking the variable´s existance)
                  ..display "dynamic text" related to recordset 1
                  HAS ELSE
                  ..display "dynamic text" related to recordset 2

                  Günter Schenk,
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Passing URL variable on login redirect
                    Level 1
                    Thanks Günter - I will probably have to do it that way. Just one more thing I thought of that would save me a lot of time. Is there a way to give up the ability to have different successful login targets based on the user level and just override the page with a link that includes the URL variable? So no matter who logs in if it is successful it will go to dashboard.php?issueid=1 for example?
                    Thanks for all your help,
                    -Dan
                    • 7. Re: Passing URL variable on login redirect
                      Level 1
                      ::bump::
                      Just wondering, does anyone knows if it is possible to override all login redirect preferences to be able to include a URL parameter?
                      Thanks!