How to Redirect?
#1
Question 
Dear all
i need a way to redirect users to rules page for first time i know these hooks:
  993     member_login
  1000    member_do_login_start
  1026    member_do_login_end

but i don't know how can i Redirect them.
could you please give me an idea.
regards.
Reply
#2
You might want to consider the mod that PMs a new member when they join...you can PM them a welcome along with rules. Easy to do.
Reply
#3
There are 2 other ways..
1st is to display the rules or a link to them in the registration agreement or the after registration message.

2nd way is to edit member.php

find

redirect("index.php", $lang->redirect_accountactivated);
redirect("index.php", $lang->redirect_registered);
in both change index.php to the page you want.

regards
Reply
#4
is it possbiel to redirect them to go to a different site when clicked on a particular topic or a thread.

for example. i have a "buy/sell/rent" thread, but i want to redirect them to a different part of the site. is that possible?
Reply
#5
Sure you can

Just replace index.php with the full URL of the other site.
Reply
#6
He means like if they click on a specific thread, can they be redirected.

Yes, you can do that, but it would be easier to make a forum link in the AdminCP instead since that function is built in. The only way I can think of to turn a specific thread into a redirect would be to open global.php and right after the copyright info add

if ($_GET[tid] == xxx)
{
header("Location:  http://www.somesite.com");
}
Replace xxx with the tid of the thread you want to be a redirect and replace "somesite.com" with the URL you want to redirect to.

That's a quick and dirty method, off the top of my head. Of course, I'm running on no sleep and not very clear headed, so there's probably a better way of doing that. Even if there isn't, I'd still recommend creating a forum link instead of messing with the code to turn a thread into a redirect like that. But that's what you wanted to know so there it is. Smile
Reply
#7
MadamZuZu Wrote:is it possbiel to redirect them to go to a different site when clicked on a particular topic or a thread.

for example. i have a "buy/sell/rent" thread, but i want to redirect them to a different part of the site. is that possible?

Galen Wrote:He means like if they click on a specific thread, can they be redirected.

LOL correct. DO i have eyes:O?


Quote:Yes, you can do that, but it would be easier to make a forum link in the AdminCP instead since that function is built in
Let's be more specific, in Admin CP > Forum Management >  Manage Forums  > Edit

There you will find something called Forum Link whatever link you put there will be the redirection link when you click on that forum in the forums lists.

Quote:The only way I can think of to turn a specific thread into a redirect would be to open global.php and right after the copyright info add



PHP Code:

if ($_GET[tid] == xxx)
{
header("Location:  http://www.somesite.com");
}

Replace xxx with the tid of the thread you want to be a redirect and replace "somesite.com" with the URL you want to redirect to.

The concept of redirecting threads this way is so rule of thumb... i know that this might work for now.. but it is not nice to always go and edit the file with every thread we need it to have redirection. Of course this should be a complete plugin, that adds a redirection field to new thread page.

But anyway for now let's stick on the manual way.

Don't use $_GET in mybb use MyBB function. and it is better not to put this thing in the global, this is if it works.

To do thread redirection do the following

open showthread.php

Find
// Get the thread details from the database.
$options = array(
	"limit" => 1
);

Above it add

if($mybb->input['tid'] == X)
{
	redirect('http://www.thetechex.net', "You will now be redirected");
}

Replace X manually by the tid of the thread.
I have used the redirect function as this will also show a redirection message to the user, therefore nicerToungueRolleyes
Reply
#8
See? Told ya there was probably a better way to do it Smile
Reply
#9
FYI- If you are going to make custom code changes to core files remember to keep a log of all changes. This will help you immensely on upgrading. Just a helpful tidbit I wish I did when I used to change core files which I now no longer do.
Reply
#10
Hey Guys I was searching for redirection topics and I Came across this one..

I opened a gallery in coppermine on my forum and i have a link to it in one of my child forums with a direct link to the coppermine gallery.
I want to be able to know how many people click that link to go to the gallery. I seen someone has a "redirect Hits Counter" in the child forum where now i have a -.
What is the code for the redirect Hits that will be where the threads usually are..

Thanks..
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)