Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2012, 01:11 PM
firebrand media firebrand media is offline
 
Join Date: Apr 2012
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Force All Guests to a Custom Login

I see this question asked many times for vBulletin4.x, but I can't find clear answers.
We're building a site that is a totally closed community. All guests must login through a page with ONLY the login fields.
The login page cannot display the regular site navigation.

It's OK if the error handling goes to the regular login, but it would be preferred if we could do that on a screen without the navigation as well.

So I need three things:
1) How to force all guests to the custom login screen.
I tried this into global_start:
Code:
if ($vbulletin->userinfo['usergroupid'] == 1)
{
$templater = vB_Template::create('my_custom_login');
print_output( $templater->render());
}
It shows my custom login template to guests, but logged in users don't get stylesheets.
I also tried a version that does a Location (also on global_start)
Code:
$vbulletin->url = $thisserverprotocol.$_SERVER['SERVER_NAME'].'/xlogin.html';
But that didn't work at all.


1a) What's the best way to check for non-logged in users?
1b) If I want to do location:, where should I hook?


2) How to submit that login form to vBulletin
I got a form to work by copying the rendered html from the cpanel login, and modifying the paths.
But that's bringing in a bunch of JavaScript seems like overkill. Is there a simple way to have a form submit to login?

3) An abbreviated custom registration form.
The email address will be passed in the URL, so I'll just have them fill in a handle and password.
I can write a record to the DB myself, but i"m sure there's a nice call I can make to create a user.
Could someone point me in the right direction?

These are the final features needed for this site, and need to be resolved ASAP.
Any help is appreciated.
Reply With Quote
  #2  
Old 06-04-2012, 01:32 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know if this is the best way, but you might try using your global_start plugin but surround the code with:

Code:
if (!defined('SKIP_SESSIONCREATE'))
{
// code here
}
I don't know how you'd use location:.


I think a form like this should work:

Code:
<form action="login.php" method="post">
<input type="hidden" name="do" value="login">
<input type="text" name="vb_login_username">
<input type="text" name="vb_login_password">
</form>

(obviously that's simplified and you'd want some formatting). If you want to send the password as an md5 hash (which vb noramally does) then you'd need to include some javascript.
Reply With Quote
  #3  
Old 06-04-2012, 04:11 PM
firebrand media firebrand media is offline
 
Join Date: Apr 2012
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks so much kh99.
The simplified login form worked fine.
Just had to add a hidden field to prevent it from coming back to the login form:

Code:
<input type="hidden" name="url" value="/homepage.php">
--------------- Added [DATE]1338847450[/DATE] at [TIME]1338847450[/TIME] ---------------

Moving the hook to global_state_check solved my problem with the vanishing CSS.
Moving the form from the external HTML page to the template is causing some wackiness in that I think we're intercepting the processing at login.php and showing the login template.

I tried incorporating the SKIP_SESSIONCREATE, but that didn't seem to help.
Anyone have further thoughts?
Reply With Quote
  #4  
Old 06-07-2012, 01:22 PM
firebrand media firebrand media is offline
 
Join Date: Apr 2012
Posts: 28
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm oh so close.

Created a plugin hooked on global_state_check

Code:
if ($vbulletin->userinfo['usergroupid'] == 1)
{
  if ((THIS_SCRIPT == 'login') or ($_POST['do'] == 'login'))
  {
  
  } else {
  $templater = vB_Template::create('custom_login');
  print_output( $templater->render());
  }
}
Appears to work exactly as intended with one very odd exception:
Youtube videos aren't rendering on Chrome.
Don't understand how that could be related, but there it is....

Thoughts?

--------------- Added [DATE]1339079659[/DATE] at [TIME]1339079659[/TIME] ---------------

Nevermind.
Just had to relaunch Chrome.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.08177 seconds
  • Memory Usage 2,191KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete