Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/22/2015 04:58:34 AM (5 years ago)
Author:
tw2113
Message:

More docs cleanup for BP-Groups component.

See #6401.

File:
1 edited

Legend:

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

    r10342 r10373  
    197197    function __construct( $args = array() ){
    198198
    199         // Backward compatibility with old method of passing arguments
     199        // Backward compatibility with old method of passing arguments.
    200200        if ( ! is_array( $args ) || func_num_args() > 1 ) {
    201201            _deprecated_argument( __METHOD__, '1.7', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     
    265265            }
    266266
    267             // backwards compatibility - the 'group_id' variable is not part of the
     267            // Backwards compatibility - the 'group_id' variable is not part of the
    268268            // BP_Groups_Group object, but we add it here for devs doing checks against it
    269269            //
     
    271271            //
    272272            // this is subject to removal in a future release; devs should check against
    273             // $group->id instead
     273            // $group->id instead.
    274274            $group->group_id = $group->id;
    275275
     
    326326        }
    327327
    328         // Build pagination links
     328        // Build pagination links.
    329329        if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    330330            $pag_args = array(
     
    420420             */
    421421            do_action('group_loop_end');
    422             // Do some cleaning up after the loop
     422            // Do some cleaning up after the loop.
    423423            $this->rewind_groups();
    424424        }
     
    499499    global $groups_template;
    500500
    501     /***
     501    /*
    502502     * Defaults based on the current page & overridden by parsed $args
    503503     */
     
    506506    $search_terms = false;
    507507
    508     // When looking your own groups, check for two action variables
     508    // When looking your own groups, check for two action variables.
    509509    if ( bp_is_current_action( 'my-groups' ) ) {
    510510        if ( bp_is_action_variable( 'most-popular', 0 ) ) {
     
    514514        }
    515515
    516     // When looking at invites, set type to invites
     516    // When looking at invites, set type to invites.
    517517    } elseif ( bp_is_current_action( 'invites' ) ) {
    518518        $type = 'invites';
    519519
    520     // When looking at a single group, set the type and slug
     520    // When looking at a single group, set the type and slug.
    521521    } elseif ( bp_get_current_group_slug() ) {
    522522        $type = 'single-group';
     
    524524    }
    525525
    526     // Default search string (too soon to escape here)
     526    // Default search string (too soon to escape here).
    527527    $search_query_arg = bp_core_get_component_search_query_arg( 'groups' );
    528528    if ( ! empty( $_REQUEST[ $search_query_arg ] ) ) {
     
    534534    }
    535535
    536     // Parse defaults and requested arguments
     536    // Parse defaults and requested arguments.
    537537    $r = bp_parse_args( $args, array(
    538538        'type'              => $type,
     
    554554    ), 'has_groups' );
    555555
    556     // Setup the Groups template global
     556    // Setup the Groups template global.
    557557    $groups_template = new BP_Groups_Template( array(
    558558        'type'              => $r['type'],
     
    610610 *
    611611 * @param object|bool $group Optional. Group object. Default: current group in loop.
    612  *
    613612 * @return bool
    614613 */
     
    648647     * @param object|bool $group Optional. Group object.
    649648     *                           Default: current group in loop.
    650      *
    651649     * @return int
    652650     */
     
    684682     *
    685683     * @param array $classes Array of custom classes.
    686      *
    687684     * @return string Row class of the group.
    688685     */
     
    690687        global $groups_template;
    691688
    692         // Add even/odd classes, but only if there's more than 1 group
     689        // Add even/odd classes, but only if there's more than 1 group.
    693690        if ( $groups_template->group_count > 1 ) {
    694691            $pos_in_loop = (int) $groups_template->current_group;
    695692            $classes[]   = ( $pos_in_loop % 2 ) ? 'even' : 'odd';
    696693
    697         // If we've only one group in the loop, don't bother with odd and even
     694        // If we've only one group in the loop, don't bother with odd and even.
    698695        } else {
    699696            $classes[] = 'bp-single-group';
     
    703700        $classes[] = sanitize_key( $groups_template->group->status );
    704701
    705         // User's group role
     702        // User's group role.
    706703        if ( bp_is_user_active() ) {
    707704
    708             // Admin
     705            // Admin.
    709706            if ( bp_group_is_admin() ) {
    710707                $classes[] = 'is-admin';
    711708            }
    712709
    713             // Moderator
     710            // Moderator.
    714711            if ( bp_group_is_mod() ) {
    715712                $classes[] = 'is-mod';
    716713            }
    717714
    718             // Member
     715            // Member.
    719716            if ( bp_group_is_member() ) {
    720717                $classes[] = 'is-member';
     
    757754     * @param object|bool $group Optional. Group object.
    758755     *                           Default: current group in loop.
    759      *
    760756     * @return string
    761757     */
     
    792788 * @param object|bool $group Optional. Group object.
    793789 *                           Default: current group in loop.
    794  *
    795790 * @return string
    796791 */
     
    835830     * @param object|bool $group Optional. Group object.
    836831     *                           Default: current group in loop.
    837      *
    838832     * @return string
    839833     */
     
    874868     * @see bp_core_fetch_avatar() For a description of arguments and return values.
    875869
    876      * @param array $args {
     870     * @param array|string $args {
    877871     *     Arguments are listed here with an explanation of their defaults.
    878872     *     For more information about the arguments, see {@link bp_core_fetch_avatar()}.
     
    895889        }
    896890
    897         // Parse the arguments
     891        // Parse the arguments.
    898892        $r = bp_parse_args( $args, array(
    899893            'type'   => 'full',
     
    905899        ) );
    906900
    907         // Fetch the avatar from the folder
     901        // Fetch the avatar from the folder.
    908902        $avatar = bp_core_fetch_avatar( array(
    909903            'item_id'    => $groups_template->group->id,
     
    919913        ) );
    920914
    921         // If No avatar found, provide some backwards compatibility
     915        // If No avatar found, provide some backwards compatibility.
    922916        if ( empty( $avatar ) ) {
    923917            $avatar = '<img src="' . esc_url( $groups_template->group->avatar_thumb ) . '" class="avatar" alt="' . esc_attr( $groups_template->group->name ) . '" />';
     
    953947     * @param object|bool $group Optional. Group object.
    954948     *                           Default: current group in loop.
    955      *
    956949     * @return string
    957950     */
     
    981974     * @param object|bool $group Optional. Group object.
    982975     *                           Default: current group in loop.
    983      *
    984976     * @return string
    985977     */
     
    996988
    997989/**
    998  * Should we use the group's cover image header
     990 * Should we use the group's cover image header.
    999991 *
    1000992 * @since 2.4.0
     
    10211013     * @param object|bool $group Optional. Group object.
    10221014     *                           Default: current group in loop.
    1023      *
    10241015     * @return string
    10251016     */
     
    10661057     * @param object|bool $group Optional. Group object.
    10671058     *                           Default: current group in loop.
    1068      *
    10691059     * @return string
    10701060     */
     
    11001090     * @param object|bool $group Optional. Group object.
    11011091     *                           Default: current group in loop.
    1102      *
    11031092     * @return string
    11041093     */
     
    11341123     * @param object|bool $group Optional. Group object.
    11351124     *                           Default: current group in loop.
    1136      *
    11371125     * @return string
    11381126     */
     
    11681156     * @param object|bool $group Optional. Group object.
    11691157     *                           Default: current group in loop.
    1170      *
    11711158     * @return string
    11721159     */
     
    12061193     * @param object|bool $group Optional. Group object.
    12071194     *                           Default: current group in loop.
    1208      *
    12091195     * @return string
    12101196     */
     
    12461232     *                           Defaults to the group currently being
    12471233     *                           iterated on in the groups loop.
    1248      *
    12491234     * @return string Excerpt.
    12501235     */
     
    12851270     * @param object|bool $group Optional. Group object.
    12861271     *                           Default: current group in loop.
    1287      *
    12881272     * @return string
    12891273     */
     
    13201304     * @param object|bool $group Optional. Group object.
    13211305     *                           Default: current group in loop.
    1322      *
    1323      * @return unknown
     1306     * @return mixed
    13241307     */
    13251308    function bp_get_group_is_public( $group = false ) {
     
    13471330     * @param object|bool $group Optional. Group object.
    13481331     *                           Default: current group in loop.
    1349      *
    13501332     * @return string
    13511333     */
     
    13811363     * @param object|bool $group Optional. Group object.
    13821364     *                           Default: current group in loop.
    1383      *
    13841365     * @return string
    13851366     */
     
    14151396     * @param object|bool $group Optional. Group object.
    14161397     *                           Default: current group in loop.
    1417      *
    14181398     * @return int
    14191399     */
     
    14491429     * @param object|bool $group Optional. Group object.
    14501430     *                           Default: current group in loop.
    1451      *
    14521431     * @return string
    14531432     */
     
    14751454 *                             Default: current group in loop.
    14761455 * @param int         $user_id ID of the user.
    1477  *
    14781456 * @return bool
    14791457 */
     
    15891567    }
    15901568
    1591     // fetch group admins if 'populate_extras' flag is false
     1569    // Fetch group admins if 'populate_extras' flag is false.
    15921570    if ( empty( $group->args['populate_extras'] ) ) {
    15931571        $query = new BP_Group_Member_Query( array(
     
    16291607    }
    16301608
    1631     // fetch group mods if 'populate_extras' flag is false
     1609    // Fetch group mods if 'populate_extras' flag is false.
    16321610    if ( empty( $group->args['populate_extras'] ) ) {
    16331611        $query = new BP_Group_Member_Query( array(
     
    17591737     * @param object|bool $group Optional. Group object.
    17601738     *                           Default: current group in loop.
    1761      *
    17621739     * @return string
    17631740     */
     
    17841761 * No longer used in BuddyPress.
    17851762 *
    1786  * @todo Deprecate
     1763 * @todo Deprecate.
    17871764 */
    17881765function bp_group_search_form() {
     
    18071784 * No longer used in BuddyPress.
    18081785 *
    1809  * @todo Deprecate
     1786 * @todo Deprecate.
    18101787 *
    18111788 * @return bool True if the displayed user has no groups, otherwise false.
     
    19321909     * @param object|bool $group Optional. Group object.
    19331910     *                           Default: current group in loop.
    1934      *
    19351911     * @return int
    19361912     */
     
    19951971     * @param object|bool $group Optional. Group object.
    19961972     *                           Default: current group in loop.
    1997      *
    19981973     * @return string
    19991974     */
     
    22012176 *
    22022177 * @param string      $setting The setting you want to check against ('members',
    2203  *                             'mods', or 'admins').
     2178 *                             'mods', or 'admins').
    22042179 * @param object|bool $group   Optional. Group object. Default: current group in loop.
    22052180 */
     
    22302205 *                           check. Default: the displayed group, or the current group
    22312206 *                           in the loop.
    2232  *
    22332207 * @return bool|string Returns false when no group can be found. Otherwise
    22342208 *                     returns the group invite status, from among 'members',
     
    22422216
    22432217        if ( isset( $bp->groups->current_group->id ) ) {
    2244             // Default to the current group first
     2218            // Default to the current group first.
    22452219            $group_id = $bp->groups->current_group->id;
    22462220        } elseif ( isset( $groups_template->group->id ) ) {
    2247             // Then see if we're in the loop
     2221            // Then see if we're in the loop.
    22482222            $group_id = $groups_template->group->id;
    22492223        } else {
     
    22542228    $invite_status = groups_get_groupmeta( $group_id, 'invite_status' );
    22552229
    2256     // Backward compatibility. When 'invite_status' is not set, fall back to a default value
     2230    // Backward compatibility. When 'invite_status' is not set, fall back to a default value.
    22572231    if ( !$invite_status ) {
    22582232        $invite_status = apply_filters( 'bp_group_invite_status_fallback', 'members' );
     
    22972271
    22982272    if ( $user_id ) {
    2299         // Users with the 'bp_moderate' cap can always send invitations
     2273        // Users with the 'bp_moderate' cap can always send invitations.
    23002274        if ( user_can( $user_id, 'bp_moderate' ) ) {
    23012275            $can_send_invites = true;
     
    24972471 *
    24982472 * @param object|bool $group Optional. Group object. Default: current group in loop.
    2499  *
    25002473 * @return array Info about group admins (user_id + date_modified).
    25012474 */
     
    26162589     *                             member in a member loop.
    26172590     * @param object|bool $group   Optional. Group object. Default: current group.
    2618      *
    26192591     * @return string
    26202592     */
     
    26612633     *                             Default: current member in a member loop.
    26622634     * @param object|bool $group   Optional. Group object. Default: current group.
    2663      *
    26642635     * @return string
    26652636     */
     
    27022673     *                             Default: current member in a member loop.
    27032674     * @param object|bool $group   Optional. Group object. Default: current group.
    2704      *
    27052675     * @return string
    27062676     */
     
    27472717     *                             Default: current member in a member loop.
    27482718     * @param object|bool $group   Optional. Group object. Default: current group.
    2749      *
    27502719     * @return string
    27512720     */
     
    28002769 * @param  string $subnav_item   subnav item params.
    28012770 * @param  string $selected_item Surrent selected tab.
    2802  *
    28032771 * @return string HTML output
    28042772 */
     
    28622830     * @param object|bool $group Optional. Group object.
    28632831     *                           Default: current group in the loop.
    2864      *
    28652832     * @return string
    28662833     */
     
    28962863     * @param object|bool $group Optional. Group object.
    28972864     *                           Default: current group in the loop.
    2898      *
    28992865     * @return string
    29002866     */
     
    29252891 * @param object|bool $group Optional. Group object.
    29262892 *                           Default: current group in the loop.
    2927  *
    29282893 * @return bool
    29292894 */
     
    29492914 * @param object|bool $group Optional. Group to check is_member.
    29502915 *                           Default: current group in the loop.
    2951  *
    29522916 * @return bool If user is member of group or not.
    29532917 */
     
    29552919    global $groups_template;
    29562920
    2957     // Site admins always have access
     2921    // Site admins always have access.
    29582922    if ( bp_current_user_can( 'bp_moderate' ) ) {
    29592923        return true;
     
    29792943 * @param object|bool $group Optional. Group data object.
    29802944 *                           Default: the current group in the groups loop.
    2981  *
    29822945 * @return bool True if the user has an outstanding invite, otherwise false.
    29832946 */
     
    30182981 * @param BP_Groups_Group|bool $group   Group to check if user is banned.
    30192982 * @param int                  $user_id The user ID to check.
    3020  *
    30212983 * @return bool True if user is banned.  False if user isn't banned.
    30222984 */
     
    30242986    global $groups_template;
    30252987
    3026     // Site admins always have access
     2988    // Site admins always have access.
    30272989    if ( bp_current_user_can( 'bp_moderate' ) ) {
    30282990        return false;
    30292991    }
    30302992
    3031     // check groups loop first
    3032     // @see BP_Groups_Group::get_group_extras()
     2993    // Check groups loop first
     2994    // @see BP_Groups_Group::get_group_extras().
    30332995    if ( ! empty( $groups_template->in_the_loop ) && isset( $groups_template->group->is_banned ) ) {
    30342996        $retval = $groups_template->group->is_banned;
    30352997
    3036     // not in loop
     2998    // Not in loop.
    30372999    } else {
    3038         // Default to not banned
     3000        // Default to not banned.
    30393001        $retval = false;
    30403002
     
    30733035     * @param object|bool $group Optional. Group object.
    30743036     *                           Default: Current group in the loop.
    3075      *
    30763037     * @return string
    30773038     */
     
    31063067     * @param object|bool $group Optional. Group object.
    31073068     *                           Default: Current group in the loop.
    3108      *
    31093069     * @return string
    31103070     */
     
    31393099     * @param object|bool $group Optional. Group object.
    31403100     *                           Default: Current group in the loop.
    3141      *
    31423101     * @return string
    31433102     */
     
    31703129     * @param object|bool $group Optional. Group object.
    31713130     *                           Default: Current group in the loop.
    3172      *
    31733131     * @return string
    31743132     */
     
    32013159     * @param object|bool $group Optional. Group object.
    32023160     *                           Default: current group in the loop.
    3203      *
    32043161     * @return string
    32053162     */
     
    32263183 * @param object|bool $group Optional. Group object.
    32273184 *                           Default: current group in the loop.
    3228  *
    32293185 * @return bool
    32303186 */
     
    32663222     * @param BP_Groups_Group|bool $group The BP Groups_Group object if
    32673223     *                                    passed, boolean false if not passed.
    3268      *
    32693224     * @return string HTML code for the button.
    32703225     */
     
    33193274     *
    33203275     * @param object|bool $group Single group object.
    3321      *
    33223276     * @return mixed
    33233277     */
     
    33253279        global $groups_template;
    33263280
    3327         // Set group to current loop group if none passed
     3281        // Set group to current loop group if none passed.
    33283282        if ( empty( $group ) ) {
    33293283            $group =& $groups_template->group;
    33303284        }
    33313285
    3332         // Don't show button if not logged in or previously banned
     3286        // Don't show button if not logged in or previously banned.
    33333287        if ( ! is_user_logged_in() || bp_group_is_user_banned( $group ) ) {
    33343288            return false;
    33353289        }
    33363290
    3337         // Group creation was not completed or status is unknown
     3291        // Group creation was not completed or status is unknown.
    33383292        if ( empty( $group->status ) ) {
    33393293            return false;
    33403294        }
    33413295
    3342         // Already a member
     3296        // Already a member.
    33433297        if ( ! empty( $group->is_member ) ) {
    33443298
    3345             // Stop sole admins from abandoning their group
     3299            // Stop sole admins from abandoning their group.
    33463300            $group_admins = groups_get_group_admins( $group->id );
    33473301            if ( ( 1 == count( $group_admins ) ) && ( bp_loggedin_user_id() === (int) $group_admins[0]->user_id ) ) {
     
    33493303            }
    33503304
    3351             // Setup button attributes
     3305            // Setup button attributes.
    33523306            $button = array(
    33533307                'id'                => 'leave_group',
     
    33633317            );
    33643318
    3365         // Not a member
     3319        // Not a member.
    33663320        } else {
    33673321
    3368             // Show different buttons based on group status
     3322            // Show different buttons based on group status.
    33693323            switch ( $group->status ) {
    33703324                case 'hidden' :
     
    33893343
    33903344                    // Member has outstanding invitation -
    3391                     // show an "Accept Invitation" button
     3345                    // show an "Accept Invitation" button.
    33923346                    if ( $group->is_invited ) {
    33933347                        $button = array(
     
    34053359
    34063360                    // Member has requested membership but request is pending -
    3407                     // show a "Request Sent" button
     3361                    // show a "Request Sent" button.
    34083362                    } elseif ( $group->is_pending ) {
    34093363                        $button = array(
     
    34213375
    34223376                    // Member has not requested membership yet -
    3423                     // show a "Request Membership" button
     3377                    // show a "Request Membership" button.
    34243378                    } else {
    34253379                        $button = array(
     
    35153469     */
    35163470    function bp_get_group_create_nav_item() {
    3517         // Get the create a group button
     3471        // Get the create a group button.
    35183472        $create_group_button = bp_get_group_create_button();
    35193473
    3520         // Make sure the button is available
     3474        // Make sure the button is available.
    35213475        if ( empty( $create_group_button ) ) {
    35223476            return;
     
    35413495 * @since 2.2.0
    35423496 *
    3543  * @uses   bp_group_create_nav_item() to output the create a Group nav item.
     3497 * @uses bp_group_create_nav_item() to output the create a Group nav item.
     3498 *
    35443499 * @return string HTML Output
    35453500 */
    35463501function bp_group_backcompat_create_nav_item() {
    3547     // Bail if the Groups nav item is already used by bp-legacy
     3502    // Bail if the Groups nav item is already used by bp-legacy.
    35483503    if ( has_action( 'bp_groups_directory_group_filter', 'bp_legacy_theme_group_create_nav', 999 ) ) {
    35493504        return;
    35503505    }
    35513506
    3552     // Bail if the theme is not filtering the Groups directory title
     3507    // Bail if the theme is not filtering the Groups directory title.
    35533508    if ( ! has_filter( 'bp_groups_directory_header' ) ) {
    35543509        return;
     
    35663521 *
    35673522 * @global BP_Groups_Template $groups_template Groups template object.
     3523 *
    35683524 * @param object $group Group to get status message for. Optional; defaults to current group.
    35693525 */
     
    35713527    global $groups_template;
    35723528
    3573     // Group not passed so look for loop
     3529    // Group not passed so look for loop.
    35743530    if ( empty( $group ) ) {
    35753531        $group =& $groups_template->group;
    35763532    }
    35773533
    3578     // Group status is not set (maybe outside of group loop?)
     3534    // Group status is not set (maybe outside of group loop?).
    35793535    if ( empty( $group->status ) ) {
    35803536        $message = __( 'This group is not currently accessible.', 'buddypress' );
    35813537
    3582     // Group has a status
     3538    // Group has a status.
    35833539    } else {
    35843540        switch( $group->status ) {
    35853541
    3586             // Private group
     3542            // Private group.
    35873543            case 'private' :
    35883544                if ( ! bp_group_has_requested_membership( $group ) ) {
     
    36023558                break;
    36033559
    3604             // Hidden group
     3560            // Hidden group.
    36053561            case 'hidden' :
    36063562            default :
     
    36563612     *
    36573613     * @since 1.0.0
     3614     *
    36583615     * @return type
    36593616     */
     
    36883645     *
    36893646     * @param int $user_id User ID to get group membership count.
    3690      *
    36913647     * @return int
    36923648     */
     
    37053661    }
    37063662
    3707 /** Group Members *************************************************************/
     3663/* Group Members *************************************************************/
    37083664
    37093665class BP_Groups_Group_Members_Template {
     
    37263682     *     An array of optional arguments.
    37273683     *     @type int      $group_id           ID of the group whose members are being
    3728      *                                        queried. Default: current group ID.
     3684     *                                        queried. Default: current group ID.
    37293685     *     @type int      $page               Page of results to be queried. Default: 1.
    37303686     *     @type int      $per_page           Number of items to return per page of
     
    37423698    public function __construct( $args = array() ) {
    37433699
    3744         // Backward compatibility with old method of passing arguments
     3700        // Backward compatibility with old method of passing arguments.
    37453701        if ( ! is_array( $args ) || func_num_args() > 1 ) {
    37463702            _deprecated_argument( __METHOD__, '2.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     
    37873743        }
    37883744
    3789         // Assemble the base URL for pagination
     3745        // Assemble the base URL for pagination.
    37903746        $base_url = trailingslashit( bp_get_group_permalink( $current_group ) . bp_current_action() );
    37913747        if ( bp_action_variable() ) {
     
    37983754        $members_args['per_page'] = $this->pag_num;
    37993755
    3800         // Get group members for this loop
     3756        // Get group members for this loop.
    38013757        $this->members = groups_get_group_members( $members_args );
    38023758
     
    38073763        }
    38083764
    3809         // Reset members array for subsequent looping
     3765        // Reset members array for subsequent looping.
    38103766        $this->members = $this->members['members'];
    38113767
     
    38663822            do_action( 'loop_end', $this );
    38673823
    3868             // Do some cleaning up after the loop
     3824            // Do some cleaning up after the loop.
    38693825            $this->rewind_members();
    38703826        }
     
    38783834        $this->member      = $this->next_member();
    38793835
    3880         // loop has just started
     3836        // Loop has just started.
    38813837        if ( 0 == $this->current_member ) {
    38823838
     
    39773933 * @since 1.0.0
    39783934 *
    3979  * @param array|string $args {@see bp_core_fetch_avatar()}
     3935 * @param array|string $args {@see bp_core_fetch_avatar()}.
    39803936 */
    39813937function bp_group_member_avatar( $args = '' ) {
     
    39873943     * @since 1.0.0
    39883944     *
    3989      * @param array|string $args {@see bp_core_fetch_avatar()}
    3990      *
     3945     * @param array|string $args {@see bp_core_fetch_avatar()}.
    39913946     * @return string
    39923947     */
     
    40173972 * @since 1.0.0
    40183973 *
    4019  * @param array|string $args {@see bp_core_fetch_avatar()}
    4020  */
    4021 
     3974 * @param array|string $args {@see bp_core_fetch_avatar()}.
     3975 */
    40223976function bp_group_member_avatar_thumb( $args = '' ) {
    40233977    echo bp_get_group_member_avatar_thumb( $args );
     
    40283982     * @since 1.0.0
    40293983     *
    4030      * @param array|string $args {@see bp_core_fetch_avatar()}
    4031      *
     3984     * @param array|string $args {@see bp_core_fetch_avatar()}.
    40323985     * @return string
    40333986     */
     
    40714024     * @param int $width  Width of avatar to fetch.
    40724025     * @param int $height Height of avatar to fetch.
    4073      *
    40744026     * @return string
    40754027     */
     
    43994351 *
    44004352 * @since 2.0.0
    4401  *
    4402  * @return string html output
    44034353 */
    44044354function bp_groups_members_template_part() {
     
    44374387 *
    44384388 * @since 2.0.0
    4439  *
    4440  * @return string html output
    44414389 */
    44424390function bp_groups_members_filter() {
     
    44704418}
    44714419
    4472 /***************************************************************************
     4420/*
    44734421 * Group Creation Process Template Tags
    4474  **/
     4422 */
    44754423
    44764424/**
     
    44824430 * @uses bp_get_option() To retrieve value of 'bp_restrict_group_creation'. Defaults to 0.
    44834431 * @uses bp_current_user_can() To determine if current user if super admin.
    4484  *
    44854432 * @return bool True if user can create groups. False otherwise.
    44864433 */
    44874434function bp_user_can_create_groups() {
    44884435
    4489     // Super admin can always create groups
     4436    // Super admin can always create groups.
    44904437    if ( bp_current_user_can( 'bp_moderate' ) ) {
    44914438        return true;
    44924439    }
    44934440
    4494     // Get group creation option, default to 0 (allowed)
     4441    // Get group creation option, default to 0 (allowed).
    44954442    $restricted = (int) bp_get_option( 'bp_restrict_group_creation', 0 );
    44964443
    4497     // Allow by default
     4444    // Allow by default.
    44984445    $can_create = true;
    44994446
     
    45814528function bp_is_group_creation_step( $step_slug ) {
    45824529
    4583     // Make sure we are in the groups component
     4530    // Make sure we are in the groups component.
    45844531    if ( ! bp_is_groups_component() || ! bp_is_current_action( 'create' ) ) {
    45854532        return false;
     
    45884535    $bp = buddypress();
    45894536
    4590     // If this the first step, we can just accept and return true
     4537    // If this the first step, we can just accept and return true.
    45914538    $keys = array_keys( $bp->groups->group_creation_steps );
    45924539    if ( !bp_action_variable( 1 ) && array_shift( $keys ) == $step_slug ) {
     
    45954542
    45964543    // Before allowing a user to see a group creation step we must make sure
    4597     // previous steps are completed
     4544    // previous steps are completed.
    45984545    if ( !bp_is_first_group_creation_step() ) {
    45994546        if ( !bp_are_previous_group_creation_steps_complete( $step_slug ) ) {
     
    46024549    }
    46034550
    4604     // Check the current step against the step parameter
     4551    // Check the current step against the step parameter.
    46054552    if ( bp_is_action_variable( $step_slug ) ) {
    46064553        return true;
     
    46374584    $bp = buddypress();
    46384585
    4639     // If this is the first group creation step, return true
     4586    // If this is the first group creation step, return true.
    46404587    $keys = array_keys( $bp->groups->group_creation_steps );
    46414588    if ( array_shift( $keys ) == $step_slug ) {
     
    46474594    $previous_steps = array();
    46484595
    4649     // Get previous steps
     4596    // Get previous steps.
    46504597    foreach ( (array) $bp->groups->group_creation_steps as $slug => $name ) {
    46514598        if ( $slug === $step_slug ) {
     
    47614708 * @see bp_core_fetch_avatar() For more information on accepted arguments
    47624709 *
    4763  * @param  array  $args See bp_core_fetch_avatar()
     4710 * @param array|string $args See bp_core_fetch_avatar().
    47644711 */
    47654712function bp_new_group_avatar( $args = '' ) {
     
    47734720     * @see bp_core_fetch_avatar() For a description of arguments and return values.
    47744721     *
    4775      * @param array $args {
     4722     * @param array|string $args {
    47764723     *     Arguments are listed here with an explanation of their defaults.
    47774724     *     For more information about the arguments, see {@link bp_core_fetch_avatar()}.
     
    47884735    function bp_get_new_group_avatar( $args = '' ) {
    47894736
    4790         // Parse arguments
     4737        // Parse arguments.
    47914738        $r = bp_parse_args( $args, array(
    47924739            'type'    => 'full',
     
    47994746        ), 'get_new_group_avatar' );
    48004747
    4801         // Merge parsed arguments with object specific data
     4748        // Merge parsed arguments with object specific data.
    48024749        $r = array_merge( $r, array(
    48034750            'item_id'    => bp_get_current_group_id(),
     
    48064753        ) );
    48074754
    4808         // Get the avatar
     4755        // Get the avatar.
    48094756        $avatar = bp_core_fetch_avatar( $r );
    48104757
     
    48404787        $steps = array_keys( $bp->groups->group_creation_steps );
    48414788
    4842         // Loop through steps
     4789        // Loop through steps.
    48434790        foreach ( $steps as $slug ) {
    48444791
    4845             // Break when the current step is found
     4792            // Break when the current step is found.
    48464793            if ( bp_is_action_variable( $slug ) ) {
    48474794                break;
    48484795            }
    48494796
    4850             // Add slug to previous steps
     4797            // Add slug to previous steps.
    48514798            $previous_steps[] = $slug;
    48524799        }
    48534800
    4854         // Generate the URL for the previous step
     4801        // Generate the URL for the previous step.
    48554802        $group_directory = bp_get_groups_directory_permalink();
    48564803        $create_step     = 'create/step/';
     
    49114858 * @since 1.1.0
    49124859 *
    4913  * @param  string $step Step to compare
    4914  * @return bool         True if yes, False if no
     4860 * @param string $step Step to compare.
     4861 * @return bool True if yes, False if no
    49154862 */
    49164863function bp_is_last_group_creation_step( $step = '' ) {
    49174864
    4918     // Use current step, if no step passed
     4865    // Use current step, if no step passed.
    49194866    if ( empty( $step ) ) {
    49204867        $step = bp_get_groups_current_create_step();
    49214868    }
    49224869
    4923     // Get the last step
     4870    // Get the last step.
    49244871    $bp     = buddypress();
    49254872    $steps  = array_keys( $bp->groups->group_creation_steps );
    49264873    $l_step = array_pop( $steps );
    49274874
    4928     // Compare last step to step
     4875    // Compare last step to step.
    49294876    $retval = ( $l_step === $step );
    49304877
     
    49464893 * @since 1.1.0
    49474894 *
    4948  * @param  string $step Step to compare
    4949  * @return bool         True if yes, False if no
     4895 * @param string $step Step to compare.
     4896 * @return bool True if yes, False if no
    49504897 */
    49514898function bp_is_first_group_creation_step( $step = '' ) {
    49524899
    4953     // Use current step, if no step passed
     4900    // Use current step, if no step passed.
    49544901    if ( empty( $step ) ) {
    49554902        $step = bp_get_groups_current_create_step();
    49564903    }
    49574904
    4958     // Get the first step
     4905    // Get the first step.
    49594906    $bp     = buddypress();
    49604907    $steps  = array_keys( $bp->groups->group_creation_steps );
    49614908    $f_step = array_shift( $steps );
    49624909
    4963     // Compare first step to step
     4910    // Compare first step to step.
    49644911    $retval = ( $f_step === $step );
    49654912
     
    49804927 *
    49814928 * @since 1.0.0
     4929 *
     4930 * @param array $args Array of arguments for friends list output.
    49824931 */
    49834932function bp_new_group_invite_friend_list( $args = array() ) {
     
    49894938     * @since 1.0.0
    49904939     *
    4991      * @param  array $args
     4940     * @param array $args Array of arguments for friends list output.
    49924941     * @return mixed HTML list of checkboxes, or false
    49934942     */
    49944943    function bp_get_new_group_invite_friend_list( $args = array() ) {
    49954944
    4996         // Bail if no friends component
     4945        // Bail if no friends component.
    49974946        if ( ! bp_is_active( 'friends' ) ) {
    49984947            return false;
    49994948        }
    50004949
    5001         // Parse arguments
     4950        // Parse arguments.
    50024951        $r = wp_parse_args( $args, array(
    50034952            'user_id'   => bp_loggedin_user_id(),
     
    50064955        ) );
    50074956
    5008         // No group passed, so look for new or current group ID's
     4957        // No group passed, so look for new or current group ID's.
    50094958        if ( empty( $r['group_id'] ) ) {
    50104959            $bp            = buddypress();
     
    50144963        }
    50154964
    5016         // Setup empty items array
     4965        // Setup empty items array.
    50174966        $items = array();
    50184967
    5019         // Get user's friends who are not in this group already
     4968        // Get user's friends who are not in this group already.
    50204969        $friends = friends_get_friends_invite_list( $r['user_id'], $r['group_id'] );
    50214970
    50224971        if ( ! empty( $friends ) ) {
    50234972
    5024             // Get already invited users
     4973            // Get already invited users.
    50254974            $invites = groups_get_invites_for_group( $r['user_id'], $r['group_id'] );
    50264975
     
    51325081 * @since 1.1.0
    51335082 *
    5134  * @param string $slug
    5135  *
     5083 * @param string $slug Admin screen slug.
    51365084 * @return bool
    51375085 */
     
    51805128 *
    51815129 * @since 1.0.0
    5182  * @param string $type thumb or full ?
     5130 *
    51835131 * @uses bp_get_group_current_avatar() to get the avatar of the current group.
     5132 *
     5133 * @param string $type Thumb or full.
    51845134 */
    51855135function bp_group_current_avatar( $type = 'thumb' ) {
     
    51915141     * @since 2.0.0
    51925142     *
    5193      * @param string $type thumb or full ?
     5143     * @param string $type Thumb or full.
    51945144     * @return string $tab The current tab's slug.
    51955145     */
     
    52205170 * @since 1.1.0
    52215171 *
    5222  * @param  int|bool $group_id
    5223  *
     5172 * @param int|bool $group_id Group ID to check.
    52245173 * @return boolean
    52255174 */
     
    52765225}
    52775226
    5278 /** Group Membership Requests *************************************************/
     5227/* Group Membership Requests *************************************************/
    52795228
    52805229class BP_Groups_Membership_Requests_Template {
     
    53055254    public function __construct( $args = array() ) {
    53065255
    5307         // Backward compatibility with old method of passing arguments
     5256        // Backward compatibility with old method of passing arguments.
    53085257        if ( ! is_array( $args ) || func_num_args() > 1 ) {
    53095258            _deprecated_argument( __METHOD__, '2.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     
    53385287            'page'     => $this->pag_page,
    53395288
    5340             // These filters ensure we only get pending requests
     5289            // These filters ensure we only get pending requests.
    53415290            'is_confirmed' => false,
    53425291            'inviter_id'   => 0,
     
    53465295        $this->request_count = count( $this->requests );
    53475296
    5348         // Compatibility with legacy format of request data objects
     5297        // Compatibility with legacy format of request data objects.
    53495298        foreach ( $this->requests as $rk => $rv ) {
    53505299            // For legacy reasons, the 'id' property of each
    53515300            // request must match the membership id, not the ID of
    5352             // the user (as it's returned by BP_Group_Member_Query)
     5301            // the user (as it's returned by BP_Group_Member_Query).
    53535302            $this->requests[ $rk ]->user_id = $rv->ID;
    53545303            $this->requests[ $rk ]->id      = $rv->membership_id;
    53555304
    5356             // Miscellaneous values
     5305            // Miscellaneous values.
    53575306            $this->requests[ $rk ]->group_id   = $r['group_id'];
    53585307        }
     
    54175366             */
    54185367            do_action( 'group_request_loop_end' );
    5419             // Do some cleaning up after the loop
     5368            // Do some cleaning up after the loop.
    54205369            $this->rewind_requests();
    54215370        }
     
    54295378        $this->request     = $this->next_request();
    54305379
    5431         // loop has just started
     5380        // Loop has just started.
    54325381        if ( 0 == $this->current_request ) {
    54335382
     
    56645613    public function __construct( $args = array() ) {
    56655614
    5666         // Backward compatibility with old method of passing arguments
     5615        // Backward compatibility with old method of passing arguments.
    56675616        if ( ! is_array( $args ) || func_num_args() > 1 ) {
    56685617            _deprecated_argument( __METHOD__, '2.0.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
     
    56955644            'page'     => $this->pag_page,
    56965645
    5697             // These filters ensure we get only pending invites
     5646            // These filters ensure we get only pending invites.
    56985647            'is_confirmed' => false,
    56995648            'inviter_id'   => $r['user_id'],
     
    57065655
    57075656        // If per_page is set to 0 (show all results), don't generate
    5708         // pag_links
     5657        // pag_links.
    57095658        if ( ! empty( $this->pag_num ) ) {
    57105659            $this->pag_links = paginate_links( array(
     
    58415790    }
    58425791
    5843     // Set the global (for use in BP_Groups_Invite_Template::the_invite())
     5792    // Set the global (for use in BP_Groups_Invite_Template::the_invite()).
    58445793    if ( empty( $group_id ) ) {
    58455794        $group_id = $r['group_id'];
     
    60265975function bp_groups_activity_feed() {
    60275976
    6028     // Bail if not viewing a single group or activity is not active
     5977    // Bail if not viewing a single group or activity is not active.
    60295978    if ( ! bp_is_active( 'groups' ) || ! bp_is_active( 'activity' ) || ! bp_is_group() ) {
    60305979        return;
     
    60495998     *
    60505999     * @since 1.5.0
     6000     *
    60516001     * @return string
    60526002     */
     
    62146164 * @param string $query_args
    62156165 * @param bool $nonce
    6216  *
    62176166 * @return string
    62186167 */
     
    62286177     * @param string $query_args
    62296178     * @param bool $nonce
    6230      *
    62316179     * @return string
    62326180     */
     
    62366184        $url           = '';
    62376185
    6238         // Must be a group
     6186        // Must be a group.
    62396187        if ( ! empty( $current_group->id ) ) {
    62406188
     
    62466194            }
    62476195
    6248             // Add a slash at the end of our user url
     6196            // Add a slash at the end of our user url.
    62496197            $url = trailingslashit( $url );
    62506198
    6251             // Add possible query args
     6199            // Add possible query args.
    62526200            if ( !empty( $query_args ) && is_array( $query_args ) ) {
    62536201                $url = add_query_arg( $query_args, $url );
Note: See TracChangeset for help on using the changeset viewer.