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

Reply
 
Thread Tools
Quick Account Switch Details »»
Quick Account Switch
Version: 2.0.1, by akanevsky akanevsky is offline
Developer Last Online: Feb 2016 Show Printable Version Email this Page

Category: Profile Enhancements - Version: 4.0.x Rating:
Released: 03-01-2010 Last Update: 03-02-2010 Installs: 175
DB Changes Uses Plugins Auto-Templates
Additional Files Translations  
No support by the author.

I no longer support my hacks. Please feel free to update them and release new versions elsewhere as long as I get the credit for the original modification.

/*===================================*\
|| Quick Account Switch
||
|| Author : Anton Kanevsky
|| Works on : vBulletin 4.0.x
|| Released : Mar 02, 2010
||
|| Time required to install: ~30 seconds
|| Difficulty: easy
\*===================================*/

DESCRIPTION

This modification gives users the ability to easily switch between linked accounts. Accounts can be linked by administrators via admincp or by users via usercp as long as these users know the passwords for both accounts. Optionally, you can disallow users to link and unlink accounts from the usercp.

STATISTICS

File Uploads: 1
Products to Install: 1


FEATURES
  • Adds AdminCP and UserCP controls to link and unlink accounts.
  • Allows to easily switch between linked accounts from the navbar.
  • Allows to disable the public UserCP controls and leave just the AdminCP part.

VERSION HISTORY

2.0.1
[F] Fixed a minor bug.

2.0.0
[+] Hack ported to vBulletin 4.0.x.

1.1.0
[+] Compatible with vBulletin 3.5.x - 3.8.x.
[+] Removed all template modifications.
[+] Added option to disable usercp controls for linking accounts.

1.0.1
[+] The modification is now officially compatible with vBulletin 3.6.
[+] The hack has been optimized and now performs much less queries than before.
[+] Users now can link accounts without an administrator as long as they know the passwords for both accounts.

1.0.0
Initial Release (Port of Quick Account Switch by Ianomed)

The installation manual is contained within the attached file.

IF YOU LIKE MY HACK, PLEASE CLICK INSTALL

Download Now

File Type: zip Q.A.S_2.0.1_by.Psionic.Vision.zip (9.9 KB, 868 views)

Screenshots

File Type: png screenshot01.png (10.1 KB, 0 views)
File Type: png screenshot02.png (3.8 KB, 0 views)
File Type: png screenshot03.png (15.8 KB, 0 views)
File Type: png screenshot04.png (17.3 KB, 0 views)
File Type: jpg screenshot05.jpg (38.6 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
svyrydov

Comments
  #132  
Old 01-23-2015, 02:09 AM
Raw Sugar Raw Sugar is offline
 
Join Date: Apr 2005
Location: Texas
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alan_SP View Post
Well, you need to create template hook association for this mod with existing template hook in header (I don't know if there exist one), or create association for new hook that you'll place in header in position you like.

I described procedure here and here.

Missing image in second post is because imageshack deleted it. I still use this system for quick change of accounts.
Thank you so much for your reply! Quick question - doing these would require that I completely uninstall the product, right? Which would then unlink all of the linked accounts and once re-installed and all that, I would have to go through and re-link them? Or am I making it more complicated than it should be?

Thank you again for your help!
Reply With Quote
  #133  
Old 01-23-2015, 01:15 PM
concepts's Avatar
concepts concepts is offline
 
Join Date: May 2005
Location: Woodland Hills, Ca
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there is a way to show notifications for those linked accounts in the dropdown? like maybe a "Total Notifications"? to show an admin someone has interacted with one of the linked accounts? If I am using a few linked accounts for different management, I want to know if there is a notification for that account without having to switch over to it first.
Reply With Quote
  #134  
Old 01-23-2015, 10:32 PM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Raw Sugar View Post
Quick question - doing these would require that I completely uninstall the product, right? Which would then unlink all of the linked accounts and once re-installed and all that, I would have to go through and re-link them?
Well, you're making it too complicated.

Actually, you can do two things:

a) You can edit plugins (actually, one plugin of this mod in question).

b) You can edit installation xml file by yourself, or use one I attached and upload it with allowing overwrite to assure it is accepted by vB.

Everything will stay the same, except, of course, you'll have additional working hook (or completely new one) that you now can place in header template where you want it. I don't know what exactly you intend to do, but I still use things as I described in second post (much faster to see all linked accounts and it needs only one click). Sorry for missing image, imageshack dropped it.

Anyway, creating new, previously not existing hook is the best path and afterwards placing it in template of choice (navbar, footer, whatever someone prefers). At least I see it that way.

Quote:
Originally Posted by concepts View Post
Is there is a way to show notifications for those linked accounts in the dropdown?
Not that easily and it would require more work on mod, if it is even possible.

Linked accounts are still completely separate. This mod just makes easy switching between them. No information (except linked accounts) is stored about them.

And I agree it would be useful to see if there are new PM's or other notifications about other accounts.
Reply With Quote
  #135  
Old 01-24-2015, 08:31 PM
Raw Sugar Raw Sugar is offline
 
Join Date: Apr 2005
Location: Texas
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alan_SP View Post
Well, you're making it too complicated.

Actually, you can do two things:

a) You can edit plugins (actually, one plugin of this mod in question).

b) You can edit installation xml file by yourself, or use one I attached and upload it with allowing overwrite to assure it is accepted by vB.

Everything will stay the same, except, of course, you'll have additional working hook (or completely new one) that you now can place in header template where you want it. I don't know what exactly you intend to do, but I still use things as I described in second post (much faster to see all linked accounts and it needs only one click). Sorry for missing image, imageshack dropped it.

Anyway, creating new, previously not existing hook is the best path and afterwards placing it in template of choice (navbar, footer, whatever someone prefers). At least I see it that way.
I finally got the default navbar template edited to work how I want it to, so now I can keep the QAS in there and not have to worry about editing the plugin.

Although, now I'm seeing this issue (in fact it's been there all along, but I thought it'd be easier to take care of...)

Screenshot with space highlighted and Chrome's inspect for reference:


There's a couple of things I'm confused about...
1: There's an li with an id of "qas_switch" that was empty (it also had an empty href tag) - I have that id set to display none, because it was creating more space.

2: The QAS is in the next li, but there's a weird empty href tag in there too, before the actual link. When I inspect and do display:none on that one, the space goes away and all is well. I'm not sure why there's an empty href tag there and because the link is being added in through the Navigation Manager, there's no way for me to edit the html.

Any ideas how to get that empty href to go away? I can't do something like this (li#yui.gen0 { a: display:none; }) as that would remove all the links in that id.
Reply With Quote
  #136  
Old 01-24-2015, 10:22 PM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's strange. I just checked, I don't have empty href tag. I use version given here. Interesting is, picture is back again, so you can see how it looks like.

Anyway, maybe you did something wrong?
Reply With Quote
  #137  
Old 01-24-2015, 10:47 PM
Raw Sugar Raw Sugar is offline
 
Join Date: Apr 2005
Location: Texas
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alan_SP View Post
That's strange. I just checked, I don't have empty href tag. I use version given here. Interesting is, picture is back again, so you can see how it looks like.

Anyway, maybe you did something wrong?
I'm not the one who actually installed the plugin, so I've no idea if the person who did it did anything funky. Since it's technically not my board that I'm helping out with, I'm worried about uninstalling the old one to install a newer version of the plugin. I'm also new to vb4 (the board that I own is still running vb3), and when I click on 'edit' next to the Product, it brings up a page I've never seen before that has uninstall and install codes.

If I wanted to do this one without using the new .xml, do I need to uncomment one of the lines at the bottom of the code?

This is what is in this board's QAS: Handle Switch:
PHP Code:
$show['qas_switch'] = false;

if (
$vbulletin->userinfo['psi_qas'])
{
    
// process switch
    
if ($_REQUEST['do'] == 'qas_switch')
    {
        require_once(
DIR '/includes/functions_login.php');

        
$switchto $vbulletin->input->clean_gpc('r''userid'TYPE_UINT);
        
$switchable explode(' '$vbulletin->userinfo['psi_qas']);        

        if (
in_array($switchto$switchable))
        {
            
$getuserdata $db->query_first("
                SELECT userid, username, password, salt, styleid
                FROM " 
TABLE_PREFIX "user
                WHERE userid = 
$switchto
                LIMIT 1
            "
);
            
            if (
$getuserdata)
            {
                
// clean out the session crap...
                
$db->query_write("
                    DELETE FROM " 
TABLE_PREFIX "cpsession 
                    WHERE userid IN (
{$vbulletin->userinfo['userid']}{$getuserdata['userid']})
                "
);

                
$db->query_write("
                    DELETE FROM " 
TABLE_PREFIX "session 
                    WHERE userid IN (
{$vbulletin->userinfo['userid']}{$getuserdata['userid']})
                "
);
                
                
// set cookie...
                
vbsetcookie('userid'$switchto);
                
vbsetcookie('password'md5($getuserdata['password'] . COOKIE_SALT));
                    
                
// unstrike the user...
                
exec_unstrike_user($getuserdata['username']);
                    
                
// create new session...
                
$vbulletin->session =& new vB_Session($vbulletin''$getuserdata['userid'], ''$getuserdata['styleid']);
                
$vbulletin->session->set('userid'$getuserdata['userid']);
                
$vbulletin->session->set('loggedin'1);
                
$vbulletin->session->set('bypass'0);
                
$vbulletin->session->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0));

                if (
$_SERVER['HTTP_REFERER'])
                {
                    
exec_header_redirect($_SERVER['HTTP_REFERER']);
                }
            }
        }

        
// if we got up to here, something went wrong... redirect to home
        
exec_header_redirect($vbulletin->options['bburl']);
    }
    
    
// fetch data
    
$getusers $db->query_read("
        SELECT userid, username
        FROM " 
TABLE_PREFIX "user
        WHERE userid IN (" 
$db->escape_string(str_replace(' '','$vbulletin->userinfo['psi_qas'])) . ")
    "
);
    
    
// construct switchbit
    
if ($db->num_rows($getusers))
    {
        
$switchbit '';            
        while (
$getuserdata $db->fetch_array($getusers))
        {
            
$templater vB_Template::create('qas_switchbit');
                
$templater->register('getuserdata'$getuserdata);
            
$switchbit .= $templater->render();
            
$show['qas_switch'] = true;
        }
    }
    
    
// inject into the navbar template
    
require_once(DIR '/includes/adminfunctions_template.php');

    
$add_string vB_Template::create('qas_navbar_link');
        
$add_string->register('switchbit'$switchbit);
    
$add_string $add_string->render();
    
//$template_hook['navbar_end'] .= $add_string; Line below is fix for 4.2.0
    //$template_hook['navbar_after_links'] .= $add_string; Line below is fix for 4.2.1
    
$vbphrase['vb_navigation_link_qas_switch_text'] = $add_string;

Or should I just replace this with the plugin chunk in your .xml file?

Thank you, Alan for your patience!
Reply With Quote
  #138  
Old 01-25-2015, 02:06 AM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, I'm using hook in my version and template which I modified to create output I like as shown in the image (both are in my xml version, you only need to place hook manually where you want output).

Here is used phrase for navigation, but how vB handles it, I don't know, maybe that creates problem, maybe not, I'm not on vB4.2.1+

But, when updating, you just can reload older version and allow overwrite if you don't like new version. Every setting will stay the same this way. So you can play with different versions of QAS.

About code, you could try to uncomment hook locations and see if it will work on your version of vB.
Reply With Quote
  #139  
Old 02-03-2015, 01:25 AM
Raw Sugar Raw Sugar is offline
 
Join Date: Apr 2005
Location: Texas
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had to take a break looking at this... but finally at it again!

Okay, after some testing... this is what I've found...

PHP Code:
$show['qas_switch'] = false;

if (
$vbulletin->userinfo['psi_qas'])
{
    
// process switch
    
if ($_REQUEST['do'] == 'qas_switch')
    {
        require_once(
DIR '/includes/functions_login.php');

        
$switchto $vbulletin->input->clean_gpc('r''userid'TYPE_UINT);
        
$switchable explode(' '$vbulletin->userinfo['psi_qas']);        

        if (
in_array($switchto$switchable))
        {
            
$getuserdata $db->query_first("
                SELECT userid, username, password, salt, styleid
                FROM " 
TABLE_PREFIX "user
                WHERE userid = 
$switchto
                LIMIT 1
            "
);
            
            if (
$getuserdata)
            {
                
// clean out the session crap...
                
$db->query_write("
                    DELETE FROM " 
TABLE_PREFIX "cpsession 
                    WHERE userid IN (
{$vbulletin->userinfo['userid']}{$getuserdata['userid']})
                "
);

                
$db->query_write("
                    DELETE FROM " 
TABLE_PREFIX "session 
                    WHERE userid IN (
{$vbulletin->userinfo['userid']}{$getuserdata['userid']})
                "
);
                
                
// set cookie...
                
vbsetcookie('userid'$switchto);
                
vbsetcookie('password'md5($getuserdata['password'] . COOKIE_SALT));
                    
                
// unstrike the user...
                
exec_unstrike_user($getuserdata['username']);
                    
                
// create new session...
                
$vbulletin->session =& new vB_Session($vbulletin''$getuserdata['userid'], ''$getuserdata['styleid']);
                
$vbulletin->session->set('userid'$getuserdata['userid']);
                
$vbulletin->session->set('loggedin'1);
                
$vbulletin->session->set('bypass'0);
                
$vbulletin->session->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0));

                if (
$_SERVER['HTTP_REFERER'])
                {
                    
exec_header_redirect($_SERVER['HTTP_REFERER']);
                }
            }
        }

        
// if we got up to here, something went wrong... redirect to home
        
exec_header_redirect($vbulletin->options['bburl']);
    }
    
    
// fetch data
    
$getusers $db->query_read("
        SELECT userid, username
        FROM " 
TABLE_PREFIX "user
        WHERE userid IN (" 
$db->escape_string(str_replace(' '','$vbulletin->userinfo['psi_qas'])) . ")
    "
);
    
    
// construct switchbit
    
if ($db->num_rows($getusers))
    {
        
$switchbit '';            
        while (
$getuserdata $db->fetch_array($getusers))
        {
            
$templater vB_Template::create('qas_switchbit');
                
$templater->register('getuserdata'$getuserdata);
            
$switchbit .= $templater->render();
            
$show['qas_switch'] = true;
        }
    }
    
    
// inject into the navbar template
    
require_once(DIR '/includes/adminfunctions_template.php');

    
$add_string vB_Template::create('qas_navbar_link');
        
$add_string->register('switchbit'$switchbit);
    
$add_string $add_string->render();
    
//$template_hook['navbar_end'] .= $add_string; Line below is fix for 4.2.0
    //$template_hook['navbar_after_links'] .= $add_string; Line below is fix for 4.2.1
    
$vbphrase['vb_navigation_link_qas_switch_text'] = $add_string;

I've uncommented the two bottom lines that are commented out, and then commented out the very last line. Went into the Navigation Manager and turned off the #qas_switch# link.

Doing this, the QAS link is now the very last link in the navbar and there is no extra funky space that I was seeing. I'd prefer this to not be the last link in the navbar, but I definitely won't complain as the extra space to the side was bothering me more than the order does.

Thank you for your help, Alan!
Reply With Quote
  #140  
Old 02-03-2015, 07:04 AM
Alan_SP's Avatar
Alan_SP Alan_SP is offline
 
Join Date: Nov 2009
Posts: 1,122
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If I understand you correctly, now you're using two hooks: navbar_end and navbar_after_links? As in the code isn't version you described you're using.

Anyway, from what you did if I get it correctly, there's a problem with Navigation Manager, who creates that extra space, which is probably bug in vB.

You could always add new hook location in template navbar at exact place where you want QAS switch and add it in the plugin code.
Reply With Quote
  #141  
Old 02-03-2015, 02:28 PM
Raw Sugar Raw Sugar is offline
 
Join Date: Apr 2005
Location: Texas
Posts: 74
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've just commented out two of the hook locations, and now am using this one, which seems to work and not break anything:
PHP Code:
    $template_hook['navbar_after_links'] .= $add_string//Line below is fix for 4.2.1 
My biggest question I think is how do I add a hook into the MIDDLE of the navbar? Because in the code it's got:

PHP Code:
{vb:raw template_hook.navtab_start}
{
vb:raw navigation}
{
vb:raw template_hook.navtab_end
So it's like I can't put anything into the middle of the navbar... I can only add things to the beginning and the end. This is more like a general question, I think.

Being used to how the navbar worked in vb3, I'm considering just not using the Navigation Manager at all and just hardcoding the links in there in the order that I want them.
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 08:31 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.05379 seconds
  • Memory Usage 2,454KB
  • 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_php
  • (5)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
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (6)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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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