Support » Plugin: Paid Memberships Pro - BuddyPress Add On » Suggesting a patch

  • Hello Team,

    I’m writing to report an oversight in Paid Memberships Pro – BuddyPress Add On version 1.1.1.

    Right after line 34 of includes/directory.php:

    $query_array->query_vars['include'] = array_intersect( $query_array->query_vars['include'], $pmpro_bp_members_in_directory );

    this code should be inserted:

    if (count ($query_array->query_vars['include']) == 0) $query_array->query_vars['include'] = array (0);

    Otherwise, when the intersection is empty, the directory will show all the users instead of ‘no results found’.

    Thank you for looking into this!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You are the BOMB!!! Thank you Andrea!! (That’s my name too 🙂 )

    For me it was line 74 under // Only include members in the directory.

    Replace

    $query_array->query_vars[‘include’] = $pmpro_bp_members_in_directory;

    with

    if (count ($query_array->query_vars[‘include’]) == 0) $query_array->query_vars[‘include’] = array (0);

    jamesatibbets

    (@jamesatibbets)

    @commandrea That worked for me too! Thanks you all!

    You absolute legends. @commandrea worked for me too 😀 I was losing my mind trying to figure this out

    Version 1.2.3 fixed this way:

    if( is_array( $query_array->query_vars['include'] ) ) {
    	// Compute the intersect of members and include value.
    	$query_array->query_vars['include'] = array_intersect( $query_array->query_vars['include'], $pmpro_bp_members_in_directory );
    	if (count ($query_array->query_vars['include']) == 0)
    		$query_array->query_vars['include'] = array (0);
    } else {
    	if (is_string($query_array->query_vars['include']) && $query_array->query_vars['include'] == "0")
    		$query_array->query_vars['include'] = array (0);
    	else {
    		// Only include members in the directory.
    		$query_array->query_vars['include'] = $pmpro_bp_members_in_directory;
    	}
    }

    Thanks @commandrea. That was a great help. I have another issue. I want only show the searched results and not all the members. Any solution is appreciated.

    • This reply was modified 5 months, 3 weeks ago by kusatra.
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.