<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][7645] trunk/bp-groups: Improve documentation in the Groups component.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://buddypress.trac.wordpress.org/changeset/7645">7645</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2013-12-04 02:07:20 +0000 (Wed, 04 Dec 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Improve documentation in the Groups component. See <a href="http://buddypress.trac.wordpress.org/ticket/5022">#5022</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpgroupsbpgroupsbuddybarphp">trunk/bp-groups/bp-groups-buddybar.php</a></li>
<li><a href="#trunkbpgroupsbpgroupscachephp">trunk/bp-groups/bp-groups-cache.php</a></li>
<li><a href="#trunkbpgroupsbpgroupsclassesphp">trunk/bp-groups/bp-groups-classes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpgroupsbpgroupsbuddybarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-buddybar.php (7644 => 7645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-buddybar.php 2013-12-04 02:07:16 UTC (rev 7644)
+++ trunk/bp-groups/bp-groups-buddybar.php 2013-12-04 02:07:20 UTC (rev 7645)
</span><span class="lines">@@ -11,9 +11,10 @@
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Adds menu items to the BuddyBar
</del><ins>+ * Add menu items to the BuddyBar.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.0)
</del><ins>+ * @since BuddyPress (1.0.0)
+ *
</ins><span class="cx"> * @global BuddyPress $bp
</span><span class="cx"> */
</span><span class="cx"> function bp_groups_adminbar_admin_menu() {
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupscachephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-cache.php (7644 => 7645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-cache.php 2013-12-04 02:07:16 UTC (rev 7644)
+++ trunk/bp-groups/bp-groups-cache.php 2013-12-04 02:07:20 UTC (rev 7645)
</span><span class="lines">@@ -14,17 +14,18 @@
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Slurps up groupmeta
</del><ins>+ * Slurp up metadata for a set of groups.
</ins><span class="cx"> *
</span><span class="cx"> * This function is called in two places in the BP_Groups_Group class:
</span><span class="cx"> * - in the populate() method, when single group objects are populated
</span><span class="cx"> * - in the get() method, when multiple groups are queried
</span><span class="cx"> *
</span><del>- * It grabs all groupmeta associated with all of the groups passed in $group_ids and adds it to
- * the WP cache. This improves efficiency when using groupmeta inline
</del><ins>+ * It grabs all groupmeta associated with all of the groups passed in
+ * $group_ids and adds it to WP cache. This improves efficiency when using
+ * groupmeta within a loop context.
</ins><span class="cx"> *
</span><del>- * @param int|str|array $group_ids Accepts a single group_id, or a comma-separated list or array of
- * group ids
</del><ins>+ * @param int|str|array $group_ids Accepts a single group_id, or a
+ * comma-separated list or array of group ids.
</ins><span class="cx"> */
</span><span class="cx"> function bp_groups_update_meta_cache( $group_ids = false ) {
</span><span class="cx"> global $bp;
</span><span class="lines">@@ -40,6 +41,11 @@
</span><span class="cx"> bp_update_meta_cache( $cache_args );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/**
+ * Clear the cached group count.
+ *
+ * @param $group_id Not used.
+ */
</ins><span class="cx"> function groups_clear_group_object_cache( $group_id ) {
</span><span class="cx"> wp_cache_delete( 'bp_total_group_count', 'bp' );
</span><span class="cx"> }
</span><span class="lines">@@ -50,10 +56,11 @@
</span><span class="cx"> add_action( 'groups_create_group_step_complete', 'groups_clear_group_object_cache' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Bust group caches when editing or deleting
</del><ins>+ * Bust group caches when editing or deleting.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.7)
- * @param int $group_id The group being edited
</del><ins>+ * @since BuddyPress (1.7.0)
+ *
+ * @param int $group_id The group being edited.
</ins><span class="cx"> */
</span><span class="cx"> function bp_groups_delete_group_cache( $group_id = 0 ) {
</span><span class="cx"> wp_cache_delete( 'bp_groups_group_' . $group_id . '_load_users', 'bp' );
</span><span class="lines">@@ -65,11 +72,12 @@
</span><span class="cx"> add_action( 'groups_settings_updated', 'bp_groups_delete_group_cache' );
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Clears caches for the group creator when a group is created
</del><ins>+ * Clear caches for the group creator when a group is created.
</ins><span class="cx"> *
</span><del>- * @param int $group_id
- * @param BP_Groups_Group $group_obj
- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @param int $group_id ID of the group.
+ * @param BP_Groups_Group $group_obj Group object.
</ins><span class="cx"> */
</span><span class="cx"> function bp_groups_clear_group_creator_cache( $group_id, $group_obj ) {
</span><span class="cx"> // Clears the 'total groups' for this user
</span><span class="lines">@@ -80,9 +88,10 @@
</span><span class="cx"> /**
</span><span class="cx"> * Clears caches for all members in a group when a group is deleted
</span><span class="cx"> *
</span><del>- * @param BP_Groups_Group $group_obj
- * @param array User IDs who were in this group
- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
+ *
+ * @param BP_Groups_Group $group_obj Group object.
+ * @param array User IDs who were in this group.
</ins><span class="cx"> */
</span><span class="cx"> function bp_groups_clear_group_members_caches( $group_obj, $user_ids ) {
</span><span class="cx"> // Clears the 'total groups' cache for each member in a group
</span><span class="lines">@@ -91,6 +100,12 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'bp_groups_delete_group', 'bp_groups_clear_group_members_caches', 10, 2 );
</span><span class="cx">
</span><ins>+/**
+ * Clear a user's cached group count.
+ *
+ * @param int $group_id ID of the group. Not used in this function.
+ * @param int $user_id ID of the user whose group count is being changed.
+ */
</ins><span class="cx"> function groups_clear_group_user_object_cache( $group_id, $user_id ) {
</span><span class="cx"> wp_cache_delete( 'bp_total_groups_for_user_' . $user_id, 'bp' );
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupsclassesphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-classes.php (7644 => 7645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-classes.php 2013-12-04 02:07:16 UTC (rev 7644)
+++ trunk/bp-groups/bp-groups-classes.php 2013-12-04 02:07:20 UTC (rev 7645)
</span><span class="lines">@@ -10,24 +10,105 @@
</span><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><ins>+/**
+ * BuddyPress Group object.
+ */
</ins><span class="cx"> class BP_Groups_Group {
</span><ins>+
+ /**
+ * ID of the group.
+ *
+ * @access public
+ * @var int
+ */
</ins><span class="cx"> public $id;
</span><ins>+
+ /**
+ * User ID of the group's creator.
+ *
+ * @access public
+ * @var int
+ */
</ins><span class="cx"> public $creator_id;
</span><ins>+
+ /**
+ * Name of the group.
+ *
+ * @access public
+ * @var string
+ */
</ins><span class="cx"> public $name;
</span><ins>+
+ /**
+ * Group slug.
+ *
+ * @access public
+ * @var string
+ */
</ins><span class="cx"> public $slug;
</span><ins>+
+ /**
+ * Group description.
+ *
+ * @access public
+ * @var string
+ */
</ins><span class="cx"> public $description;
</span><ins>+
+ /**
+ * Group status.
+ *
+ * Core statuses are 'public', 'private', and 'hidden'.
+ *
+ * @access public
+ * @var string
+ */
</ins><span class="cx"> public $status;
</span><ins>+
+ /**
+ * Should (legacy) bbPress forums be enabled for this group?
+ *
+ * @access public
+ * @var int
+ */
</ins><span class="cx"> public $enable_forum;
</span><ins>+
+ /**
+ * Date the group was created.
+ *
+ * @access public
+ * @var string
+ */
</ins><span class="cx"> public $date_created;
</span><span class="cx">
</span><ins>+ /**
+ * Data about the group's admins.
+ *
+ * @access public
+ * @var array
+ */
</ins><span class="cx"> public $admins;
</span><ins>+
+ /**
+ * Data about the group's moderators.
+ *
+ * @access public
+ * @var array
+ */
</ins><span class="cx"> public $mods;
</span><ins>+
+ /**
+ * Total count of group members.
+ *
+ * @access public
+ * @var int
+ */
</ins><span class="cx"> public $total_member_count;
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * Is the current user a member of this group?
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.2)
</del><ins>+ * @since BuddyPress (1.2.0)
</ins><span class="cx"> * @var bool
</span><span class="cx"> */
</span><span class="cx"> public $is_member;
</span><span class="lines">@@ -51,7 +132,7 @@
</span><span class="cx"> /**
</span><span class="cx"> * Timestamp of the last activity that happened in this group.
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.2)
</del><ins>+ * @since BuddyPress (1.2.0)
</ins><span class="cx"> * @var string
</span><span class="cx"> */
</span><span class="cx"> public $last_activity;
</span><span class="lines">@@ -59,11 +140,17 @@
</span><span class="cx"> /**
</span><span class="cx"> * If this is a private or hidden group, does the current user have access?
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.6)
</del><ins>+ * @since BuddyPress (1.6.0)
</ins><span class="cx"> * @var bool
</span><span class="cx"> */
</span><span class="cx"> public $user_has_access;
</span><span class="cx">
</span><ins>+ /**
+ * Constructor method.
+ *
+ * @param int $id Optional. If the ID of an existing group is provided,
+ * the object will be pre-populated with info about that group.
+ */
</ins><span class="cx"> public function __construct( $id = null ) {
</span><span class="cx"> if ( !empty( $id ) ) {
</span><span class="cx"> $this->id = $id;
</span><span class="lines">@@ -71,6 +158,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Set up data about the current group.
+ */
</ins><span class="cx"> public function populate() {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -114,6 +204,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Save the current group to the database.
+ *
+ * @return bool True on success, false on failure.
+ */
</ins><span class="cx"> public function save() {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -185,6 +280,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Delete the current group.
+ *
+ * @return bool True on success, false on failure.
+ */
</ins><span class="cx"> public function delete() {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -212,8 +312,16 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- /** Static Methods ********************************************************/
</del><ins>+ /** Static Methods ****************************************************/
</ins><span class="cx">
</span><ins>+ /**
+ * Get whether a group exists for a given slug.
+ *
+ * @param string $slug Slug to check.
+ * @param string $table_name Optional. Name of the table to check
+ * against. Default: $bp->groups->table_name.
+ * @return string|null ID of the group, if one is found, else null.
+ */
</ins><span class="cx"> public static function group_exists( $slug, $table_name = false ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -226,15 +334,48 @@
</span><span class="cx"> return $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$table_name} WHERE slug = %s", strtolower( $slug ) ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Get the ID of a group by the group's slug.
+ *
+ * Alias of {@link BP_Groups_Group::group_exists()}.
+ *
+ * @param string $slug See {@link BP_Groups_Group::group_exists()}.
+ * @return string|null See {@link BP_Groups_Group::group_exists()}.
+ */
</ins><span class="cx"> public static function get_id_from_slug( $slug ) {
</span><span class="cx"> return BP_Groups_Group::group_exists( $slug );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Get IDs of users with outstanding invites to a given group from a specified user.
+ *
+ * @param int $user_id ID of the inviting user.
+ * @param int $group_id ID of the group.
+ * @return array IDs of users who have been invited to the group by the
+ * user but have not yet accepted.
+ */
</ins><span class="cx"> public static function get_invites( $user_id, $group_id ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx"> return $wpdb->get_col( $wpdb->prepare( "SELECT user_id FROM {$bp->groups->table_name_members} WHERE group_id = %d and is_confirmed = 0 AND inviter_id = %d", $group_id, $user_id ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Get a list of a user's groups, filtered by a search string.
+ *
+ * @param string $filter Search term. Matches against 'name' and
+ * 'description' fields.
+ * @param int $user_id ID of the user whose groups are being searched.
+ * Default: the displayed user.
+ * @param mixed $order Not used.
+ * @param int $limit Optional. The max number of results to return.
+ * Default: null (no limit).
+ * @param int $page Optional. The page offset of results to return.
+ * Default: null (no limit).
+ * @return array {
+ * @type array $groups Array of matched and paginated group objects.
+ * @type int $total Total count of groups matching the query.
+ * }
+ */
</ins><span class="cx"> public static function filter_user_groups( $filter, $user_id = 0, $order = false, $limit = null, $page = null ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -263,7 +404,21 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * @todo Deprecate in favor of get()
</del><ins>+ * Get a list of groups, filtered by a search string.
+ *
+ * @param string $filter Search term. Matches against 'name' and
+ * 'description' fields.
+ * @param int $limit Optional. The max number of results to return.
+ * Default: null (no limit).
+ * @param int $page Optional. The page offset of results to return.
+ * Default: null (no limit).
+ * @param string $sort_by Column to sort by. Default: false (default
+ * sort).
+ * @param string $order ASC or DESC. Default: false (default sort).
+ * @return array {
+ * @type array $groups Array of matched and paginated group objects.
+ * @type int $total Total count of groups matching the query.
+ * }
</ins><span class="cx"> */
</span><span class="cx"> public static function search_groups( $filter, $limit = null, $page = null, $sort_by = false, $order = false ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="lines">@@ -290,18 +445,36 @@
</span><span class="cx"> return array( 'groups' => $paged_groups, 'total' => $total_groups );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Check for the existence of a slug.
+ *
+ * @param string $slug Slug to check.
+ * @return string|null The slug, if found. Otherwise null.
+ */
</ins><span class="cx"> public static function check_slug( $slug ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx"> return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE slug = %s", $slug ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Get the slug for a given group ID.
+ *
+ * @param int $group_id ID of the group.
+ * @return string|null The slug, if found. Otherwise null.
+ */
</ins><span class="cx"> public static function get_slug( $group_id ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx"> return $wpdb->get_var( $wpdb->prepare( "SELECT slug FROM {$bp->groups->table_name} WHERE id = %d", $group_id ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Check whether a given group has any members.
+ *
+ * @param int $group_id ID of the group.
+ * @return bool True if the group has members, otherwise false.
+ */
</ins><span class="cx"> public static function has_members( $group_id ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -313,12 +486,33 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Check whether a group has outstanding membership requests.
+ *
+ * @param int $group_id ID of the group.
+ * @return int|null The number of outstanding requests, or null if
+ * none are found.
+ */
</ins><span class="cx"> public static function has_membership_requests( $group_id ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="cx"> return $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(id) FROM {$bp->groups->table_name_members} WHERE group_id = %d AND is_confirmed = 0", $group_id ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Get outstanding membership requests for a group.
+ *
+ * @param int $group_id ID of the group.
+ * @param int $limit Optional. Max number of results to return.
+ * Default: null (no limit).
+ * @param int $page Optional. Page offset of results returned. Default:
+ * null (no limit).
+ * @return array {
+ * @type array $requests The requested page of located requests.
+ * @type int $total Total number of requests outstanding for the
+ * group.
+ * }
+ */
</ins><span class="cx"> public static function get_membership_requests( $group_id, $limit = null, $page = null ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -332,6 +526,55 @@
</span><span class="cx"> return array( 'requests' => $paged_requests, 'total' => $total_requests );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ /**
+ * Query for groups.
+ *
+ * @see WP_Meta_Query::queries for a description of the 'meta_query'
+ * parameter format.
+ *
+ * @param array {
+ * Array of parameters. All items are optional.
+ * @type string $type Optional. Shorthand for certain orderby/
+ * order combinations. 'newest', 'active', 'popular',
+ * 'alphabetical', 'random'. When present, will override
+ * orderby and order params. Default: null.
+ * @type string $orderby Optional. Property to sort by.
+ * 'date_created', 'last_activity', 'total_member_count',
+ * 'name', 'random'. Default: 'date_created'.
+ * @type string $order Optional. Sort order. 'ASC' or 'DESC'.
+ * Default: 'DESC'.
+ * @type int $per_page Optional. Number of items to return per page
+ * of results. Default: null (no limit).
+ * @type int $page Optional. Page offset of results to return.
+ * Default: null (no limit).
+ * @type int $user_id Optional. If provided, results will be limited
+ * to groups of which the specified user is a member. Default:
+ * null.
+ * @type string $search_terms Optional. If provided, only groups
+ * whose names or descriptions match the search terms will be
+ * returned. Default: false.
+ * @type array $meta_query Optional. An array of meta_query
+ * conditions. See {@link WP_Meta_Query::queries} for
+ * description.
+ * @type array|string Optional. Array or comma-separated list of
+ * group IDs. Results will be limited to groups within the
+ * list. Default: false.
+ * @type bool $populate_extras Whether to fetch additional
+ * information (such as member count) about groups. Default:
+ * true.
+ * @type array|string Optional. Array or comma-separated list of
+ * group IDs. Results will exclude the listed groups.
+ * Default: false.
+ * @type bool $show_hidden Whether to include hidden groups in
+ * results. Default: false.
+ * }
+ * @return array {
+ * @type array $groups Array of group objects returned by the
+ * paginated query.
+ * @type int $total Total count of all groups matching non-
+ * paginated query params.
+ * }
+ */
</ins><span class="cx"> public static function get( $args = array() ) {
</span><span class="cx"> global $wpdb, $bp;
</span><span class="cx">
</span><span class="lines">@@ -546,12 +789,12 @@
</span><span class="cx"> * WP_Query, we have to alter the return value (stripping the leading
</span><span class="cx"> * AND keyword from the 'where' clause).
</span><span class="cx"> *
</span><del>- * @since BuddyPress (1.8)
</del><ins>+ * @since BuddyPress (1.8.0)
</ins><span class="cx"> * @access protected
</span><span class="cx"> *
</span><span class="cx"> * @param array $meta_query An array of meta_query filters. See the
</span><del>- * documentation for WP_Meta_Query for details.
- * @return array $sql_array 'join' and 'where' clauses
</del><ins>+ * documentation for {@link WP_Meta_Query} for details.
+ * @return array $sql_array 'join' and 'where' clauses.
</ins><span class="cx"> */
</span><span class="cx"> protected static function get_meta_query_sql( $meta_query = array() ) {
</span><span class="cx"> global $wpdb;
</span><span class="lines">@@ -598,12 +841,16 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Convert the 'type' parameter to 'order' and 'orderby'
</del><ins>+ * Convert the 'type' parameter to 'order' and 'orderby'.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.8)
</del><ins>+ * @since BuddyPress (1.8.0)
</ins><span class="cx"> * @access protected
</span><del>- * @param string $type The 'type' shorthand param
- * @return array 'order' and 'orderby'
</del><ins>+ *
+ * @param string $type The 'type' shorthand param.
+ * @return array {
+ * @type string $order SQL-friendly order string.
+ * @type string $orderby SQL-friendly orderby column name.
+ * }
</ins><span class="cx"> */
</span><span class="cx"> protected static function convert_type_to_order_orderby( $type = '' ) {
</span><span class="cx"> $order = $orderby = '';
</span><span class="lines">@@ -639,12 +886,13 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><del>- * Convert the 'orderby' param into a proper SQL term/column
</del><ins>+ * Convert the 'orderby' param into a proper SQL term/column.
</ins><span class="cx"> *
</span><del>- * @since BuddyPress (1.8)
</del><ins>+ * @since BuddyPress (1.8.0)
</ins><span class="cx"> * @access protected
</span><del>- * @param string $orderby
- * @return string $order_by_term
</del><ins>+ *
+ * @param string $orderby Orderby term as passed to get().
+ * @return string $order_by_term SQL-friendly orderby term.
</ins><span class="cx"> */
</span><span class="cx"> protected static function convert_orderby_to_order_by_term( $orderby ) {
</span><span class="cx"> $order_by_term = '';
</span></span></pre>
</div>
</div>
</body>
</html>