Titles are not unique 'per group'
Justin Hopkins - March 17, 2009 - 20:22
| Project: | OG Titles |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | mradcliffe |
| Status: | closed |
Description
Titles assigned in one group carry over to all other groups. A user who is a 'Member' in one group but 'Committee Chair' in another (for instance) will be listed as whichever was created first.
To make things worse, if their title is set in the second group - they will have 2 entries in that group. Clearly, multiple values are able to be stored for each user, but views is unable to filter this and lists the user for each title.

#1
Hmm, it seems that the
"Organic groups: Group node (member)" relationship breaks things. I'm going to have to re-investigate the best way to do views support.
Thank you.
#2
It looks like the best way to do this is not to use the og_uid table at all, but to duplicate functionality of it instead. :|
Still working on things.
#3
Thanks for looking at it. Sounds like it's in good hands!
#4
How's this coming? I'm happy to help test and possibly muck around with the code. I want to get this working and there's a very similar issue in OG User Roles involving similar functionality, with the group context not being taken into account with the filter handler.
#406762: Using Views to show users with a particular OGUR role in a group
#5
I'd be happy to contribute my time and effort on this one too - but I'm really more of a novice and have been confounded looking at the module trying to understand why this isn't working.
One of my personal and professional goals is to better understand how to contribute modules, so if you can suggest any reading that might help me grok this - I'd certainly love to dive in!
#6
I keep running into an issue trying to join directly with the og_uid table. Whenever I do that none of my views fields or filters show up! If I duplicate functionality of og's og_uid views, then I have to include a bunch of duplicate views data, which may make things more confusing.
Basically, I wish I could do this:
<?php$data['og_uid_titles']['table']['join'] = array(
'og_uid' => array(
'left_field' => 'uid',
'field' => 'uid',
'extra' => '{og_uid}.nid = {og_uid_titles}.nid',
),
);
?>
Instead of
<?php
$data['og_uid_titles']['table']['join'] = array(
// this is what $data['og_uid']['table']['join'] = array( does too
'users' => array(
'left_field' => 'uid',
'field' => 'uid',
'node' => array(
'left_field' => 'nid',
'field' => 'nid',
),
);
$data['og_uid_titles']['nid'] = array(
'title' => t('Group Titles: Group id'),
'help' => t('The group id of the group'),
'relationship' => array(
'handler' => 'views_handler_relationship',
'base' => 'node',
'relationship field' => 'nid',
'label' => t('Group node (member)'),
),
'argument' => array(
'title' => t('Group node'),
'handler' => 'og_views_handler_argument_og_uid_nid',
'help' => t('This is the same argument as og_uid table.'),
),
);
// and so on duplicating everything og_uid does so you have the same functionality...
?>
This og issue is interesting though #388936: OG Views: user's groups field.
#7
Yeah so I saw #408372: Joining tables to og_uid in custom module and it looks like moshe doesn't have anything to offer. That's too bad.
Do you have the functionality working with the 'non-ideal' solution?
#8
I have a patch that changes how og_titles views works. You shouldn't try adding fields or filters via og_uids default views though. Maybe try using og development/head which has a patch that adds an alternate way of filtering og members. I really do wish that I could integrate this so that you could just override og faces or og list views.
Also, the default view won't work, you need to create your own.
#9
Thanks for the patch, but I have to be honest and say I really don't understand what you mean when you say: "You shouldn't try adding fields or filters via og_uids default views though." What is another way to create a per group view on each groups page?
#10
I have a better workaround now, but it probably still needs additional work/testing.
I implement the join with og_uid as a relationship. If you use the "Group Title: Membership" relationship you should be able to pull in the og_uid fields, sorts, and filters without any duplication. To get the nodes you need to use "Group Title: Group Id" or whatever it is called.
Just recently committed to CVS (http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/og_titles/o...).
Probably best to wipe out the directory and import from cvs if you don't want to wait for the snapshot release to update tonight.
#11
Awesome thanks so much Matthew!
After looking at the new view you included in the cvs version I was able to replicate it with my existing views just by adding the two new relationships.
You rock dude! I wish I had had a chance to meet you in person at Drupalcon D.C.
#12
#13
Automatically closed -- issue fixed for 2 weeks with no activity.
#14
Just wanted to Also Say thanks for working this out!! Helped to resolve my Dupe problem by changing the relationship.
so um yeah.... THANK-YOU!