Skip to:
Content

BuddyPress.org

Changeset 9943


Ignore:
Timestamp:
06/12/2015 03:28:40 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Groups: bp_get_new_group_avatar() improvements:

  • Add documentation
  • Use modern coding standards
  • Use bp_get_current_group_id() instead of global touch

This change improves the readibility of the code used to generate the avatar of the group being created.

File:
1 edited

Legend:

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

    r9942 r9943  
    46754675    }
    46764676
     4677/**
     4678 * Output the avatar for the group currently being created
     4679 *
     4680 * @since BuddyPress (1.1.0)
     4681 *
     4682 * @see bp_core_fetch_avatar() For more information on accepted arguments
     4683 *
     4684 * @param  array  $args See bp_core_fetch_avatar()
     4685 */
    46774686function bp_new_group_avatar( $args = '' ) {
    46784687    echo bp_get_new_group_avatar( $args );
    46794688}
     4689    /**
     4690     * Return the avatar for the group currently being created
     4691     *
     4692     * @since BuddyPress (1.1.0)
     4693     *
     4694     * @see bp_core_fetch_avatar() For more information on accepted arguments
     4695     *
     4696     * @param  array  $args See bp_core_fetch_avatar()
     4697     * @return string       The avatar for the group being created
     4698     */
    46804699    function bp_get_new_group_avatar( $args = '' ) {
    4681         $bp = buddypress();
    4682 
    4683         $r = wp_parse_args( $args, array(
     4700
     4701        // Parse arguments
     4702        $r = bp_parse_args( $args, array(
    46844703            'type'    => 'full',
    46854704            'width'   => false,
     
    46874706            'class'   => 'avatar',
    46884707            'id'      => 'avatar-crop-preview',
    4689             'alt'     => __( 'Group avatar', 'buddypress' ),
     4708            'alt'     => __( 'Group photo', 'buddypress' ),
    46904709            'no_grav' => false
    4691         ) );
    4692 
     4710        ), 'get_new_group_avatar' );
     4711
     4712        // Merge parsed arguments with object specific data
    46934713        $r = array_merge( $r, array(
    4694             'item_id'    => $bp->groups->current_group->id,
     4714            'item_id'    => bp_get_current_group_id(),
    46954715            'object'     => 'group',
    46964716            'avatar_dir' => 'group-avatars',
    46974717        ) );
    46984718
     4719        // Get the avatar
    46994720        $avatar = bp_core_fetch_avatar( $r );
    47004721
Note: See TracChangeset for help on using the changeset viewer.