Notifications
Clear all

wpForo 1.x.x [Closed] After the login redirect

6 Posts
3 Users
0 Reactions
2,998 Views
Posts: 4
Topic starter
(@johnnydeluxe)
Active Member
Joined: 8 years ago
How can I redirect the user to the start page after login? Not the forum home.
Thanks for the tip!
5 Replies
Robert
Posts: 10590
Admin
(@robert)
Support Team
Joined: 9 years ago

wpForo redirects to the page you were before login. But not after registration and login. This only works for login. There is no way do this for just registered and logged in users.

However if you set forum Registration mode without email confirmation it'll redirect to User Profile page.

Posts: 4
Topic starter
(@johnnydeluxe)
Active Member
Joined: 8 years ago
Hi Robert, thanks for the reply. If I log in now, I see after login / community. I would like to see http: //name.tld. Is that possible?
Robert
Posts: 10590
Admin
(@robert)
Support Team
Joined: 9 years ago

I;m sorry but there is no option to customize redirection after the login.

1 Reply
(@tahtu)
Joined: 5 years ago

Member
Posts: 35

@robert

Is this still actual?

Currently, I'm developing a review system, which allows readers to write their opinion about my WordPress posts. This should be shown as a topic inside wpForo.

So I have a page inside WordPress with a HTML form, which do something on my end and add a topic to wpForo with this:

WPF()->topic->add(['userid'=>..., ...]).

To get the userid, the reader must be logged in. So I would like to forward him to the login of wpForo and get him back after his login.

So I would be happy, if you would provide a redirect, like the WordPress login does it too:

 http://mydomain/wp-login.php?redirect_to=http%3A%2F%2Fmydomain%2Fwp-admin%2F 

Imho, this is not a lot of work, but can be useful for other users too.

If you want, I will find out all needed modifications in your code, that you don't need to waste your time with this.

Posts: 35
(@tahtu)
Member
Joined: 5 years ago

In the meantime, I found out, this is not implemented right now. But you can implement it easily.

For this, there are only a small change inside the file wpf-includes.php/class-actions.php needed.

Currently, the line #376 is this:

if( WPF()->member->options['redirect_url_after_login'] ){

You can replace it with this three lines to implement this feature:

if(isset($_GET['redirect_to']) && $_GET['redirect_to']){
  $redirect_url = $_GET['redirect_to'];
}elseif( WPF()->member->options['redirect_url_after_login'] ){

That's all. If I'm right, there is absolutely no security problem with this code. Additional no other admin will be bothered with this code.

If you implement this, you would make me very happy. I need this really. So if you don't implement it, I have to find another solution to implement this, and handling your further updates as well.

Yesterday, I completed the German language translation and sent it to you via email. That was a lot of work. Maybe you honor my work with this small change for me... 🙄