https://redmine.gc.cuny.edu/https://redmine.gc.cuny.edu/favicon.ico2012-10-11T17:07:44ZCUNY Graduate Center - Project Tracking SystemCUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=94382012-10-11T17:07:44ZDominic Gigliohumanshell@gmail.com
<ul><li><strong>Target version</strong> changed from <i>1.4.7</i> to <i>1.4.8</i></li></ul> CUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=95752012-10-22T04:57:08ZDominic Gigliohumanshell@gmail.com
<ul><li><strong>Target version</strong> changed from <i>1.4.8</i> to <i>1.4.9</i></li></ul> CUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=96652012-11-01T06:26:41ZDominic Gigliohumanshell@gmail.com
<ul><li><strong>File</strong> <a href="/attachments/830">Screen_Shot_2012-11-01_at_2.24.48_AM.png</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/830/Screen_Shot_2012-11-01_at_2.24.48_AM.png">Screen_Shot_2012-11-01_at_2.24.48_AM.png</a> added</li></ul><p>Boone,</p>
<p>I believe I've found a small bug in the BP core that's causing this issue.</p>
<p>Here's what this issue boils down to:</p>
<p>The "My Groups" item in the "My Commons" menu is created by the <code>setup_admin_bar()</code> function starting on line 487 of <code>bp-groups-loader.php</code>. It calls <code>groups_get_invites_for_user()</code> from line 557 of <code>bp-groups-functions.php</code>. That function returns the result of calling the static method <code>BP_Groups_Member::get_invites()</code> from line 1024 of <code>bp-groups-classes.php</code>. That return value is an associative array with two keys: 'groups' and 'total'. It's the latter that's being checked and used in <code>setup_admin_bar()</code>. But it's using '->' notation instead of '[]' like it's a stdObject. As soon as I changed it from <code>$count->total</code> to <code>$count['total']</code> the menu correctly displayed the proper number of pending invites. (screenshot attached)</p>
<p>I say I "believe" that I've found a bug in core because this seems like an incredibly obvious bug and I can't believe it hasn't been caught yet. Let me know what you think and if I should open a Trac ticket for the community to investigate.</p> CUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=96952012-11-01T20:18:15ZBoone Gorgesboone@gorg.es
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Resolved</i></li></ul><p>Good catch. Looks like this had already been fixed for trunk. I've backported the fix to the 1.6 branch. <a class="external" href="https://buddypress.trac.wordpress.org/ticket/4417">https://buddypress.trac.wordpress.org/ticket/4417</a><br /><a class="external" href="https://buddypress.trac.wordpress.org/changeset/6481">https://buddypress.trac.wordpress.org/changeset/6481</a></p>
<p>Applied to CAC in <a class="external" href="https://github.com/castiron/cac/commit/8a3ec8a58993b8f3322b77bf5e9792bfe2d63a81">https://github.com/castiron/cac/commit/8a3ec8a58993b8f3322b77bf5e9792bfe2d63a81</a></p> CUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=96962012-11-01T20:26:52ZDominic Gigliohumanshell@gmail.com
<ul></ul><p>Awesome, but you missed one small spot in our repo.</p>
<p>Line 505 of bp-groups-loader.php:</p>
<pre>
if ( !empty( $count->total ) )
</pre>
<p>Has to be changed as well or that if() will never be true.</p> CUNY Academic Commons - Bug #2086: Groups > Invitations reads "No Pending Invites" even when there arehttps://redmine.gc.cuny.edu/issues/2086?journal_id=96992012-11-01T20:33:49ZBoone Gorgesboone@gorg.es
<ul></ul><p>D'oh</p>
<p><a class="external" href="http://buddypress.trac.wordpress.org/changeset/6482">http://buddypress.trac.wordpress.org/changeset/6482</a><br /><a class="external" href="https://github.com/castiron/cac/commit/4db396f06869a0797114b5af7113846cc5ec481f">https://github.com/castiron/cac/commit/4db396f06869a0797114b5af7113846cc5ec481f</a></p>