Skip to:

Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#4736 closed defect (bug) (fixed)

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

Reported by: magnus78's profile magnus78 Owned by:
Milestone: 1.7 Priority: low
Severity: minor Version:
Component: Templates Keywords: has-patch


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 11 years ago.
proposed fix
trac4736_bp_ajax_missing_buttons_v2.patch (518 bytes) - added by magnus78 11 years ago.
proposed fix, v2

Download all attachments as: .zip

Change History (8)

#1 @magnus78
11 years ago

The patch just removes the

if ( !is_admin() )

#2 @sbrajesh
11 years 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')) ) 

#3 @magnus78
11 years ago

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

#4 @boonebgorges
11 years 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.

#5 @boonebgorges
11 years 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

Fixes #4736

Props magnus78, sbrajesh

#6 @DJPaul
8 years ago

  • Component changed from Appearance - Template Parts to Templates
Note: See TracTickets for help on using tickets.