Notifications
Clear all

Paid Addons Support Forum Only

Please note, that here we only support Paid Addons issues and questions.

gVectors Support staff works from 6am to 6pm (GMT+0)

All questions related to wpForo and wpDiscuz free plugins should be asked in the corresponding plugin support forum:

 

wpDiscuz Support Forum   wpForo Support Forum

Possible to change login link?  

  RSS

ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
23/01/2020 10:09 pm  

Hello, 

 

Is it possible to change the login link to trigger my login popup instead of redirecting to the WP login page?

 

Selection 006

 

Thank you,

 

-Chris


Quote
Tom
 Tom
(@tomson)
Support Team Admin
Joined: 5 years ago
Posts: 3253
24/01/2020 12:40 am  

Hi @chris-reilly,

Please read this support topic: https://wordpress.org/support/topic/change-link-for-login-link-text/


ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
24/01/2020 2:15 am  

Hi Tom,

It kinda sounds like he wants to change the filter after the login url.  How do I change the actual login url?  

For example:

From: https://www.misc-site.com/wp-login.php?redirect_to=misc-link

To: https://www.misc-site.com/register/?type=login?redirect_to=misc-link

I apologize for the noob questions btw. Lots of this stuff is way over my head, but I'm trying to figure it out and learn. 

 Thank you, 

-Chris


ReplyQuote
Tom
 Tom
(@tomson)
Support Team Admin
Joined: 5 years ago
Posts: 3253
25/01/2020 12:27 am  

@chris-r

All is already explained in the topic. He what to do the same and put that code in your active theme functions.php file. Your code should be like this:

add_filter( 'login_url', 'my_login_linkchanger');
function my_login_linkchanger( $link ) {
      return home_url( '/register/?type=login&redirect_to=misc-link' );
}

ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
25/01/2020 4:33 am  

@tomson

Thanks for getting back to me Tom.  What would that last line look like if I wanted it to behave like it currently does?  Like redirect to back to the page they were on before they signed in?  

 

Also, by adding this code, my normal WP login page doesn't change correct?

 

Thank you, 

 

-Chris

This post was modified 8 months ago by ChrisR

ReplyQuote
Tom
 Tom
(@tomson)
Support Team Admin
Joined: 5 years ago
Posts: 3253
25/01/2020 11:21 am  

No, it doesn't affect your original login URL.

Use this code if you want to redirect back afther the login:

add_filter( 'login_url', 'my_login_linkchanger');
function my_login_linkchanger( $link ) {
      global $wp;
       return home_url(  '/register/?type=login&redirect_to=' . urlencode( home_url( $wp->request )  ) );
}

ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
03/02/2020 8:47 pm  

@tomson

 

Hi Tom, 

 

Thanks for clarifying that my original login won't change. 

 

I added the code you provided but I get redirected back to home after logging in.  Is there anyway to redirect the user back to the post they were on prior to logging in, like it did originally?

 

Thank you, 

 

-Chris

 

This post was modified 8 months ago by ChrisR

ReplyQuote
Elvina
(@elvina)
Noble Member Moderator
Joined: 1 year ago
Posts: 1299
04/02/2020 2:58 pm  

@chris-r,

We've just checked on our test website and don't find such an issue. 

It seems there is some plugin that manipulates with the redirected URL. Please deactivate the plugins one by one and check after each deactivation to find a problem maker. 

Another reason: probably the custom page created by theme or the plugin redirect it to the home page immediately and ignore the redirection code provided by us.


ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
04/02/2020 10:37 pm  

@elvina

 

Hi Elvina, 

 

I just googled the last part of the code that Tom gave me and I found the link below.  

 

https://codex.wordpress.org/Function_Reference/home_url

 

The original code that Tom posted didn't have the following code: . urlencode( home_url( $wp->request )  )

 

Based off of that link, that code suggests that the home_url would send the user back to the home page. 

 

Is this incorrect?

 

-Chris

 


ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
04/02/2020 11:16 pm  

Hello Elvina, 

 

I just played with it a bit and you're right.  The code does appear to be correct.  When looking at the url after clicking the login button, it does in fact show the previous pages url, BUT, the url isn't displaying correctly. 

It appears like this:

Could this be why it's falling back to the home url?

 

Thank you,

-Chris

This post was modified 8 months ago 2 times by ChrisR

ReplyQuote
Elvina
(@elvina)
Noble Member Moderator
Joined: 1 year ago
Posts: 1299
05/02/2020 1:59 pm  

@chris-r,

This is not the issue, please don't worry about this.

 


ReplyQuote
ChrisR
(@chris-r)
Member Customer
Joined: 11 months ago
Posts: 53
05/02/2020 9:38 pm  

@elvina

 

Okay will do.  I'll start disabling plugins like you've suggested and go from there.  

 

Thank you,

-Chris

 


ReplyQuote
Share:
Scroll to top
0

Your Cart