Support for organic group

pivica - June 30, 2008 - 13:45
Project:Advanced User
Version:5.x-2.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

Hi,

It would be nice to add support for organic groups - for example to allow adding/removing multiple users to groups.

Now I am not sure should that feature need to be added to advuser or maybe to og module through user_operations callback.

Anyway for now I have patched advuser to allow adding multiple users to some organic group. If anybody is interested I can also add removing from organic groups and then upload patch here so others can test it.

#1

earnie - June 30, 2008 - 17:08
Version:5.x-2.0» HEAD

Yes, this would be a nice feature. I've been developing a site using OG. I'd be interested if you uploaded your patches.

#2

pivica - July 2, 2008 - 17:09

OK here is first version of patch (note that i have created this patch against 5.x-2.0 version). I have also added support for removing users from organic group.

The next thing that would maybe be nice is adding filters for groups - so you can use advuser to filter users from only chosen group. What do you think?

AttachmentSize
advuser.module.og_.patch 5 KB

#3

earnie - July 2, 2008 - 18:05
Version:HEAD» 5.x-2.x-dev
Status:active» needs work

I prefer the patches to be cvs based differences. See the http://drupal.org/handbook/cvs guide if you need help with that. Or just ask me.

Yes adding OG filtering logic would be good.

#4

pivica - July 2, 2008 - 22:53

try this version is it ok now?

AttachmentSize
advuser.module.og_.patch 5.15 KB

#5

earnie - July 3, 2008 - 13:52

Please add some docbook/doxygen comments to the new functions. One of the near future goals is to be standard with coding and to be able to look at http://drupal.kollm.org/doxygen/_contrib/drupal-contrib-phpdoc/dirs.html, find advuser and see http://drupal.kollm.org/doxygen/_contrib/drupal-contrib-phpdoc/advuser_2... to get the documented version of the module.

Your JOIN

<?php
+    $result = db_query('SELECT node.nid as nid, title FROM {node} JOIN {og} WHERE node.nid = og.nid');
?>
needs to use ON instead of WHERE and I like to read the joined criteria on the left.
<?php
+    $result = db_query('SELECT node.nid as nid, title FROM {node} JOIN {og} ON og.nid = node.nid');
?>
But this still isn't enough, since {node} and {og} are replaced with a defined $prefix the statement will fail in those cases where $prefix is defined. The fully corrected version is:
<?php
+    $result = db_query('SELECT n.nid, n.title FROM {node} n JOIN {og} og ON og.nid = n.nid');
?>
Your other queries suffer from the same $prefix fate.

When you upload your new patch please change the status to "patch (code needs review)".

#6

pivica - July 3, 2008 - 17:10
Status:needs work» needs review

Hi earnie,

Thanks for the useful hints and here is new version of patch.

AttachmentSize
advuser.module.og_.patch 6.5 KB

#7

earnie - July 4, 2008 - 21:18
Status:needs review» needs work

Your new functions still need some phpdoc documentation.

<?php
/**
* Example phpdoc documentation
*
* @param int $someint
*  Provide an param sample
* @return bool
*  Operation status
*/
function somefunction ($someint) {
if (
$someint) {
  return
TRUE
}
return
FALSE
}
?>

You might want to check http://manual.phpdoc.org/HTMLframesConverter/DOM/default/ or http://www.stack.nl/~dimitri/doxygen/docblocks.html. I plan to test your patch further beginning Monday.

#8

CHertlein - July 16, 2008 - 16:45

Hey there - this OG stuff seems to work just fine for me. Any plans on making the user search filterable by group membership too?

#9

earnie - July 16, 2008 - 18:51

Thanks for testing and the report. Ivica had mentioned that he was working on a patch for filtering by OG as well. I'm looking forward to it. I've been currently too busy with other things in life and haven't had a chance to give this more attention. We still need the phpdoc documentation comments.

#10

pivica - July 20, 2008 - 10:35

Hi,

Yes I will implement OG filtering but can't tell exactly when - i am also very busy at this moment. But will try to do some work on this and phpdoc next weekend.

#11

pivica - August 14, 2008 - 12:47

Here is new version of patch, this time i also added og filter support. Tested a little bit and Its seems it works fine for 'EQ' operation.

AttachmentSize
advuser.module.og_.patch 7.24 KB
advuser_filters.inc_.og_.patch 1.15 KB

#12

earnie - August 14, 2008 - 15:33

Thanks for the patches. I'm out of cycles for August though I'm afraid. I'll have to review them later.

 
 

Drupal is a registered trademark of Dries Buytaert.