Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/04/2018 01:59:40 PM (9 years ago)
Author:
djpaul
Message:

Nouveau: fix AJAX template loading.

r11821 broke the loading of some AJAX templates in Nouveau. Specifically, the backward compatibility in it was focused only on the group_members special case from bp-legacy, but Nouveau uses the template parameter in more places.

Fixes #7689

Props boonebgorges

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/includes/ajax.php

    r11858 r11876  
    8888        }
    8989
    90         // The template part can be overridden by the calling JS function.
    91         if ( ! empty( $_POST['template'] ) && 'groups/single/members' === $_POST['template'] && 'group_members' === $object ) {
    92                 $template_part = 'groups/single/members.php';
    93         } else {
    94                 $template_part = $object . '/' . $object . '-loop.php';
     90        // Get the template path based on the 'template' variable via the AJAX request.
     91        $template = isset( $_POST['template'] ) ? wp_unslash( $_POST['template'] ) : '';
     92
     93        switch ( $template ) {
     94                case 'group_members' :
     95                case 'groups/single/members' :
     96                        $template_part = 'groups/single/members-loop.php';
     97                break;
     98
     99                case 'group_requests' :
     100                        $template_part = 'groups/single/requests-loop.php';
     101                break;
     102
     103                case 'member_notifications' :
     104                        $template_part = 'members/single/notifications/notifications-loop.php';
     105                break;
     106
     107                default :
     108                        $template_part = $object . '/' . $object . '-loop.php';
     109                break;
    95110        }
    96111
Note: See TracChangeset for help on using the changeset viewer.