Skip to:
Content

Changeset 11828


Ignore:
Timestamp:
01/27/2018 01:53:26 PM (4 months ago)
Author:
hnla
Message:

Pass additional $args to 'bp_get_new_group_invite_friend_list()`

This function renders markup for the looped item defaulting to 'li' but leaves it to the template to provide the parent element.

Commit provides two new args 'before' & 'after' to allow the function to return the complete element markup if desired, simplifies templates having to render markup and checks for empty function return.

Props DJPaul.

Fixes #7656

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-template.php

    r11805 r11828  
    50195019            'user_id'   => bp_loggedin_user_id(),
    50205020            'group_id'  => false,
    5021             'separator' => 'li'
     5021            'before'    => '',
     5022            'separator' => 'li',
     5023            'after'     => '',
    50225024        ), 'group_invite_friend_list' );
    50235025
     
    50335035        $items = array();
    50345036
     5037        // Build list markup parent elements.
     5038        $before = '';
     5039        if ( ! empty( $r['before'] ) ) {
     5040            $before = $r['before'];
     5041        }
     5042
     5043        $after = '';
     5044        if ( ! empty( $r['after'] ) ) {
     5045            $after = $r['after'];
     5046        }
     5047
    50355048        // Get user's friends who are not in this group already.
    50365049        $friends = friends_get_friends_invite_list( $r['user_id'], $r['group_id'] );
     
    50595072
    50605073        if ( ! empty( $invitable_friends ) && is_array( $invitable_friends ) ) {
    5061             $retval = implode( "\n", $invitable_friends );
     5074            $retval = $before . implode( "\n", $invitable_friends ) . $after;
    50625075        } else {
    50635076            $retval = false;
Note: See TracChangeset for help on using the changeset viewer.