Closed (won't fix)
Project:
OG Galleries
Version:
5.x-1.7
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Reporter:
Created:
21 Dec 2007 at 01:58 UTC
Updated:
9 Jan 2010 at 14:56 UTC
Hi:
I had a the following problem:
A user with administer og galleries permissions goes to galleries (node/xx/galleries) and always gets an "No galleries available" message.
Only user 0 can see this list.
After some research, i've found that the problem is in og_galleries_db_rewrite_sql
We use $user->og_groups but it's possible that this was not initialized at that moment (for example in the admin page). So we need to do an user_load...
This is the change I propose to db_rewrite hook
function og_galleries_db_rewrite_sql($query, $table, $field) {
if (!user_access('administer site configuration') && ($field =='vid' || $field =='tid')) {
global $user;
// we have to perform a load in order to assure that the $user->og_groups bits are present.
if ($user->uid) {
$user = user_load(array('uid' => $user->uid));
}
else {
$user->og_groups = array();
}
$op = (arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit')) ? 'create' : 'list';
This solved the problem for me.
I've attached a patch for your review.
| Comment | File | Size | Author |
|---|---|---|---|
| og_galleries.module.patch | 707 bytes | neurojavi |
Comments
Comment #1
karens commentedOld issue. This version is no longer being maintained. We are moving to Views Gallery for D6.