Download & Extend

Galleries listing empty in og galleries admin

Project:OG Galleries
Version:5.x-1.7
Component:Code
Category:bug report
Priority:critical
Assigned:neurojavi
Status:closed (won't fix)

Issue Summary

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.

AttachmentSize
og_galleries.module.patch707 bytes

Comments

#1

Status:needs review» closed (won't fix)

Old issue. This version is no longer being maintained. We are moving to Views Gallery for D6.

nobody click here