Hi:

I've seen you added og galleries compatibility in the following modification
// Modified 2007-09-13 for "galleries";

But this is half the way. This covers the administration pages but og galleries uses a user configurable view to show the galleries and now those urls aren't covered.
I've write this code and have added it to the end of the og_user_roles_all_roles funtion (before the og_user_roles_gid hook):

   // Galleries (view part: The view urls can have 'subdirs' so we may need to check until the nth arg)
   $og_gal_parts=split('/',og_galleries_get_url());
   if (!empty($og_gal_parts)) {
     $is_og_gal_url=TRUE;
     $arg_num=0;
     foreach ($og_gal_parts as $value) {
       if ($value != arg($arg_num++)) {
         $is_og_gal_url=FALSE;
       }
     }
     if ($is_og_gal_url && is_numeric(arg($arg_num))) {
      $location = 18;
      $gid = (int)arg($arg_num);	
     }
   }

This code works with all the urls the user could have set in the view config.
I've tried it and works fine for me.

I can't send you a patch (I get errors with the CRs and LFs and I have a patched version of the module), sorry

Thanks.-

NOTE 1: If you or anyone else wants to test the code first it would be needed to fix some bugs in the og galleries module since it seems to be very buggy in the current release. I've sent some patches to the og_galleries issue queue:
- Patch: http://drupal.org/node/198924
- Patch: http://drupal.org/node/202866
- Patch: http://drupal.org/node/204074

NOTE 2: SomebodySysop, do you think it's better to add this in og galleries via og_user_roles_gid? If you do, I can send the patch to og_galleries but the project seems to be a little slow by today...

CommentFileSizeAuthor
#3 og_user_roles.module.5.x-2.7.patch12.43 KBsomebodysysop

Comments

somebodysysop’s picture

Thank you for the code. I know you mentioned where it is supposed to go, but I would appreciate it, for clarity's sake, if you could include the lines of code which precede and follow the snippet above. Just to make sure I put it in the correct place.

Again, thanks.

neurojavi’s picture

yes, of course.

This is the code in its context:

    // Agenda module
    // http://doadance.scbbs.com/node/agenda/list/279
    if (arg(0) == 'node' && arg(1) == 'agenda' && arg(2) == 'list' && is_numeric(arg(3)) ) {
      $location = 17;
      $nid = (int)arg(3);
      $gid = og_user_roles_getgid($nid, $uid);
    }

   // Galleries (view part: The view urls can have 'subdirs' so we may need to check until the nth arg)
   $og_gal_parts=split('/',og_galleries_get_url());
   if (!empty($og_gal_parts)) {
     $is_og_gal_url=TRUE;
     $arg_num=0;
     foreach ($og_gal_parts as $value) {
       if ($value != arg($arg_num++)) {
         $is_og_gal_url=FALSE;
       }
     }
     if ($is_og_gal_url && is_numeric(arg($arg_num))) {
      $location = 18;
      $gid = (int)arg($arg_num);	
     }
   }

   // Modification. As per: http://drupal.org/node/176390
   // Present a hook for other modules: hook_og_user_roles_gid()  
   if ($results = module_invoke_all('og_user_roles_gid')) {
     foreach ($results as $result) {
       if ($result) $gid = $result;
     }
   }

its's after the location=17 block and before the og_user_roles_gid hook invocation

Thanks.-

somebodysysop’s picture

StatusFileSize
new12.43 KB

Needed to wrap this additional code in this:

    if (module_exists("og_galleries")) {
    ...
    }

Attached is patch to be applied to clean download of 2.6 release. Please let me know if it works.

somebodysysop’s picture

Version: 5.x-2.6 » 5.x-2.7
Assigned: Unassigned » somebodysysop
Status: Needs review » Fixed

This patch code now included in latest OGR release. Since I've not heard back, assuming it's fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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