Skip to:
Content

BuddyPress.org

Changeset 9982


Ignore:
Timestamp:
06/30/2015 06:22:31 AM (9 years ago)
Author:
tw2113
Message:

Further docs cleanup for BP Groups component.

See #6401.

Location:
trunk/src/bp-groups
Files:
4 edited

Legend:

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

    r9906 r9982  
    22
    33/**
    4  * BuddyPress Groups Actions
     4 * BuddyPress Groups Actions.
    55 *
    66 * Action functions are exactly the same as screen functions, however they do
     
    6363     * @since BuddyPress (2.1.0)
    6464     *
    65      * @param bool $user_has_access True if the user has access to the
    66      *        content, otherwise false.
    67      * @param array $no_access_args Arguments to be passed to
    68      *        bp_core_no_access() in case of no access. Note that this
    69      *        value is passed by reference, so it can be modified by the
    70      *        filter callback.
     65     * @param bool  $user_has_access True if the user has access to the
     66     *                               content, otherwise false.
     67     * @param array $no_access_args  Arguments to be passed to bp_core_no_access() in case
     68     *                               of no access. Note that this value is passed by reference,
     69     *                               so it can be modified by the filter callback.
    7170     */
    7271    $user_has_access = apply_filters_ref_array( 'bp_group_user_has_access', array( $user_has_access, &$no_access_args ) );
    7372
    74     // If user has access, we return rather than redirect
     73    // If user has access, we return rather than redirect.
    7574    if ( $user_has_access ) {
    7675        return;
     
    7978    // Hidden groups should return a 404 for non-members.
    8079    // Unset the current group so that you're not redirected
    81     // to the default group tab
     80    // to the default group tab.
    8281    if ( 'hidden' == $current_group->status ) {
    8382        buddypress()->groups->current_group = 0;
  • trunk/src/bp-groups/classes/class-bp-group-extension.php

    r9907 r9982  
    11<?php
    22/**
    3  * BuddyPress Groups Classes
     3 * BuddyPress Groups Classes.
    44 *
    55 * @package BuddyPress
     
    291291
    292292    /**
    293      * The content of the group tab
     293     * The content of the group tab.
    294294     *
    295295     * @param int|null $group_id
     
    319319
    320320    /**
    321      * Initialize the extension, using your config settings
     321     * Initialize the extension, using your config settings.
    322322     *
    323323     * Your plugin should call this method at the very end of its
     
    339339     * @param array $args {
    340340     *     Array of initialization arguments.
    341      *     @type string $slug Unique, URL-safe identifier for your
    342      *           extension.
    343      *     @type string $name Translatable name for your extension. Used to
    344      *           populate navigation items.
    345      *     @type string $visibility Optional. Set to 'public' for your
    346      *           extension (the main tab as well as the widget) to be
    347      *           available to anyone who can access the group; set to
    348      *           'private' otherwise. Default: 'public'.
    349      *     @type int $nav_item_position Optional. Location of the nav item
    350      *           in the tab list. Default: 81.
    351      *     @type bool $enable_nav_item Optional. Whether the extension's
    352      *           tab should be accessible to anyone who can view the group.
    353      *           Default: true.
    354      *     @type string $nav_item_name Optional. The translatable text you
    355      *           want to appear in the nav tab. Default: the value of $name.
    356      *     @type string $display_hook Optional. The WordPress action that
    357      *           the widget_display() method is hooked to.
    358      *           Default: 'groups_custom_group_boxes'.
    359      *     @type string $template_file Optional. Theme-relative path to the
    360      *           template file BP should use to load the content of your
    361      *           main extension tab. Default: 'groups/single/plugins.php'.
    362      *     @type array $screens A multi-dimensional array of configuration
    363      *           information for the extension screens. See docblock of
    364      *           {@link BP_Group_Extension} for more details.
    365      *     @type string|array $access Which users can visit the plugin's tab.
    366      *           Possible values: 'anyone', 'loggedin', 'member',
    367      *           'mod', 'admin' or 'noone'. ('member', 'mod', 'admin'
    368      *           refer to user's role in group.) Note that 'mod' targets only
    369      *           group moderators. If you want to allow access to group
    370      *           moderators and admins, specify `array( 'mod', 'admin' )`.
    371      *           Defaults to 'anyone' for public groups and 'member' for
    372      *           private groups.
    373      *     @type string|array $show_tab Which users can see the plugin's
    374      *           navigation tab.
    375      *           Possible values: 'anyone', 'loggedin', 'member',
    376      *           'mod', 'admin' or 'noone'. ('member', 'mod', 'admin'
    377      *           refer to user's role in group.) Note that 'mod' targets only
    378      *           group moderators. If you want to show the tab to group
    379      *           moderators and admins, specify `array( 'mod', 'admin' )`.
    380      *           Defaults to 'anyone' for public groups and 'member' for
    381      *           private groups.
     341     *     @type string       $slug            Unique, URL-safe identifier for your
     342     *                                         extension.
     343     *     @type string       $name            Translatable name for your extension. Used to
     344     *                                         populate navigation items.
     345     *     @type string       $visibility      Optional. Set to 'public' for your
     346     *                                         extension (the main tab as well as the widget) to be
     347     *                                         available to anyone who can access the group; set to
     348     *                                         'private' otherwise. Default: 'public'.
     349     *     @type int          $nav_item_       Position Optional. Location of the nav item
     350     *                                         in the tab list. Default: 81.
     351     *     @type bool         $enable_nav_item Optional. Whether the extension's tab should be
     352     *                                         accessible to anyone who can view the group.
     353     *                                         Default: true.
     354     *     @type string       $nav_item_name   Optional. The translatable text you want to appear
     355     *                                         in the nav tab. Default: the value of $name.
     356     *     @type string       $display_hook    Optional. The WordPress action that
     357     *                                         the widget_display() method is hooked to.
     358     *                                         Default: 'groups_custom_group_boxes'.
     359     *     @type string       $template_file   Optional. Theme-relative path to the template file
     360     *                                         BP should use to load the content of your main
     361     *                                         extension tab. Default: 'groups/single/plugins.php'.
     362     *     @type array        $screens         A multi-dimensional array of configuration
     363     *                                         information for the extension screens. See docblock of
     364     *                                         {@link BP_Group_Extension} for more details.
     365     *     @type string|array $access          Which users can visit the plugin's tab.
     366     *                                         Possible values: 'anyone', 'loggedin', 'member',
     367     *                                         'mod', 'admin' or 'noone'. ('member', 'mod', 'admin'
     368     *                                         refer to user's role in group.) Note that 'mod' targets only
     369     *                                         group moderators. If you want to allow access to group
     370     *                                         moderators and admins, specify `array( 'mod', 'admin' )`.
     371     *                                         Defaults to 'anyone' for public groups and 'member' for
     372     *                                         private groups.
     373     *     @type string|array $show_tab        Which users can see the plugin's navigation tab.
     374     *                                         Possible values: 'anyone', 'loggedin', 'member',
     375     *                                         'mod', 'admin' or 'noone'. ('member', 'mod', 'admin'
     376     *                                         refer to user's role in group.) Note that 'mod' targets only
     377     *                                         group moderators. If you want to show the tab to group
     378     *                                         moderators and admins, specify `array( 'mod', 'admin' )`.
     379     *                                         Defaults to 'anyone' for public groups and 'member' for
     380     *                                         private groups.
    382381     * }
    383382     */
     
    679678     *
    680679     * @param string $access_condition 'anyone', 'loggedin', 'member',
    681      *        'mod', 'admin' or 'noone'.
     680     *                                 'mod', 'admin' or 'noone'.
    682681     * @return bool
    683682     */
     
    768767
    769768    /**
    770      * Hook the main display method, and loads the template file
     769     * Hook the main display method, and loads the template file.
    771770     */
    772771    public function _display_hook() {
     
    803802     * @since BuddyPress (2.1.0)
    804803     *
     804     * @param bool $user_can_see_nav_item
     805     *
    805806     * @return bool
    806807     */
     
    818819     * @since BuddyPress (2.1.0)
    819820     *
     821     * @param bool $user_can_visit
     822     *
    820823     * @return bool
    821824     */
     
    837840     * @since BuddyPress (2.1.0)
    838841     *
    839      * @param bool $user_can_visit
     842     * @param bool  $user_can_visit
    840843     * @param array $no_access_args
     844     *
    841845     * @return bool
    842846     */
     
    11131117     *
    11141118     * @param string $screen The markup to check.
     1119     *
    11151120     * @return bool True if a Submit button is found, otherwise false.
    11161121     */
     
    11711176
    11721177    /**
    1173      * Check the nonce, and call the admin_screen_save() method
     1178     * Check the nonce, and call the admin_screen_save() method.
    11741179     *
    11751180     * @since BuddyPress (1.8.0)
     
    12401245     *
    12411246     * @param string $context Screen context. 'create', 'edit', or 'admin'.
     1247     *
    12421248     * @return bool True if the screen is enabled, otherwise false.
    12431249     */
     
    12871293     *
    12881294     * @param string $context Screen context. 'create', 'edit', or 'admin'.
    1289      * @param string $type Screen type. 'screen' or 'screen_save'. Default:
    1290      *        'screen'.
     1295     * @param string $type    Screen type. 'screen' or 'screen_save'. Default:
     1296     *                        'screen'.
     1297     *
    12911298     * @return callable A callable function handle.
    12921299     */
     
    13381345     * @param array $a First set of arguments.
    13391346     * @param array $b Second set of arguments.
     1347     *
    13401348     * @return array Parsed arguments.
    13411349     */
     
    13811389     *
    13821390     * @param string $key Property name.
     1391     *
    13831392     * @return mixed The value if found, otherwise null.
    13841393     */
     
    14051414     *
    14061415     * @param string $key Property name.
     1416     *
    14071417     * @return bool True if the value is set, otherwise false.
    14081418     */
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r9906 r9982  
    11<?php
    22/**
    3  * BuddyPress Groups Classes
     3 * BuddyPress Groups Classes.
    44 *
    55 * @package BuddyPress
     
    160160     * @param array    $args {
    161161     *     Array of optional arguments.
    162      *     @type bool $populate_extras Whether to fetch "extra" data about
    163      *           the group (group admins/mods, access for the current user).
    164      *           Default: false.
     162     *     @type bool $populate_extras Whether to fetch "extra" data about the group
     163     *                                 (group admins/mods, access for the current user).
     164     *                                 Default: false.
    165165     * }
    166166     */
     
    444444     *
    445445     * @param string $slug See {@link BP_Groups_Group::group_exists()}.
     446     *
    446447     * @return string|null See {@link BP_Groups_Group::group_exists()}.
    447448     */
     
    455456     * @param int $user_id ID of the inviting user.
    456457     * @param int $group_id ID of the group.
     458     *
    457459     * @return array IDs of users who have been invited to the group by the
    458      *         user but have not yet accepted.
     460     *               user but have not yet accepted.
    459461     */
    460462    public static function get_invites( $user_id, $group_id ) {
     
    469471     * Get a list of a user's groups, filtered by a search string.
    470472     *
    471      * @param string $filter Search term. Matches against 'name' and
    472      *        'description' fields.
    473      * @param int $user_id ID of the user whose groups are being searched.
    474      *        Default: the displayed user.
    475      * @param mixed $order Not used.
    476      * @param int|null $limit Optional. The max number of results to return.
    477      *        Default: null (no limit).
    478      * @param int|null $page Optional. The page offset of results to return.
    479      *        Default: null (no limit).
     473     * @param string   $filter Search term. Matches against 'name' and
     474     *                          'description' fields.
     475     * @param int      $user_id ID of the user whose groups are being searched.
     476     *                          Default: the displayed user.
     477     * @param mixed    $order  Not used.
     478     * @param int|null $limit   Optional. The max number of results to return.
     479     *                          Default: null (no limit).
     480     * @param int|null $page    Optional. The page offset of results to return.
     481     *                          Default: null (no limit).
    480482     * @return false|array {
    481483     *     @type array $groups Array of matched and paginated group objects.
    482      *     @type int $total Total count of groups matching the query.
     484     *     @type int   $total Total count of groups matching the query.
    483485     * }
    484486     */
     
    515517     * Get a list of groups, filtered by a search string.
    516518     *
    517      * @param string $filter Search term. Matches against 'name' and
    518      *        'description' fields.
    519      * @param int|null $limit Optional. The max number of results to return.
    520      *        Default: null (no limit).
    521      * @param int|null $page Optional. The page offset of results to return.
    522      *        Default: null (no limit).
     519     * @param string      $filter Search term. Matches against 'name' and
     520     *                             'description' fields.
     521     * @param int|null    $limit  Optional. The max number of results to return.
     522     *                             Default: null (no limit).
     523     * @param int|null    $page    Optional. The page offset of results to return.
     524     *                             Default: null (no limit).
    523525     * @param string|bool $sort_by Column to sort by. Default: false (default
    524526     *        sort).
    525      * @param string|bool $order ASC or DESC. Default: false (default sort).
     527     * @param string|bool $order   ASC or DESC. Default: false (default sort).
     528     *
    526529     * @return array {
    527530     *     @type array $groups Array of matched and paginated group objects.
    528      *     @type int $total Total count of groups matching the query.
     531     *     @type int   $total Total count of groups matching the query.
    529532     * }
    530533     */
     
    560563     *
    561564     * @param string $slug Slug to check.
     565     *
    562566     * @return string|null The slug, if found. Otherwise null.
    563567     */
     
    574578     *
    575579     * @param int $group_id ID of the group.
     580     *
    576581     * @return string|null The slug, if found. Otherwise null.
    577582     */
     
    588593     *
    589594     * @param int $group_id ID of the group.
     595     *
    590596     * @return bool True if the group has members, otherwise false.
    591597     */
     
    607613     *
    608614     * @param int $group_id ID of the group.
     615     *
    609616     * @return int|null The number of outstanding requests, or null if
    610      *         none are found.
     617     *                  none are found.
    611618     */
    612619    public static function has_membership_requests( $group_id ) {
     
    621628     * Get outstanding membership requests for a group.
    622629     *
    623      * @param int $group_id ID of the group.
    624      * @param int|null $limit Optional. Max number of results to return.
    625      *        Default: null (no limit).
    626      * @param int|null $page Optional. Page offset of results returned. Default:
    627      *        null (no limit).
     630     * @param int      $group_id ID of the group.
     631     * @param int|null $limit    Optional. Max number of results to return.
     632     *                           Default: null (no limit).
     633     * @param int|null $page     Optional. Page offset of results returned. Default:
     634     *                           null (no limit).
    628635     * @return array {
    629636     *     @type array $requests The requested page of located requests.
    630      *     @type int $total Total number of requests outstanding for the
    631      *           group.
     637     *     @type int   $total    Total number of requests outstanding for the
     638     *                           group.
    632639     * }
    633640     */
     
    655662     * @param array {
    656663     *     Array of parameters. All items are optional.
    657      *     @type string $type Optional. Shorthand for certain orderby/
    658      *           order combinations. 'newest', 'active', 'popular',
    659      *           'alphabetical', 'random'. When present, will override
    660      *           orderby and order params. Default: null.
    661      *     @type string $orderby Optional. Property to sort by.
    662      *           'date_created', 'last_activity', 'total_member_count',
    663      *           'name', 'random'. Default: 'date_created'.
    664      *     @type string $order Optional. Sort order. 'ASC' or 'DESC'.
    665      *           Default: 'DESC'.
    666      *     @type int $per_page Optional. Number of items to return per page
    667      *           of results. Default: null (no limit).
    668      *     @type int $page Optional. Page offset of results to return.
    669      *           Default: null (no limit).
    670      *     @type int $user_id Optional. If provided, results will be limited
    671      *           to groups of which the specified user is a member. Default:
    672      *           null.
    673      *     @type string $search_terms Optional. If provided, only groups
    674      *           whose names or descriptions match the search terms will be
    675      *           returned. Default: false.
    676      *     @type array $meta_query Optional. An array of meta_query
    677      *           conditions. See {@link WP_Meta_Query::queries} for
    678      *           description.
    679      *     @type array|string Optional. Array or comma-separated list of
    680      *           group IDs. Results will be limited to groups within the
    681      *           list. Default: false.
    682      *     @type bool $populate_extras Whether to fetch additional
    683      *           information (such as member count) about groups. Default:
    684      *           true.
    685      *     @type array|string $exclude Optional. Array or comma-separated
    686      *           list of group IDs. Results will exclude the listed groups.
    687      *           Default: false.
    688      *     @type bool $update_meta_cache Whether to pre-fetch groupmeta for
    689      *           the returned groups. Default: true.
    690      *     @type bool $show_hidden Whether to include hidden groups in
    691      *           results. Default: false.
     664     *     @type string       $type              Optional. Shorthand for certain orderby/
     665     *                                           order combinations. 'newest', 'active', 'popular',
     666     *                                           'alphabetical', 'random'. When present, will override
     667     *                                           orderby and order params. Default: null.
     668     *     @type string       $orderby           Optional. Property to sort by.
     669     *                                           'date_created', 'last_activity', 'total_member_count',
     670     *                                           'name', 'random'. Default: 'date_created'.
     671     *     @type string       $order             Optional. Sort order. 'ASC' or 'DESC'.
     672     *                                           Default: 'DESC'.
     673     *     @type int          $per_page          Optional. Number of items to return per page
     674     *                                           of results. Default: null (no limit).
     675     *     @type int          $page              Optional. Page offset of results to return.
     676     *                                           Default: null (no limit).
     677     *     @type int          $user_id           Optional. If provided, results will be limited to groups
     678     *                                           of which the specified user is a member. Default: null.
     679     *     @type string       $search_terms      Optional. If provided, only groups whose names
     680     *                                           or descriptions match the search terms will be
     681     *                                           returned. Default: false.
     682     *     @type array        $meta_query        Optional. An array of meta_query conditions.
     683     *                                           See {@link WP_Meta_Query::queries} for description.
     684     *     @type array|string $value             Optional. Array or comma-separated list of group IDs.
     685     *                                           Results will be limited to groups within the
     686     *                                           list. Default: false.
     687     *     @type bool         $populate_extras   Whether to fetch additional information
     688     *                                           (such as member count) about groups. Default: true.
     689     *     @type array|string $exclude           Optional. Array or comma-separated list of group IDs.
     690     *                                           Results will exclude the listed groups. Default: false.
     691     *     @type bool         $update_meta_cache Whether to pre-fetch groupmeta for
     692     *                                           the returned groups. Default: true.
     693     *     @type bool         $show_hidden       Whether to include hidden groups in results. Default: false.
    692694     * }
    693695     * @return array {
    694696     *     @type array $groups Array of group objects returned by the
    695      *           paginated query.
    696      *     @type int $total Total count of all groups matching non-
    697      *           paginated query params.
     697     *                         paginated query.
     698     *     @type int   $total Total count of all groups matching non-
     699     *                         paginated query params.
    698700     * }
    699701     */
     
    953955     *
    954956     * @param array $meta_query An array of meta_query filters. See the
    955      *        documentation for {@link WP_Meta_Query} for details.
     957     *                          documentation for {@link WP_Meta_Query} for details.
     958     *
    956959     * @return array $sql_array 'join' and 'where' clauses.
    957960     */
     
    10001003     *
    10011004     * @param string $type The 'type' shorthand param.
     1005     *
    10021006     * @return array {
    1003      *  @type string $order SQL-friendly order string.
     1007     *  @type string $order   SQL-friendly order string.
    10041008     *  @type string $orderby SQL-friendly orderby column name.
    10051009     * }
     
    10391043
    10401044    /**
    1041      * Convert the 'orderby' param into a proper SQL term/column.
    1042      *
    1043      * @since BuddyPress (1.8.0)
    1044      * @access protected
    1045      *
    1046      * @param string $orderby Orderby term as passed to get().
    1047      * @return string $order_by_term SQL-friendly orderby term.
    1048      */
    1049     protected static function convert_orderby_to_order_by_term( $orderby ) {
    1050         $order_by_term = '';
    1051 
    1052         switch ( $orderby ) {
    1053             case 'date_created' :
    1054             default :
    1055                 $order_by_term = 'g.date_created';
    1056                 break;
    1057 
    1058             case 'last_activity' :
    1059                 $order_by_term = 'last_activity';
    1060                 break;
    1061 
    1062             case 'total_member_count' :
    1063                 $order_by_term = 'CONVERT(gm1.meta_value, SIGNED)';
    1064                 break;
    1065 
    1066             case 'name' :
    1067                 $order_by_term = 'g.name';
    1068                 break;
    1069 
    1070             case 'random' :
    1071                 $order_by_term = 'rand()';
    1072                 break;
    1073         }
    1074 
    1075         return $order_by_term;
    1076     }
    1077 
    1078     /**
    10791045     * Get a list of groups, sorted by those that have the most legacy forum topics.
    10801046     *
    1081      * @param int|null $limit Optional. The max number of results to return.
    1082      *        Default: null (no limit).
    1083      * @param int|null $page Optional. The page offset of results to return.
    1084      *        Default: null (no limit).
    1085      * @param int $user_id Optional. If present, groups will be limited to
    1086      *        those of which the specified user is a member.
    1087      * @param string|bool $search_terms Optional. Limit groups to those whose
    1088      *        name or description field contain the search string.
    1089      * @param bool $populate_extras Optional. Whether to fetch extra
    1090      *        information about the groups. Default: true.
    1091      * @param string|array|bool $exclude Optional. Array or comma-separated list of group
    1092      *        IDs to exclude from results.
     1047     * @param int|null          $limit           Optional. The max number of results to return.
     1048     *                                           Default: null (no limit).
     1049     * @param int|null          $page            Optional. The page offset of results to return.
     1050     *                                           Default: null (no limit).
     1051     * @param int               $user_id         Optional. If present, groups will be limited to
     1052     *                                           those of which the specified user is a member.
     1053     * @param string|bool       $search_terms    Optional. Limit groups to those whose name
     1054     *                                           or description field contain the search string.
     1055     * @param bool              $populate_extras Optional. Whether to fetch extra
     1056     *                                           information about the groups. Default: true.
     1057     * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
     1058     *                                           IDs to exclude from results.
     1059     *
    10931060     * @return array {
    10941061     *     @type array $groups Array of group objects returned by the
    1095      *           paginated query.
    1096      *     @type int $total Total count of all groups matching non-
    1097      *           paginated query params.
     1062     *                         paginated query.
     1063     *     @type int   $total Total count of all groups matching non-
     1064     *                         paginated query params.
    10981065     * }
    10991066     */
     
    11461113
    11471114    /**
     1115     * Convert the 'orderby' param into a proper SQL term/column.
     1116     *
     1117     * @since BuddyPress (1.8.0)
     1118     * @access protected
     1119     *
     1120     * @param string $orderby Orderby term as passed to get().
     1121     *
     1122     * @return string $order_by_term SQL-friendly orderby term.
     1123     */
     1124    protected static function convert_orderby_to_order_by_term( $orderby ) {
     1125        $order_by_term = '';
     1126
     1127        switch ( $orderby ) {
     1128            case 'date_created' :
     1129            default :
     1130                $order_by_term = 'g.date_created';
     1131                break;
     1132
     1133            case 'last_activity' :
     1134                $order_by_term = 'last_activity';
     1135                break;
     1136
     1137            case 'total_member_count' :
     1138                $order_by_term = 'CONVERT(gm1.meta_value, SIGNED)';
     1139                break;
     1140
     1141            case 'name' :
     1142                $order_by_term = 'g.name';
     1143                break;
     1144
     1145            case 'random' :
     1146                $order_by_term = 'rand()';
     1147                break;
     1148        }
     1149
     1150        return $order_by_term;
     1151    }
     1152
     1153    /**
    11481154     * Get a list of groups, sorted by those that have the most legacy forum posts.
    11491155     *
    1150      * @param int|null $limit Optional. The max number of results to return.
    1151      *        Default: null (no limit).
    1152      * @param int|null $page Optional. The page offset of results to return.
    1153      *        Default: null (no limit).
    1154      * @param string|bool $search_terms Optional. Limit groups to those whose
    1155      *        name or description field contain the search string.
    1156      * @param bool $populate_extras Optional. Whether to fetch extra
    1157      *        information about the groups. Default: true.
    1158      * @param string|array|bool Optional. Array or comma-separated list of group
    1159      *        IDs to exclude from results.
     1156     * @param int|null          $limit           Optional. The max number of results to return.
     1157     *                                           Default: null (no limit).
     1158     * @param int|null          $page            Optional. The page offset of results to return.
     1159     *                                           Default: null (no limit).
     1160     * @param string|bool       $search_terms    Optional. Limit groups to those whose name
     1161     *                                           or description field contain the search string.
     1162     * @param bool              $populate_extras Optional. Whether to fetch extra
     1163     *                                           information about the groups. Default: true.
     1164     * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
     1165     *                                           IDs to exclude from results.
     1166     *
    11601167     * @return array {
    11611168     *     @type array $groups Array of group objects returned by the
    1162      *           paginated query.
    1163      *     @type int $total Total count of all groups matching non-
    1164      *           paginated query params.
     1169     *                         paginated query.
     1170     *     @type int   $total Total count of all groups matching non-
     1171     *                         paginated query params.
    11651172     * }
    11661173     */
     
    12151222     * Get a list of groups whose names start with a given letter.
    12161223     *
    1217      * @param string $letter The letter.
    1218      * @param int|null $limit Optional. The max number of results to return.
    1219      *        Default: null (no limit).
    1220      * @param int|null $page Optional. The page offset of results to return.
    1221      *        Default: null (no limit).
    1222      * @param bool $populate_extras Optional. Whether to fetch extra
    1223      *        information about the groups. Default: true.
    1224      * @param string|array|bool $exclude Optional. Array or comma-separated list of group
    1225      *        IDs to exclude from results.
     1224     * @param string            $letter          The letter.
     1225     * @param int|null          $limit          Optional. The max number of results to return.
     1226     *                                           Default: null (no limit).
     1227     * @param int|null          $page            Optional. The page offset of results to return.
     1228     *                                           Default: null (no limit).
     1229     * @param bool              $populate_extras Optional. Whether to fetch extra
     1230     *                                           information about the groups. Default: true.
     1231     * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
     1232     *                                           IDs to exclude from results.
    12261233     * @return false|array {
    12271234     *     @type array $groups Array of group objects returned by the
    1228      *           paginated query.
    1229      *     @type int $total Total count of all groups matching non-
    1230      *           paginated query params.
     1235     *                         paginated query.
     1236     *     @type int   $total Total count of all groups matching non-
     1237     *                         paginated query params.
    12311238     * }
    12321239     */
     
    12821289     * Use BP_Groups_Group::get() with 'type' = 'random' instead.
    12831290     *
    1284      * @param int|null $limit Optional. The max number of results to return.
    1285      *        Default: null (no limit).
    1286      * @param int|null $page Optional. The page offset of results to return.
    1287      *        Default: null (no limit).
    1288      * @param int $user_id Optional. If present, groups will be limited to
    1289      *        those of which the specified user is a member.
    1290      * @param string|bool $search_terms Optional. Limit groups to those whose
    1291      *        name or description field contain the search string.
    1292      * @param bool $populate_extras Optional. Whether to fetch extra
    1293      *        information about the groups. Default: true.
    1294      * @param string|array|bool $exclude Optional. Array or comma-separated list of group
    1295      *        IDs to exclude from results.
     1291     * @param int|null          $limit           Optional. The max number of results to return.
     1292     *                                           Default: null (no limit).
     1293     * @param int|null          $page            Optional. The page offset of results to return.
     1294     *                                           Default: null (no limit).
     1295     * @param int               $user_id         Optional. If present, groups will be limited to
     1296     *                                           those of which the specified user is a member.
     1297     * @param string|bool       $search_terms    Optional. Limit groups to those whose name
     1298     *                                           or description field contain the search string.
     1299     * @param bool              $populate_extras Optional. Whether to fetch extra
     1300     *                                           information about the groups. Default: true.
     1301     * @param string|array|bool $exclude         Optional. Array or comma-separated list of group
     1302     *                                           IDs to exclude from results.
     1303     *
    12961304     * @return array {
    12971305     *     @type array $groups Array of group objects returned by the
    1298      *           paginated query.
    1299      *     @type int $total Total count of all groups matching non-
    1300      *           paginated query params.
     1306     *                         paginated query.
     1307     *     @type int   $total Total count of all groups matching non-
     1308     *                         paginated query params.
    13011309     * }
    13021310     */
     
    13551363     *       is_confirmed, is_pending, is_banned)
    13561364     *
    1357      * @param array $paged_groups Array of groups.
    1358      * @param string|array Array or comma-separated list of IDs matching
    1359      *        $paged_groups.
    1360      * @param string|bool $type Not used.
     1365     * @param array        $paged_groups Array of groups.
     1366     * @param string|array $group_ids    Array or comma-separated list of IDs matching
     1367     *                                   $paged_groups.
     1368     * @param string|bool  $type         Not used.
     1369     *
    13611370     * @return array $paged_groups
    13621371     */
     
    14321441     * Delete all invitations to a given group.
    14331442     *
    1434      * @param int $group_id ID of the group whose invitations are being
    1435      *        deleted.
     1443     * @param int $group_id ID of the group whose invitations are being deleted.
     1444     *
    14361445     * @return int|null Number of rows records deleted on success, null on
    1437      *         failure.
     1446     *                  failure.
    14381447     */
    14391448    public static function delete_all_invites( $group_id ) {
     
    14691478     *
    14701479     * @param string $type Optional. If 'unreplied', count will be limited to
    1471      *        those topics that have received no replies.
     1480     *                     those topics that have received no replies.
     1481     *
    14721482     * @return int Forum topic count.
    14731483     */
     
    15031513     *
    15041514     * @param int $group_id Group ID.
     1515     *
    15051516     * @return int Count of confirmed members for the group.
    15061517     */
     
    15141525
    15151526    /**
    1516      * Get a total count of all topics of a given status, across groups/forums
     1527     * Get a total count of all topics of a given status, across groups/forums.
    15171528     *
    15181529     * @since BuddyPress (1.5.0)
    15191530     *
    1520      * @param string $status Which group type to count. 'public', 'private',
    1521      *        'hidden', or 'all'. Default: 'public'.
     1531     * @param string      $status      Which group type to count. 'public', 'private',
     1532     *                                  'hidden', or 'all'. Default: 'public'.
    15221533     * @param string|bool $search_terms Provided search terms.
    15231534     *
  • trunk/src/bp-groups/classes/class-bp-groups-member.php

    r9906 r9982  
    11<?php
    22/**
    3  * BuddyPress Groups Classes
     3 * BuddyPress Groups Classes.
    44 *
    55 * @package BuddyPress
     
    134134     * Constructor method.
    135135     *
    136      * @param int $user_id Optional. Along with $group_id, can be used to
    137      *        look up a membership.
    138      * @param int $group_id Optional. Along with $user_id, can be used to
    139      *        look up a membership.
    140      * @param int|bool $id Optional. The unique ID of the membership object.
    141      * @param bool $populate Whether to populate the properties of the
    142      *        located membership. Default: true.
     136     * @param int      $user_id Optional. Along with $group_id, can be used to
     137     *                           look up a membership.
     138     * @param int      $group_id Optional. Along with $user_id, can be used to
     139     *                           look up a membership.
     140     * @param int|bool $id       Optional. The unique ID of the membership object.
     141     * @param bool     $populate Whether to populate the properties of the
     142     *                           located membership. Default: true.
    143143     */
    144144    public function __construct( $user_id = 0, $group_id = 0, $id = false, $populate = true ) {
     
    271271     *
    272272     * @param string $status The new status. 'mod' or 'admin'.
     273     *
    273274     * @return bool True on success, false on failure.
    274275     */
     
    397398     *
    398399     * @param int $user_id ID of the user.
     400     *
    399401     * @return bool True on success, false on failure.
    400402     */
     
    409411     *
    410412     * @param int $group_id ID of the group.
     413     *
    411414     * @return bool True on success, false on failure.
    412415     */
     
    418421     * Delete a membership, based on user + group IDs.
    419422     *
    420      * @param int $user_id ID of the user.
    421      * @param int $group_id ID of the group.
     423     * @param int $user_id  ID of the user.
     424     * @param int $group_id ID of the group.
     425     *
    422426     * @return True on success, false on failure.
    423427     */
     
    460464     * Get the IDs of the groups of which a specified user is a member.
    461465     *
    462      * @param int $user_id ID of the user.
    463      * @param int|bool $limit Optional. Max number of results to return.
    464      *        Default: false (no limit).
    465      * @param int|bool $page Optional. Page offset of results to return.
    466      *        Default: false (no limit).
     466     * @param int      $user_id ID of the user.
     467     * @param int|bool $limit   Optional. Max number of results to return.
     468     *                          Default: false (no limit).
     469     * @param int|bool $page    Optional. Page offset of results to return.
     470     *                          Default: false (no limit).
    467471     * @return array {
    468472     *     @type array $groups Array of groups returned by paginated query.
    469      *     @type int $total Count of groups matching query.
     473     *     @type int   $total Count of groups matching query.
    470474     * }
    471475     */
     
    496500     * Get the IDs of the groups of which a specified user is a member, sorted by the date joined.
    497501     *
    498      * @param int $user_id ID of the user.
    499      * @param int|bool $limit Optional. Max number of results to return.
    500      *        Default: false (no limit).
    501      * @param int|bool $page Optional. Page offset of results to return.
    502      *        Default: false (no limit).
    503      * @param string|bool $filter Optional. Limit results to groups whose name or
    504      *        description field matches search terms.
     502     * @param int         $user_id ID of the user.
     503     * @param int|bool    $limit  Optional. Max number of results to return.
     504     *                             Default: false (no limit).
     505     * @param int|bool    $page    Optional. Page offset of results to return.
     506     *                             Default: false (no limit).
     507     * @param string|bool $filter  Optional. Limit results to groups whose name or
     508     *                             description field matches search terms.
    505509     * @return array {
    506510     *     @type array $groups Array of groups returned by paginated query.
    507      *     @type int $total Count of groups matching query.
     511     *     @type int   $total Count of groups matching query.
    508512     * }
    509513     */
     
    537541     * Get the IDs of the groups of which a specified user is an admin.
    538542     *
    539      * @param int $user_id ID of the user.
    540      * @param int|bool $limit Optional. Max number of results to return.
    541      *        Default: false (no limit).
    542      * @param int|bool $page Optional. Page offset of results to return.
    543      *        Default: false (no limit).
    544      * @param string|bool $filter Optional. Limit results to groups whose name or
    545      *        description field matches search terms.
     543     * @param int         $user_id ID of the user.
     544     * @param int|bool    $limit   Optional. Max number of results to return.
     545     *                             Default: false (no limit).
     546     * @param int|bool    $page    Optional. Page offset of results to return.
     547     *                             Default: false (no limit).
     548     * @param string|bool $filter  Optional. Limit results to groups whose name or
     549     *                             description field matches search terms.
     550     *
    546551     * @return array {
    547552     *     @type array $groups Array of groups returned by paginated query.
    548      *     @type int $total Count of groups matching query.
     553     *     @type int   $total Count of groups matching query.
    549554     * }
    550555     */
     
    578583     * Get the IDs of the groups of which a specified user is a moderator.
    579584     *
    580      * @param int $user_id ID of the user.
    581      * @param int|bool $limit Optional. Max number of results to return.
    582      *        Default: false (no limit).
    583      * @param int|bool $page Optional. Page offset of results to return.
    584      *        Default: false (no limit).
    585      * @param string|bool $filter Optional. Limit results to groups whose name or
    586      *        description field matches search terms.
     585     * @param int         $user_id ID of the user.
     586     * @param int|bool    $limit   Optional. Max number of results to return.
     587     *                             Default: false (no limit).
     588     * @param int|bool    $page    Optional. Page offset of results to return.
     589     *                             Default: false (no limit).
     590     * @param string|bool $filter  Optional. Limit results to groups whose name or
     591     *                             description field matches search terms.
     592     *
    587593     * @return array {
    588594     *     @type array $groups Array of groups returned by paginated query.
    589      *     @type int $total Count of groups matching query.
     595     *     @type int   $total Count of groups matching query.
    590596     * }
    591597     */
     
    620626     *
    621627     * @param int $user_id Optional. Default: ID of the displayed user.
     628     *
    622629     * @return int Group count.
    623630     */
     
    640647     * Get a user's outstanding group invitations.
    641648     *
    642      * @param int $user_id ID of the invitee.
    643      * @param int|bool $limit Optional. Max number of results to return.
    644      *        Default: false (no limit).
    645      * @param int|bool $page Optional. Page offset of results to return.
    646      *        Default: false (no limit).
     649     * @param int               $user_id ID of the invitee.
     650     * @param int|bool          $limit  Optional. Max number of results to return.
     651     *                                   Default: false (no limit).
     652     * @param int|bool          $page    Optional. Page offset of results to return.
     653     *                                   Default: false (no limit).
    647654     * @param string|array|bool $exclude Optional. Array or comma-separated list
    648      *        of group IDs to exclude from results.
     655     *                                   of group IDs to exclude from results.
     656     *
    649657     * @return array {
    650658     *     @type array $groups Array of groups returned by paginated query.
    651      *     @type int $total Count of groups matching query.
     659     *     @type int   $total Count of groups matching query.
    652660     * }
    653661     */
     
    676684     * @since BuddyPress (2.0.0)
    677685     *
    678      * @param int $user_id The user ID
     686     * @param int $user_id The user ID.
     687     *
    679688     * @return int
    680689     */
     
    697706     * Check whether a user has an outstanding invitation to a given group.
    698707     *
    699      * @param int $user_id ID of the potential invitee.
    700      * @param int $group_id ID of the group.
    701      * @param string $type If 'sent', results are limited to those
    702      *        invitations that have actually been sent (non-draft).
    703      *        Default: 'sent'.
     708     * @param int    $user_id ID of the potential invitee.
     709     * @param int    $group_id ID of the group.
     710     * @param string $type     If 'sent', results are limited to those invitations
     711     *                         that have actually been sent (non-draft). Default: 'sent'.
     712     *
    704713     * @return int|null The ID of the invitation if found, otherwise null.
    705714     */
     
    726735     * @param  int $user_id  ID of the user.
    727736     * @param  int $group_id ID of the group.
     737     *
    728738     * @return int Number of records deleted.
    729739     */
     
    751761     * Delete an unconfirmed membership request, by user ID and group ID.
    752762     *
    753      * @param int $user_id ID of the user.
    754      * @param int $group_id ID of the group.
     763     * @param int $user_id  ID of the user.
     764     * @param int $group_id ID of the group.
     765     *
    755766     * @return int Number of records deleted.
    756767     */
     
    769780     * Check whether a user is an admin of a given group.
    770781     *
    771      * @param int $user_id ID of the user.
    772      * @param int $group_id ID of the group.
    773      * @param int|null ID of the membership if the user is an admin,
    774      *        otherwise null.
     782     * @param int $user_id  ID of the user.
     783     * @param int $group_id ID of the group.
    775784     *
    776785     * @return mixed
     
    790799     * Check whether a user is a mod of a given group.
    791800     *
    792      * @param int $user_id ID of the user.
    793      * @param int $group_id ID of the group.
    794      * @param int|null ID of the membership if the user is a mod,
    795      *        otherwise null.
     801     * @param int $user_id  ID of the user.
     802     * @param int $group_id ID of the group.
    796803     *
    797804     * @return mixed
     
    811818     * Check whether a user is a member of a given group.
    812819     *
    813      * @param int $user_id ID of the user.
    814      * @param int $group_id ID of the group.
    815      * @param int|null ID of the membership if the user is a member,
    816      *        otherwise null.
     820     * @param int $user_id  ID of the user.
     821     * @param int $group_id ID of the group.
    817822     *
    818823     * @return mixed
     
    832837     * Check whether a user is banned from a given group.
    833838     *
    834      * @param int $user_id ID of the user.
    835      * @param int $group_id ID of the group.
    836      * @param int|null ID of the membership if the user is banned,
    837      *        otherwise null.
     839     * @param int $user_id  ID of the user.
     840     * @param int $group_id ID of the group.
    838841     *
    839842     * @return mixed
     
    855858     * @since BuddyPress (1.2.6)
    856859     *
    857      * @param int $user_id ID of the user.
    858      * @param int $group_id ID of the group.
     860     * @param int $user_id  ID of the user.
     861     * @param int $group_id ID of the group.
     862     *
    859863     * @return int|null ID of the group if the user is the creator,
    860      *         otherwise false.
     864     *                  otherwise false.
    861865     */
    862866    public static function check_is_creator( $user_id, $group_id ) {
     
    874878     * Check whether a user has an outstanding membership request for a given group.
    875879     *
    876      * @param int $user_id ID of the user.
    877      * @param int $group_id ID of the group.
     880     * @param int $user_id  ID of the user.
     881     * @param int $group_id ID of the group.
     882     *
    878883     * @return int|null ID of the membership if found, otherwise false.
    879884     */
     
    892897     * Get a list of randomly selected IDs of groups that the member belongs to.
    893898     *
    894      * @param int $user_id ID of the user.
     899     * @param int $user_id      ID of the user.
    895900     * @param int $total_groups Max number of group IDs to return. Default: 5.
     901     *
    896902     * @return array Group IDs.
    897903     */
     
    913919     *
    914920     * @param int $group_id ID of the group.
     921     *
    915922     * @return array IDs of all group members.
    916923     */
     
    927934     *
    928935     * @param int $group_id ID of the group.
     936     *
    929937     * @return array Info about group admins (user_id + date_modified).
    930938     */
     
    948956     *
    949957     * @param int $group_id ID of the group.
     958     *
    950959     * @return array Info about group mods (user_id + date_modified).
    951960     */
     
    962971     *
    963972     * @param int $group_id ID of the group.
     973     *
    964974     * @return array IDs of users with outstanding membership requests.
    965975     */
     
    10691079     *
    10701080     * @param int $group_id ID of the group.
     1081     *
    10711082     * @return int Number of records deleted.
    10721083     */
Note: See TracChangeset for help on using the changeset viewer.