vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I make login.php go to my vBadvanced home page, rather than to the forums? (https://vborg.vbsupport.ru/showthread.php?t=158321)

trgreen 09-20-2007 09:38 PM

How do I make login.php go to my vBadvanced home page, rather than to the forums?
 
When people log in, they are taken to my forums: http://www.example.com/forums/

I just realized that they might not ever see the home page that is at: http://www.example.com/ (which is my vBadvanced home page)

How can I get login.php to always go to the vBadvanced home page instead of the forums? I looked in the code, and it looked like I could easily break it. I'm okay in PHP, but certainly not an expert.

I also tried changing the 'forumhome' variable in the vB settings, but of course that broke all kind of stuff. Any help appreciated!

Dismounted 09-21-2007 05:22 AM

You need to set $vbulletin->url to your home page before the redirect is called. THis can be achieved using plugins.

trgreen 09-21-2007 05:23 AM

Thanks for responding! Can you elaborate just a little bit?

Dismounted 09-21-2007 05:43 AM

Set $vbulletin->url to the URL. The hook should be login_redirect.

trgreen 09-21-2007 05:51 AM

Thank you very much! I had no idea it was that easy to make a plug-in.

too_cool_3 10-17-2007 10:44 AM

After following the instructions given here by the thread starter:

http://www.vbadvanced.com/forum/show...692#post126692
Quote:

Originally Posted by trgreen (Post 124445)
I got some help over at vbulletin.org. Turns out you have to make a plugin. Here's the thread: https://vborg.vbsupport.ru/showthrea...31#post1343631

But here's how you do it... it's pretty easy:

1. In Admin, click "Add New Plugin" under the "Plugins & Products" menu
2. For "Product" choose vBulletin
3. For "Hook Location" choose "Login Redirect" under "vBulletin: Login / Logout" - It's basically in alphabetical order. Look for the "L" part of the list.
4. Enter a Title, whatever you want, like "Login redirect to vBadvanced home page"
5. For "Execution Order" I just left it at 5. They all seem to be 5.
6. For "Plugin PHP Code" here's the code. Just use the URL you want it to go to after they log in.
Code:

$vbulletin->url = 'http://yourhomepage.com';

7. BE sure to check "Yes" under "Plugin is Active." It defaults to "No."
8. Click "Save"

Note: This will work, but it makes it a little strange when you login to the Admin CP. For example: I right-click "Admin" and open it in a new Tab. When you login to get to the Admin CP, it will open your site in the "main" frame. Thats okay... just choose the link you want on the left. That's it.



I started experiencing this problem described in the Note: as well.. even when i left click it brings up the admincp login page but after i input my info it brings me right back to the mainpage?!?
Then i have to click admincp again and it will then go to the admincp. This is getting really annoying, anyway to fix it?

Opserty 10-17-2007 12:11 PM

Quote:

Originally Posted by too_cool_3 (Post 1362237)
Then i have to click admincp again and it will then go to the admincp. This is getting really annoying, anyway to fix it?

Just a quick guess but what about if you wrap it in an if() statement to check the current setting?
E.g.
PHP Code:

if($vbulletin->url != $vbulletin->options['bburl'].'/admincp/index.php')
{
    
// $vbulletin->url...


That probably won't work but you could maybe run some testing or something and see if you can get it to work.

trgreen 10-17-2007 03:52 PM

I agree. It's definitely annoying, but really it's just a few extra clicks. Worth it in my mind to make sure your users see your vBa home page. Has anyone tried the recommended fix above? I'd be curious to know if it works.

too_cool_3 10-17-2007 06:33 PM

I'll give it a shot in a couple hours after my classes r done. Gotta run to my Networking Essentials class, I'll post back once I've tried it :up:

--------------- Added 17 Oct 2007 at 17:46 ---------------

I just tried using this code:

if($vbulletin->url != 'http://www.tbaec.ca';
$vbulletin->options['bburl'].'/admincp/index.php')
{
// $vbulletin->url = 'http://www.tbaec.ca';
}

...and yes, it worked! BUT... every time I loged into an account I get this ERROR at the top of the page:


Parse error: parse error, unexpected ';' in /home/content/b/i/g/bigsac/html/includes/functions_login.php(312) : eval()'d code on line 1

So then I tried this code:

if($vbulletin->url != $vbulletin->options['bburl'].'/admincp/index.php')
{
// $vbulletin->url = 'http://www.tbaec.ca';
}

and IT WORKED PERFECT!!!...
Enjoy!
p.s. Thx Opserty for providing the original code ;)

trgreen, you should now update your thread over at vbadvanced.com(http://www.vbadvanced.com/forum/show...692#post126692) to reflect the new code and maybe put a note in the first post of this thread, as to avoid other people having a problem with their admincp... hope this code is as helpfull to you as it was me in solving that annoying issue. :cool:


All times are GMT. The time now is 02:41 AM.

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.01007 seconds
  • Memory Usage 1,738KB
  • 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
  • (1)bbcode_code_printable
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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