Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Add-ons

Reply
 
Thread Tools
Login by username or email Details »»
Login by username or email
Version: 1.00, by Marco van Herwaarden Marco van Herwaarden is offline
Developer Last Online: Dec 2010 Show Printable Version Email this Page

Version: 3.5.0 RC3 Rating:
Released: 09-23-2005 Last Update: Never Installs: 47
Code Changes  
No support by the author.

This code modification was made as part of a request in this thread: https://vborg.vbsupport.ru/showthrea...5&page=1&pp=15

All that it does is allow to use the email address instead of the username to be used to login (username also still works).

Since people where stating that it should be released, well here it goes.

1 File edit:
in file includes/functions_login.php, find:
PHP Code:
    if ($vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) 
and replace by:
PHP Code:
 // Start hack login with mail address (MarcoH64)
//    if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
if (!$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
{
$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE email = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
}
if (
$vbulletin->userinfo)
// End hack login with mail address (MarcoH64) 
This will allow logging in with either mail or username.

Download Now

File Type: zip Login with Email Address v1.00.zip (685 Bytes, 317 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #32  
Old 12-18-2008, 07:47 PM
TheFocusElf TheFocusElf is offline
 
Join Date: Mar 2005
Location: St. Catharines, Ontario
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am currently using VB 3.74, I have not upgraded to PL1, but I will in a short moment. I don't know how many users have had any resolution to this, and I was nervous for a fraction of a second before I read through the mod and really took a moment to understand what it was doing:

I am a Director of Marketing and training for a modest NFP organization, our initiatives are funded by our member dues, plain and simple. We are planning to open up the site from a pretty non-interactive VB to a defined VB system with users actually entering the system, belonging to member classes, etc. For record keeping, we want our members to log in with their emails, this way, if something changed significantly, they might be inclined to modify their email address in their control panel so that we're all up to date.

So, if you are looking to EXLUSIVELY require your members to log in with their emails (don't forget, this changes the Admin CP log in too), open the prescribed file in the original post, and if the file is otherwise unmodified, scroll down to around line 140, this is where you will find :

Code:
if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
Comment that out with // and substitute the following:
Code:
if $vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE email = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
All of these instructions were contained in the original post, just probably a few of you users, like me, don't really know what all is going on in those lines of code!

Again, this works, and unless VB drastically overhauls the login system, I see this very simple process working for patches to come.

Cheers and Merry Christmas/Holidays and Happy New Year!
Reply With Quote
  #33  
Old 05-29-2009, 09:31 PM
sharkee sharkee is offline
 
Join Date: Dec 2007
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Great, thanks. Installed.
Reply With Quote
  #34  
Old 01-12-2010, 02:41 AM
asiaphoto asiaphoto is offline
 
Join Date: Nov 2008
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hi everyone,

now that VB4 is released (and i'm running our forum on VB4)

is anyone able to update this mod? i'm willing to pay for professional service.

see my request here:
https://vborg.vbsupport.ru/showthrea...17#post1953217
Reply With Quote
  #35  
Old 11-30-2010, 05:26 PM
phoelapyae phoelapyae is offline
 
Join Date: Jun 2010
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can i get for version 4?
Reply With Quote
  #36  
Old 12-14-2010, 04:35 PM
malmazan malmazan is offline
 
Join Date: Feb 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Vote on vB.com to have this feature made standard: http://tracker.vbulletin.com/browse/VBIV-9646
Reply With Quote
  #37  
Old 09-12-2011, 04:45 AM
davidthornton davidthornton is offline
 
Join Date: May 2002
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does anyone have this working for v4.x? I'd like to be able to change a v4.x installation to only allow login via email address instead of username (and have the forum only permit one account per email address as well)
Reply With Quote
  #38  
Old 10-17-2011, 09:09 PM
imedic's Avatar
imedic imedic is offline
 
Join Date: Mar 2008
Location: Romania
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jerx View Post
Works on vb 3.7.3 pl1. This is the code I used:

Code:
// Start hack login with mail address (MarcoH64)
//	if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
	if (!$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
	{
		$vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE email = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
	}
	if ($vbulletin->userinfo)
// End hack login with mail address


That works, too. Are there any differences between both versions, eg performance, security or stability wise?

I can confirm that ONLY the above code works for 3.8.5 too

I add that you also need to change Username to Name/email. Look in language for: <strong>$vbphrase[username]</strong>
Then Look for template register and search in it for: <strong>$vbphrase[username]</strong> and change it to <strong>$vbphrase[user_name]</strong>
This will keep in register template the phrase Username and in login box Name/Email.
If you don't do this modification You will have allot of users registering with email address instead of Username.

Thanks
Reply With Quote
  #39  
Old 12-10-2011, 02:15 PM
imedic's Avatar
imedic imedic is offline
 
Join Date: Mar 2008
Location: Romania
Posts: 178
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is a small bug ( a space between - and > ) and gives an error if you upgrade to 3.8.7 PL2 so here is the working code I use:

PHP Code:
 // Start hack login with mail address (MarcoH64)
//  if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid,  membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX .  "user WHERE username = '" . $vbulletin->db- >escape_string(htmlspecialchars_uni($username)) . "'"))
if (!$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid,  membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX .  "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
     {
          
$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid,  membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX .  "user WHERE email = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username))  . "'");
     }
     if (
$vbulletin->userinfo)
// End hack login with mail address 
Reply With Quote
  #40  
Old 12-10-2011, 04:54 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have not tested this, but in vBulletin 4, try this:

In the file includes/functions_login.php, find:
PHP Code:
    if ($vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) 
And replace with:
PHP Code:
//    Start hack login with mail address (MarcoH64)
//    if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
    
if (!$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
    {
        
$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE email = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
    }
    if (
$vbulletin->userinfo)
//    End hack login with mail address (MarcoH64) 
Reply With Quote
  #41  
Old 12-14-2011, 08:53 PM
malmazan malmazan is offline
 
Join Date: Feb 2006
Posts: 63
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by HMBeaty View Post
I have not tested this, but in vBulletin 4, try this:

In the file includes/functions_login.php, find:
PHP Code:
    if ($vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'")) 
And replace with:
PHP Code:
//    Start hack login with mail address (MarcoH64)
//    if ($vbulletin->userinfo = $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " . TABLE_PREFIX . "user WHERE username = '" . $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
    
if (!$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE username = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'"))
    {
        
$vbulletin->userinfo $vbulletin->db->query_first("SELECT userid, usergroupid, membergroupids, infractiongroupids, username, password, salt FROM " TABLE_PREFIX "user WHERE email = '" $vbulletin->db->escape_string(htmlspecialchars_uni($username)) . "'");
    }
    if (
$vbulletin->userinfo)
//    End hack login with mail address (MarcoH64) 
Did you change anything with respect to the latest v3 versions? I'm getting this error on v4.1.8:
Code:
Fatal error: Cannot redeclare fetch_replaced_session_url() (previously declared in root/includes/functions_login.php:14) in root/includes/functions_login.php on line 568
Reply With Quote
Reply

Thread Tools

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 02:13 AM.


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.05350 seconds
  • Memory Usage 2,374KB
  • Queries Executed 26 (?)
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
  • (4)bbcode_code
  • (7)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)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_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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete