Download & Extend

call to undefined function user_logout()

Project:Single Login
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi,

When a user's login count reaches zero, the user gets this error:

Fatal error: Call to undefined function user_logout() in /path/to/module/single_login.module on line 312

Also no history seems to be recorded, or it doesn't show up on the single login session history page, anyway.

Comments

#1

Title:call to undefinted function user_logout()» call to undefined function user_logout()

#2

I should add the user gets blocked OK.

#3

Is this fixed and is there a new dev version for D6?!

#4

function user_logout() is in file user.pages.inc. This file is conditionally include()'ed by user.module. I don't know why it isn't included all the time or exactly when it is included but, sometimes its there and sometimes its not. I hacked a fix for this by putting the following in my custom code:

// JSAFRO - This is a crappy hack to make sure function user_logout() from user.module is available
require_once( dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/modules/user/user.pages.inc' );

You may have to edit the filepath in the require(). That doesn't feel like a good solution so if anyone has a better one, I'm all ears.

#5

Slightly improved coding to avoid lots of dirnames:

require_once(drupal_get_path('module', 'user') . '/user.pages.inc');
nobody click here