Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Itangalo’s picture

Assigned: Unassigned » Itangalo

I don't get how/why og_get_users() should be used – that function returns the users of a group, not the groups of a user.

But I'm gonna try writing a Views plugin that does what this issue title says. Back soon (I hope).

Itangalo’s picture

Status: Active » Needs review
FileSize
4.38 KB

Tadaa!

Itangalo’s picture

…and here's another patch where the missing EOF blank line is added.

amitaibu’s picture

Status: Needs review » Needs work

Oh, nice! :)

+++ b/includes/og.views.incundefined
@@ -225,5 +225,11 @@ function og_views_plugins() {
+      'og_users_groups' => array(

Should be: og_user_groups

+++ b/includes/og.views.incundefined
@@ -225,5 +225,11 @@ function og_views_plugins() {
+        'handler' => 'og_plugin_argument_default_users_groups',

Also here: ...default_user_groups (not S in user).

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+ * Gets the GIDs of all the groups a user belongs to, for use by Views.

Maybe better: Get all the group ID a user is an active member in.

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+ * This function is primarily used to load arguments (contextual value filters)

We can remove this part.

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+function og_get_groups_by_user($account = NULL, $glue = '+') {

We don't need the glue here. Let Views deal with it, as this is a general API function can be consumed by non-Views as-well.

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+  if (!isset($account->uid)) {

No need for babysitting, let's remove this part.

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+    ->propertyCondition('etid', $account->uid);

Lets also check for state == OG_STATE_ACTIVE

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+    $gids = array_keys($result['og_membership']);

That's not right. You need to og_memebrship_load_multiple() those og_memberships and extract the group Id from them (the key you get is the og-membership ID).

+++ b/og.moduleundefined
@@ -2958,3 +2958,55 @@ function og_needs_migrate($migrate = NULL) {
+    return '';

Since it's an API function, let's return NULL. The views handler should deal with empty string, if indeed needed.

Itangalo’s picture

Cool! I'm on it.

Itangalo’s picture

There!

1) I changed the og_get_user_groups() to return an array, which I felt made sense.

2) I spent some time looking for a way to get EntityFieldQuery to return more properties than the standard entity stubs, but I couldn't find it. I think I read in Drupal 7 module development that it can be done, but the book is not nearby. (That would save a few extra loads, which would be nice.)

amitaibu’s picture

Status: Needs work » Fixed

Thanks!
I've cleaned up a bit, and committed. I've also added a new default View called "OG all user group content"

Last follow up we need to do, is show a select list from the entity-type in the filter, rather than a textbox, but that's minor.

Itangalo’s picture

Hooray! That means I can screencast!

pelicani’s picture

This is a great improvement.
Does it let you sort the group content nodes by their posted date without regard to which group they are in?
We want to show all a user group posts without grouping by group.
heh. these terms are confusing, eh.

pelicani’s picture

I tried to remove the 'grouping' from the view format settings and it removed the group name.
that answers my question #9.
sweet.
again, nice improvements, eh.

Status: Fixed » Closed (fixed)

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

MD3’s picture

Any way we can get a 1.3.1 version of OG with this in it? This seems to be a more requested feature and a lot of us would rather not move to a dev version if we can avoid it. Thanks!