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();
// 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' => 0 ),
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::getNewSession( vB::getDbAssertor(), vB::getDatastore(), vB::getConfig(), '', 0, '', vB::getCurrentSession()->get( 'styleid' ) );
}