[buddypress-trac] [BuddyPress Trac] #7477: BP_Groups_Group::group_exists() should be cached.
buddypress-trac
noreply at wordpress.org
Sat Apr 1 14:11:37 UTC 2017
#7477: BP_Groups_Group::group_exists() should be cached.
-------------------------+-----------------------
Reporter: dcavins | Owner: dcavins
Type: enhancement | Status: accepted
Priority: normal | Milestone: 2.9
Component: Groups | Version: 2.8.2
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+-----------------------
Comment (by dcavins):
I've attached a new version of the patch to `get()` that changes the
`slug` argument to accept a string, array, or comma- or space-delimited
string.
There are a few ways to get from an array to a quoted, comma-separated
list for use in `IN()`. The new patch follows the pattern used by
`post_name__in` in `WP_Query`:
{{{#!php
$r['slug'] = array_map( 'sanitize_title', $r['slug'] );
$slug_in = "'" . implode( "','", $r['slug'] ) . "'";
}}}
but this pattern I came up with before I looked at `WP_Query` also works:
{{{#!php
foreach ($r['slug'] as $key => $value) {
$r['slug'][$key] = $wpdb->prepare( "%s", sanitize_title( $value )
);
}
$slug_in = implode( ",", $r['slug'] );
}}}
If anyone has a preference, let me know. :)
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7477#comment:11>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list