Hi there.

I see this on the bottom of my site when not logged into the site:

Fatal error: Call to undefined function user_access() in /home/[siteroot]/public_html/sites/all/modules/visitors/visitors.module on line 233

Conditions:
IE7 (haven't tested FireFox)
Front Page / Other pages
Not Logged in

Configuration:
Drupal 6.10; Caching=Normal; Other caching off; Visitors enabled for an admin-type role
Tapestry Theme
Visitors 6 0.17

Comments

gashev’s picture

Function http://api.drupal.org/api/function/user_access/6 is defined in modules/user/user.module (http://api.drupal.org/api/file/modules/user/user.module/6/source). Either this file is missing, or perhaps it was missing and as a result has been disabled in the {system} table in the DB. The value of status should be 1.

"undefined function user_access()" means that Drupal
- either didn't find the user.module file at the place where it should be (under /modules/user/)
- or it couldn't read it (because it was damaged, or because its permissions were less than 644, or because the permissions of it directory were less that 755, or for some other reason).

gashev’s picture

Status: Active » Closed (fixed)
SiteMaster.ServeLime.com’s picture

Apologies for only now checking back.

I checked the user right on the folder - both match your settings
I only get this issue in IE (7)

timpiche’s picture

Version: 6.x-0.17 » 6.x-0.18
Status: Closed (fixed) » Active

I get the same error with the newest stable release of this module. I am running Drupal 6.13 and the permissions on the folder and files are correct (Folder 755, file 644).

gashev’s picture

I cannot reproduce it.

What's your previous version visitors module?

timpiche’s picture

This was a new install for me. I did not have any previous version of this module installed.

gashev’s picture

Execute sql query: show create table visitors.
What is your modules list?

dave reid’s picture

Version: 6.x-0.18 » 6.x-0.21

Drupal still fires hook_exit() even on cached requests. In visitors.module:

function visitors_exit() {
  if (!(variable_get('visitors_exclude_administer_users', 0) &&
      user_access('administer'))) {

If this is a cached request, and hence not a full bootstrap, the user.module is not loaded and user_access() is undefined.

Steps to reproduce:
1. Turn on page caching & use visitor.module defaults
2. Log out
3. View a page more than once
4. See undefined function error

gashev’s picture

Assigned: Unassigned » gashev
gashev’s picture

Status: Active » Fixed

Fixed to 6.x-0.22.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

pol’s picture

Still the same error on 6.x-0.29

rkodrupal’s picture

confirming Pol's report ... still a problem with version 6x.029.

gashev’s picture

Version: 6.x-0.21 » 6.x-0.29
Status: Closed (fixed) » Active
poehnix’s picture

Confirmed Pol's and rkodrupal reports: Error is still in php site logs. Any news on this issue?
Error in line 267 file visitors.module

gashev’s picture

Status: Active » Fixed

Fixed to 6.x-0.30.

poehnix’s picture

I will test it and report as soon as I can

Thanks

poehnix

BTW I was just reviewing the cvs messages in file "visitors.install" is there a chance that you misspelled the translation string you have just added --> st() instead of t() in line 14 ?

gashev’s picture

> BTW I was just reviewing the cvs messages in file "visitors.install" is there a chance that you misspelled the translation string you have just added --> st() instead of t() in line 14 ?

No.

http://api.drupal.org/api/function/st/6

Hardcoded function for doing the equivalent of t() during the install process, when database, theme, and localization system is possibly not yet available.

poehnix’s picture

I confirm the issue has disappeared.

Sorry for thinking of a typo. I should have checked drupal api first before reporting. Thanks for this excellent module.

I am opening another thread to report another issue I met while looking into this and sharing a translation file (to be reviewed because probably it is based on an old pot file.

bye
poehnix

gashev’s picture

Status: Fixed » Closed (fixed)

  • Commit 28472d5 on 7.x-1.x, master, 8.x-1.x, 7.x-1.x-browscap, 7.x-2.x, 7.x-2.x-browscap-separate-table by gashev:
    Fixed:      * bug reports #508120: Fatal error: Call to undefined...

  • Commit 28472d5 on 7.x-1.x, master, 8.x-1.x, 7.x-1.x-browscap, 7.x-2.x, 7.x-2.x-browscap-separate-table, 8.x-2.x by gashev:
    Fixed:      * bug reports #508120: Fatal error: Call to undefined...