managelink field handler has unpredictable results outside of a group context
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #701420. -->
Reported by: [yhahn](https://www.drupal.org/user/264833)
>>>
<p>The <strong>OG: Approve/Deny/Remove membership link</strong> handler adds the <code>og_uid.nid</code> additional field to Views queries but doesn't check to see whether there is a WHERE clause on this field. This means that the rendered link may have rather unpredictable results as to which group membership you are editing when the field is used without a group argument/filter.</p>
<p>Two possible options seem reasonable to me:</p>
<p>- Check the <code>$view->query</code> object for a WHERE clause against <code>og_uid.nid</code>. While at first glance more accurate, it can become a very convoluted check as you need to ensure the WHERE will filter against only one nid -- multiple nids will again create confusion.<br>
- Check <code>og_get_group_context()</code> against the nid returned by the Views query. This appears to cover most sensible use cases, as the Views OG argument handler will set the group context anyway.</p>
<p>The attached patch takes the 2nd route. Applies against DRUPAL-6--2 and 2.0 stable as well.</p>
issue