How to set "redirect" value
Posted by aji
|
How to set "redirect" value August 16, 2006 08:37PM |
Registered: 19 years ago Posts: 4 |
Hey there,
I just came accross PHORUM a few days ago, and I must say I'm rather impressed. It is the perfect tool for my current project!
Similar to this post [www.phorum.org] I am integrating the forum with a web site, but I have a different take as I thought it would actually be easier to use the PHORUM login sequence anyways since I wouldn't have to worry about setting the session cookie for Phorum (by letting Phorum take care of that).
So my take was to simpy change the redirect which is embeded in the login form.
Now, I realized I can't embed PHP into the template, as it doesn't seem to get parsed.
I guess what I am trying to find out is how to change/set the value of the redir field in the login template.
Again, first I thought to simply add PHP code to the template, something like
But that didn't seem to work. Is there any other way which would work better? When I "hardcode" my URL, it works like a dream, but that of course is impractical.
Where is {LOGIN->redir} being defined?
I thought once I know where, I could then try to figure out how to set it when called from a page from my web site (= outside of Phorum)
Any help is greatly appreaciated.
Anurag
PS: I don't think it is relevant information, but I am running PHP 5.1.2
I just came accross PHORUM a few days ago, and I must say I'm rather impressed. It is the perfect tool for my current project!
Similar to this post [www.phorum.org] I am integrating the forum with a web site, but I have a different take as I thought it would actually be easier to use the PHORUM login sequence anyways since I wouldn't have to worry about setting the session cookie for Phorum (by letting Phorum take care of that).
So my take was to simpy change the redirect which is embeded in the login form.
Now, I realized I can't embed PHP into the template, as it doesn't seem to get parsed.
I guess what I am trying to find out is how to change/set the value of the redir field in the login template.
<input type="hidden" name="redir" value="{LOGIN->redir}" />
Again, first I thought to simply add PHP code to the template, something like
value="<?php if(isset($_GET['myownredirect'])
{
if ($_GET['myownredirect']=='foo')
echo "my/url/path";
} else
{
echo '{LOGIN->redir}'
} ?>" />
But that didn't seem to work. Is there any other way which would work better? When I "hardcode" my URL, it works like a dream, but that of course is impractical.
Where is {LOGIN->redir} being defined?
I thought once I know where, I could then try to figure out how to set it when called from a page from my web site (= outside of Phorum)
Any help is greatly appreaciated.
Anurag
PS: I don't think it is relevant information, but I am running PHP 5.1.2
|
August 17, 2006 12:31AM |
Admin Registered: 24 years ago Posts: 4,495 |
Quote
aji
So my take was to simpy change the redirect which is embeded in the login form. Now, I realized I can't embed PHP into the template, as it doesn't seem to get parsed.
Ah, but you can. PHP is allowed fully in the templates.
redir will be set based on the page that sends the user to the login page. Its purpose is to send them back to where they were.
Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Edited 1 time(s). Last edit at 08/17/2006 12:32AM by brianlmoon.
|
Re: How to set "redirect" value August 17, 2006 03:38PM |
Registered: 19 years ago Posts: 4 |
Funny that it didn't work to add the php code in the login.tpl page.
I'll try again...
Was my method correct?
Question:
How does that work in detail? Bec, I could use same method in order to redirect back to my page...
Aji
--
Why not?
Edited 3 time(s). Last edit at 08/17/2006 03:42PM by aji.
I'll try again...
Was my method correct?
value="<?php if(isset($_GET['myownredirect'])
{
if ($_GET['myownredirect']=='foo')
echo "my/url/path";
} else
{
echo '{LOGIN->redir}';
} ?>" />
Question:
Quote
redir will be set based on the page that sends the user to the login page. Its purpose is to send them back to where they were.
How does that work in detail? Bec, I could use same method in order to redirect back to my page...
Aji
--
Why not?
Edited 3 time(s). Last edit at 08/17/2006 03:42PM by aji.
|
August 17, 2006 06:23PM |
Admin Registered: 24 years ago Posts: 4,495 |
YOu can't echo {LOGING->redir}. You will need to stay with PHP there. $PHORUM["DATA"]["LOGIN"]["redir"].
Brian - Cowboy Ninja Coder - Personal Blog - Twitter
|
Re: How to set "redirect" value August 18, 2006 12:11AM |
Registered: 19 years ago Posts: 4 |
|
Re: How to set "redirect" value October 18, 2006 06:45PM |
Registered: 19 years ago Posts: 1 |
It sounds like I am trying to do exactly the same thing as above ... I basically have a non-forum page that I want users to be able to access, but before seeing it first they must log in (I was trying to conveniently use the forum loggin page and then redirect them).
From what i gathered above it seemed like something like this might work:
I am sending the GET string right:
I have had absoluty no luck ... I can't even figure out how to hard code the value to get it to redirect. It just goes straight to the page where I tried to log in from. Anyone who can offer me any advice/help it would be most greatly appricated!!
From what i gathered above it seemed like something like this might work:
<input type="hidden" name="redir" value="<?php if(isset($_GET['myownredirect']))
{
if ($_GET['myownredirect']=='foo')
echo "[this_is_a_test.com"];;
} else
{
echo '$PHORUM["DATA"]["LOGIN"]["redir"]'
} ?>" />
I am sending the GET string right:
[mydomain]
I have had absoluty no luck ... I can't even figure out how to hard code the value to get it to redirect. It just goes straight to the page where I tried to log in from. Anyone who can offer me any advice/help it would be most greatly appricated!!
|
Re: How to set "redirect" value February 13, 2007 07:37AM |
Registered: 19 years ago Posts: 70 |
I have the same problem,
It worked for me to redirect to 'myownredirect=foo' but the $PHORUM["DATA"]["LOGIN"]["redir"] doesn't work it'll be jsut simply spit out as $PHORUM["DATA"]["LOGIN"]["redir"] and not as url in the HTML code.
Tino
Discover the Divine Truth | [www.discoverthedivinetruth.com]
It worked for me to redirect to 'myownredirect=foo' but the $PHORUM["DATA"]["LOGIN"]["redir"] doesn't work it'll be jsut simply spit out as $PHORUM["DATA"]["LOGIN"]["redir"] and not as url in the HTML code.
Tino
Discover the Divine Truth | [www.discoverthedivinetruth.com]
|
Re: How to set "redirect" value February 13, 2007 09:33AM |
Registered: 20 years ago Posts: 340 |
I believe that you would need to write a little module that would set up the custom redirect.
From the login program
// By default, we redirect to the list page.
// The hook "after_login" can be used by module writers to
// set a custom redirect URL.
$redir =phorum_hook( "after_login", $redir );
From the login program
// By default, we redirect to the list page.
// The hook "after_login" can be used by module writers to
// set a custom redirect URL.
$redir =phorum_hook( "after_login", $redir );
|
February 13, 2007 09:47AM |
Admin Registered: 21 years ago Posts: 8,532 |
Looking at the code above, it says:
The correct syntax to use would be:
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
echo '$PHORUM["DATA"]["LOGIN"]["redir"]'This is exactly the code that you need for spitting out that variable's name instead of its contents. Loose the single quotes to make PHP print the contents of the variable.
The correct syntax to use would be:
<input type="hidden" name="redir" value="<?php if(isset($_GET['myownredirect']))
{
if ($_GET['myownredirect']=='foo')
echo "[this_is_a_test.com"];;
} else {
echo $PHORUM["DATA"]["LOGIN"]["redir"];
} ?>" />
Maurice Makaay
Phorum Development Team
my blog
linkedin profile
secret sauce
|
Re: How to set "redirect" value February 13, 2007 11:27AM |
Registered: 19 years ago Posts: 70 |
Maurice thanks a lot that did the trick for me except I removed the if(isset($_GET and if($_GET
honestly don't even knnow what theyare there for. The page I'm using the people come from a simple link and not a form not sure if I needed it, it didn't work anyway so I removed it.
mine looks like:
that works perfectly - link would be [yoursite.com]
thanks for all the help
Tino
Discover the Divine Truth | [www.discoverthedivinetruth.com]
Edited 1 time(s). Last edit at 02/13/2007 11:28AM by DonTino.
honestly don't even knnow what theyare there for. The page I'm using the people come from a simple link and not a form not sure if I needed it, it didn't work anyway so I removed it.
mine looks like:
<input type="hidden" name="redir" value="<?php
if ($myownredirect=='foo')
{
echo "[this_is_a_test.com"];;
} else {
echo $PHORUM["DATA"]["LOGIN"]["redir"];
} ?>" />
that works perfectly - link would be [yoursite.com]
thanks for all the help
Tino
Discover the Divine Truth | [www.discoverthedivinetruth.com]
Edited 1 time(s). Last edit at 02/13/2007 11:28AM by DonTino.
Sorry, only registered users may post in this forum.
