Og views group audience filter validation doesn't manage multiple arguments
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #2593333. -->
Reported by: [pabloid](https://www.drupal.org/user/301445)
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Hi!<br>
I created a view that filter contents by their Group Audience, so I added a contextual filter on "Content: Group Audience"<br>
and I checked the "Specify validation criteria" with OG Group as validator, Node as Group type and "Allow multiple values" box in the "More" section of the filter settings.</p>
<p>The view worked fine until the Drupal core update from 7.36 to 7.37 (<a href="https://www.drupal.org/drupal-7.37-release-notes" target="_blank">here release notes</a>), then it broke due to the add to entity.inc (line 186) of </p>
<div class="codeblock">
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br> </span><span style="color: #FF8000">// Ensure integer entity IDs are valid.<br> </span><span style="color: #007700">if (!empty(</span><span style="color: #0000BB">$ids</span><span style="color: #007700">)) {<br> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">cleanIds</span><span style="color: #007700">(</span><span style="color: #0000BB">$ids</span><span style="color: #007700">);<br> }<br></span><span style="color: #0000BB">?></span></span></pre></div>
<p>Searching a bit into the code I found that the entity.inc was called by entity_load_single() in the validate_argument() of og_plugin_argument_validate_group.inc (line 37). The issue is due to from validation that doesn't manage correctly multiple arguments:</p>
<div class="codeblock">
<pre><span style="color: #000000"><span style="color: #0000BB"><?php<br> </span><span style="color: #007700">function </span><span style="color: #0000BB">validate_argument</span><span style="color: #007700">(</span><span style="color: #0000BB">$argument</span><span style="color: #007700">) {<br> if (empty(</span><span style="color: #0000BB">$argument</span><span style="color: #007700">)) {<br> return;<br> }<br> </span><span style="color: #0000BB">$group_type </span><span style="color: #007700">= </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">options</span><span style="color: #007700">[</span><span style="color: #DD0000">'group_type'</span><span style="color: #007700">];<br> </span><span style="color: #0000BB">$entity </span><span style="color: #007700">= </span><span style="color: #0000BB">entity_load_single</span><span style="color: #007700">(</span><span style="color: #0000BB">$group_type</span><span style="color: #007700">, </span><span style="color: #0000BB">$argument</span><span style="color: #007700">);<br> if (!</span><span style="color: #0000BB">$entity </span><span style="color: #007700">|| !</span><span style="color: #0000BB">og_is_group</span><span style="color: #007700">(</span><span style="color: #0000BB">$group_type</span><span style="color: #007700">, </span><span style="color: #0000BB">$entity</span><span style="color: #007700">)) {<br> return </span><span style="color: #0000BB">FALSE</span><span style="color: #007700">;<br> }<br><br> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">argument</span><span style="color: #007700">-></span><span style="color: #0000BB">argument </span><span style="color: #007700">= </span><span style="color: #0000BB">$argument</span><span style="color: #007700">;<br> </span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">argument</span><span style="color: #007700">-></span><span style="color: #0000BB">validated_title </span><span style="color: #007700">= </span><span style="color: #0000BB">entity_label</span><span style="color: #007700">(</span><span style="color: #0000BB">$group_type</span><span style="color: #007700">, </span><span style="color: #0000BB">$entity</span><span style="color: #007700">);<br> return </span><span style="color: #0000BB">TRUE</span><span style="color: #007700">;<br> }<br></span><span style="color: #0000BB">?></span></span></pre></div>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>My propose is to upgrade the validate_argument of og_plugin_argument_validate_group.inc to correctly manage multiple arguments, as it already does with single arg.</p>
issue