Skip to:
Content

#4736 closed defect (bug) (fixed)

"join group" and similar buttons missing in listings for ajax browsing

Reported by: magnus78 Owned by:
Milestone: 1.7 Priority: low
Severity: minor Version:
Component: Theme Keywords: has-patch
Cc:

Description

The "join group" button is missing in the groups listing when the content was fetched using ajax. This is because the ajax requests go through wp-admin/admin-ajax.php, and adding those buttons is protected by a is_admin() clause.

The same it true for other listings.

Attachments (2)

trac4736_bp_ajax_missing_buttons.patch (2.2 KB) - added by magnus78 16 months ago.
proposed fix
trac4736_bp_ajax_missing_buttons_v2.patch (518 bytes) - added by magnus78 16 months ago.
proposed fix, v2

Download all attachments as: .zip

Change History (7)

magnus7816 months ago

proposed fix

comment:1 magnus7816 months ago

The patch just removes the

if ( !is_admin() )

comment:2 sbrajesh16 months ago

Instead removing if ( !is_admin() )
It will be a better approach to put the condition like this

if ( !is_admin()||(is_admin()&&defined('DOING_AJAX')) ) 


magnus7816 months ago

proposed fix, v2

comment:3 magnus7816 months ago

That works too, dunno if it's worth the bother.

comment:4 boonebgorges16 months ago

  • Milestone changed from Awaiting Review to 1.7
  • Priority changed from normal to low
  • Severity changed from normal to minor

We need the is_admin() check because of some load-order problem that otherwise occur in the dashboard.

comment:5 boonebgorges16 months ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [6679]) Ensure that directory/header buttons are hooked when doing AJAX

Directory buttons (such as Join Group) were previously added only when
!is_admin(), to avoid fatal errors in the Dashboard when certain template
functions were undefined. This caused problems when the directory was refreshed
using AJAX, because is_admin() returns true when making calls to
admin-ajax.php. This changeset does an additional check to make sure that
the buttons are added correctly when DOING_AJAX, even if is_admin() returns
true.

Fixes #4736

Props magnus78, sbrajesh

Note: See TracTickets for help on using tickets.