vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Custom Login Page (https://vborg.vbsupport.ru/showthread.php?t=222607)

Trasion 09-05-2009 10:00 PM

Custom Login Page
 
I personally hate seeing that ugly login box at the top of the screen in the navbar template. I came up with this quick and easy fix, have a separate page for it.

If you'd like a custom login page, and simply have to link to it in your navbar, then follow the quick steps below.

Step 1) Create a new .php file called clogin.php (it must be named this, do not change the name), and upload it to your forum root directory.

Step 2) Put the below code in your new clogin.php file:

Code:

<?php

// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);

// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'clogin'); // change this depending on your filename

// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array(

);

// get special data templates from the datastore
$specialtemplates = array(
   
);

// pre-cache templates used by all actions
$globaltemplates = array(
    'clogin',
);

// pre-cache templates used by specific actions
$actiontemplates = array(

);

// ######################### REQUIRE BACK-END ############################
require_once('./global.php');

// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################

$navbits = array();
$navbits[$parent] = 'Login';

$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('clogin') . '");');

?>

Step 3) Open up all styles you're using (one at a time) in the administration control panel, and create a new template called "clogin" (without the quotation marks) - once again, it must be named this, do not change the name.

Step 4) Insert the following code into your "clogin" (without the quotation marks):

Code:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle]</title>
$headinclude
</head>
<body>
$header

$navbar

<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
    <td class="tcat">Login</td>
</tr>
<tr>
    <td class="alt1">

<if condition="$show['member']">
<meta HTTP-EQUIV="REFRESH" content="0; url=index.php">
</if>

Welcome to SITENAME, Guest.<br /><br />

You appear to either not have an account, or not be logged in. If you have an account, please login using this page right below this text. If you do not have an account already, please visit the <i>register</i> page by clicking <a href="register.php">here</a>.<br /><br />

By being a member of SITENAME, you will have rights to create threads, and posts, release and download software, and do so much more. Please login below.<br /><br />

                <!-- login form -->
                <form action="login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, $show[nopasswordempty])">
                <script type="text/javascript" src="clientscript/vbulletin_md5.js?v=$vboptions[simpleversion]"></script>
                <table cellpadding="0" cellspacing="$stylevar[formspacer]" border="0">
                <tr>
                        <td class="smallfont" style="white-space: nowrap;"><label for="navbar_username">$vbphrase[username]</label></td>
                        <td><input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="$vbphrase[username]" onfocus="if (this.value == '$vbphrase[username]') this.value = '';" /></td>
                        <td class="smallfont" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input type="checkbox" name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" />$vbphrase[remember_me]</label></td>
                </tr>
                <tr>
                        <td class="smallfont"><label for="navbar_password">$vbphrase[password]</label></td>
                        <td><input type="password" class="bginput" style="font-size: 11px" name="vb_login_password" id="navbar_password" size="10" tabindex="102" /></td>
                        <td><input type="submit" class="button" value="$vbphrase[log_in]" tabindex="104" title="$vbphrase[enter_username_to_login_or_register]" accesskey="s" /></td>
                </tr>
                </table>
                <input type="hidden" name="s" value="$session[sessionhash]" />
                <input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />
                <input type="hidden" name="do" value="login" />
                <input type="hidden" name="vb_login_md5password" />
                <input type="hidden" name="vb_login_md5password_utf" />
                </form>
                <!-- / login form -->

</td>
</tr>
</table>

$footer
</body>
</html>

This will make it so that if any registered member tries to access this page, it will redirect them to your forum index, and if they're a guest, they get to see the login script, and can login.

You must change all of the "SITENAME" text in your new template to your actual site name.

Please post here if you need assistance, please. :)

Credits to Gary King! (https://vborg.vbsupport.ru/showthread.php?t=62164)

inder123 10-07-2009 05:58 PM

installed but not works

Front Range 4x4 10-07-2009 08:25 PM

It works but Trasion left out a step. I think what his intent was to add a Login link to the navbar linked to your page: yoursite.com/forums/clogin.php

Nice work Trasion!

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

It looks like this works when added to the navbar:

$template_hook[navbar_buttons_right]
<td class="vbmenu_control">
<a href="clogin.php?">Log In</a></td>

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

Then you need to delete the old login form from the navbar template.

Trasion 10-10-2009 12:41 PM

Yes, you must add that too. Sorry.

After you go to that page, it should work!

Front Range 4x4 10-12-2009 01:18 AM

1 Attachment(s)
It should and it does. After testing I have added it to my board. This allows for a larger site logo without pushing things around for users with small screens.:up:

James Birkett 10-18-2009 12:43 PM

You might want to add a condition to remove the Log In button if the user is logged in and replace it with Log Out.

Front Range 4x4 10-18-2009 03:30 PM

Meh. My users know which one to click. ;)

Trasion 10-18-2009 05:39 PM

Code:

<td class="vbmenu_control">
<if condition="$show['guest']">
<a href="clogin.php">Login</a>
<else />
<a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]">$vbphrase[log_out]</a>
</if>
</td>


dacho 11-05-2009 04:31 PM

I do that
but if i want to stay in the some page "clogin.php" without to go after login (or if I'm conected) to index.php
just a pape for login and say HELLO :)

abstroose 11-11-2009 05:38 PM

Thanks a lot! I've spent an hour hunting for a mod so I can put a login link on my blog, but this works perfectly.

KaneR 05-13-2010 01:21 PM

Will this work with VB4?

ChopSuey 05-30-2010 10:29 AM

Really nice article dude lol. I modified it to fix my needs :D Also working on a vB4 one, don't mind if i post it?

joybonham 04-20-2011 03:46 PM

This code does not work in release 4. The fetch_template functions no longer work. They must be replaced with object model. See this article for details.

https://vborg.vbsupport.ru/showthread.php?t=228078

eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('clogin') . '");');

6impy 06-19-2012 12:32 PM

I believe this just broke with the recent security update.

I'm trying to figure out why right now.

ShiNicHi23 01-25-2013 01:09 PM

is there any guide to custom login page in vbulletin 4?

RaSa 10-02-2013 10:45 AM

Quote:

Originally Posted by ShiNicHi23 (Post 2399421)
is there any guide to custom login page in vbulletin 4?

Look here:

https://vborg.vbsupport.ru/showthread.php?t=228112

A.Chakery 03-04-2014 09:08 PM

Thanks for this article but I have a problem with redirecting the logged in members to the previous page which they have been viewing as guest!

is there any way to do this ?

Thank you.


All times are GMT. The time now is 07:51 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.01272 seconds
  • Memory Usage 1,764KB
  • 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)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)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