vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Custom page for guests (https://vborg.vbsupport.ru/showthread.php?t=272544)

Frosty 10-22-2011 02:17 PM

Custom page for guests
 
Hey guys,
Is there a way to display a custom template to all guests, no matter what pages on the site they try to visit? I want to display a login form (nothing else) to all guests. If they aren't logged in, they won't be able to see anything except the login form.

I tried creating a plugin and the hook I used was global_start, rest was the simple stuff, just code for the display of a custom template wrapped in the usergroup conditional.. But it didn't work.

P.S. Forum and attachment permissions aren't the problem (I'd set them to 'no' for guests after I finish this), I just don't want to show the login form within the forum's style. I have the custom login form finished as well...

Thanks... :)

Lynne 10-22-2011 04:17 PM

Post the plugin code you wrote that didn't work so we can try it ourselves and see what the issue was.

Frosty 10-22-2011 04:29 PM

global_start hook...

PHP Code:

if ($vbulletin->userinfo['usergroupid'] == 1)
{
eval(
'$lolwtf= "' fetch_template('lolwtf') . '";');


Nothing happens. But yeah, I'm pretty new to PHP, so you shouldn't be surprised if I messed up something, lol...

Lynne 10-22-2011 04:34 PM

Why not just:
PHP Code:

if ($vbulletin->userinfo['usergroupid'] == 1)
{
    
print_no_permission();


In regards to what you wrote... you evaled a template and assigned it to a variable and then what? If you wanted to eval something and spit it out, you'd want:

PHP Code:

if ($vbulletin->userinfo['usergroupid'] == 1)
{
eval(
'print_output("' fetch_template('lolwtf') . '");');



Frosty 10-22-2011 04:43 PM

Lol... Thanks a bunch Lynne! :D The second code works as a charm...

firebrand media 05-25-2012 04:40 PM

The "eval" makes me think this is a 3.x solution.

My attempt at a 4.x update: (Template names have been changed to protect the idiotic)
Code:

if ($vbulletin->userinfo['usergroupid'] == 1)
{
$templater = vB_Template::create('my_custom_login');
print_output( $templater->render());
}

Still hooking at global_start.
I have a full-page template called my_custom_login.

firebrand media 05-30-2012 04:53 PM

So my attempt works in that non-logged in users are shown that template.
But I have two issues:
1) Logged in users aren't getting any stylesheets.
2) I haven't figured out how to pass name/password to login from the custom template.


All times are GMT. The time now is 05:18 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.01125 seconds
  • Memory Usage 1,726KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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