View Single Post
  #1  
Old 08-22-2019, 04:10 PM
doc55 doc55 is offline
 
Join Date: Aug 2019
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom Logout Button

I want to create a custom logout button for my vB 5.3.3.
I'm using the following code from the core/vb/user.php file but it is not working. Can someone help me troubleshoot this code, please?
Thank you

PHP Code:
//init the vBulletin system
require_once( JPATH_SITE '/forum/core/vb/vb.php' );
vB::init();

function 
processLogout() {
  global 
$vbulletin;

  
$assertor vB::getDbAssertor();
  
$session vB::getCurrentSession();
  
$userinfo $session->fetch_userinfo();
  
$timeNow vB::getRequest()->getTimeNow();
  
$options vB::getDatastore()->getValue'options' );

  if ( 
$userinfo'userid' ]AND $userinfo'userid' ] != -) {
    
// init user data manager
    
$userdata = new vB_Datamanager_UservB_DataManager_Constants::ERRTYPE_SILENT );
    
$userdata->set_existing$userinfo );
    
$userdata->set'lastactivity'$timeNow $options'cookietimeout' ] );
    
$userdata->set'lastvisit'$timeNow );
    
$userdata->save();

    if ( !
defined'VB_API' ) ) {
      
$assertor->delete'session', array( 'userid' => $userinfo'userid' ], 'apiaccesstoken' => null ) );
      
$assertor->delete'cpsession', array( 'userid' => $userinfo'userid' ] ) );
    }
  }

  
$assertor->delete'session', array( 'sessionhash' => $session->get'dbsessionhash' ) ) );

  
// Remove accesstoken from apiclient table so that a new one will be generated
  
if ( defined'VB_API' )AND VB_API === true AND $vbulletin->apiclient'apiclientid' ] ) {
    
$assertor->update(
      
'apiclient',
      array( 
'apiaccesstoken' => '''userid' => ),
      array( 
'apiclientid' => intval$vbulletin->apiclient'apiclientid' ] ) )
    );
    
$vbulletin->apiclient'apiaccesstoken' ] = '';
  }

  if ( 
$vbulletin->session->created == true AND( !defined'VB_API' )OR!VB_API ) ) {
    
// if we just created a session on this page, there's no reason not to use it
    
$newsession $vbulletin->session;
  } else {
    
// API should always create a new session here to generate a new accesstoken
    
$newsession vB_Session::getNewSessionvB::getDbAssertor(), vB::getDatastore(), vB::getConfig(), ''0''vB::getCurrentSession()->get'styleid' ) );
  }

  
$newsession->set'userid');
  
$newsession->set'loggedin');
  
$vbulletin->session = & $newsession;

  
$result = array();
  
$result'sessionhash' ] = $newsession->get'dbsessionhash' );
  
$result'apiaccesstoken' ] = $newsession->get'apiaccesstoken' );

  if ( 
defined'VB_API' )AND VB_API === true ) {
    if ( 
$_REQUEST'api_c' ] ) {
      
$assertor->update'apiclient',
        array(
          
'apiaccesstoken' => $result'apiaccesstoken' ],
          
'userid' => 0,
        ),
        array(
          
'apiclientid' => intval$_REQUEST'api_c' ] )
        )
      );
    }
  }

  
vB::getHooks()->invoke'hookProcessLogout', array(
    
'result' => & $result,
    
'userinfo' => $userinfo,
  ) );

  return 
$result;

Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01679 seconds
  • Memory Usage 1,820KB
  • 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)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