Thread: Profile Enhancements - Quick Account Switch
View Single Post
  #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
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01333 seconds
  • Memory Usage 1,837KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete