DrupalBin
Submit Code
About
Recent Posts
Fix for Latest item + title list
Support Ticketing System module: code excerpt from 6.x-1.x-dev support.module lines 2843 to 2941
Fix for Create product reference field
Create product reference field
Re:
Fix for Code
Code
Code
bellHead's fields error
Code
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
test
theme
user
views
more tags
Home
›
Fix for my module is showing bug .. not sure why ..
Fix for Fix for my module is showing bug .. not sure why ..
View
Fix
Fixes are not saved to the database until you submit.
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
By fkaufusi Drupal version 6: function user_access($string, $account = NULL, $reset = FALSE) { global $user; static $perm = array(); if ($reset) { $perm = array(); } if(is_null($account)){ $account = $user; } // User #1 has all privileges: if ($account->uid == 1) { return TRUE; } // To reduce the number of SQL queries, we cache the user's permissions // in a static variable. if (!isset($perm[$account->uid])) { $result = db_query("SELECT p.perm FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (". db_placeholders($account->roles) .")", array_keys($account->roles)); $perms = array(); while ($row = db_fetch_object($result)) { $perms += array_flip(explode(', ', $row->perm)); } $perm[$account->uid] = $perms; } return isset($perm[$account->uid][$string]); } Have a look at the function above which is use to check the user access permission. Look at how the drupal validate the $account variable, $account variable is suppose to be an object and here's how drupal validate it. if(is_null($account)){ $account = $user; } They only check to see if the $account variable is null, then if not null then they think is an object. Okay how about if the $account type is not an object. Here's a small fix and it would help to implement in the next version of drupal. if(is_null($account) || !is_object($account)){ $account = $user; } ?>
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp
.