vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Redirect pages with login forms on them to a custom URL? (https://vborg.vbsupport.ru/showthread.php?t=294851)

HouseAddict 02-07-2013 07:55 AM

Redirect pages with login forms on them to a custom URL?
 
How would I redirect those STANDARD_ERROR pages with login forms on them to a custom login URL easily? I am just using a 3rd party login script instead (that sets all the necessary vB cookies).

Is there a way through the Plugin Manager or something, tying some sort of an action to vB and redirecting it all to a custom URL?

Anyone have a clue what/where/how?

Thanks!

kh99 02-07-2013 10:33 AM

You could try something like this: create a new plugin using hook location error_nopermission and code like this:

Code:

if ($vbulletin->userinfo['userid'] == 0)
{
  $vbulletin->url = login url;
  print_standard_redirect('nopermission_loggedin'); 
}


Obviously you want to put in your actual URL. Also, nopermission_loggedin is a phrase that kind of says what you want. You can create a phrase that says exactly what you want, but the print_standard_redirect() function will normally use a redirect so that users won't see that message. If you want to force users to see the message (the function will use a different method of redirect that will show the message for a few seconds beforehand) then you can change the parameters of print_standard_redirect(), like:

Code:

  print_standard_redirect('nopermission_loggedin', true, true);

Another approach might be to find the phrase that includes the login fields (the phrase varname is "not_logged_in_fill_in_form"), and change it to have a message like "click on this link to go to the login page" (and put in a link, of course).

HouseAddict 02-08-2013 12:52 AM

nice! that worked! thanks.

now, how would you (if possible at all) add the current URL you're on into that redirect url?

so, for example, the user is trying to leave a reply on /forum/showthread.php?10-ABC

and I want that $vbulletin->url to point to "/login?redirect=/forum/showthread.php?10-ABC" ??

just so they get back to the same URL they came to the login form from?

possible?

kh99 02-08-2013 03:02 AM

You could try:

Code:

$vbulletin->url = '/login?redirect=' . urlencode($vbulletin->url);

HouseAddict 02-08-2013 06:36 AM

awesome!

that's exactly it.

thank you so much.

bookmarking this thread for future reference.


All times are GMT. The time now is 05:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01117 seconds
  • Memory Usage 1,716KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete