Skip to:
Content

BuddyPress.org

Changeset 10158


Ignore:
Timestamp:
09/29/2015 11:13:57 PM (5 years ago)
Author:
imath
Message:

Introduce BuddyPress Cover Images functions and templates specific to the Groups single items.

Props r-a-y

See #6570

Location:
trunk/src
Files:
1 added
6 edited

Legend:

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

    r10148 r10158  
    314314        }
    315315
     316        if ( bp_group_use_cover_image_header() ) {
     317            $this->group_creation_steps['group-cover-image'] = array(
     318                'name'     => _x( 'Cover Image', 'Group screen nav', 'buddypress' ),
     319                'position' => 25
     320            );
     321        }
     322
    316323        // If friends component is active, add invitations
    317324        if ( bp_is_active( 'friends' ) ) {
     
    592599                }
    593600
     601                if ( bp_group_use_cover_image_header() ) {
     602                    $sub_nav[] = array_merge( array(
     603                        'name'     => __( 'Cover Image', 'buddypress' ),
     604                        'slug'     => 'group-cover-image',
     605                        'position' => 25,
     606                    ), $default_params );
     607                }
     608
    594609                $sub_nav[] = array_merge( array(
    595610                    'name'     => __( 'Members', 'buddypress' ),
  • trunk/src/bp-groups/bp-groups-screens.php

    r10148 r10158  
    988988}
    989989add_action( 'bp_screens', 'groups_screen_group_admin_avatar' );
     990
     991/**
     992 * Handle the display of a group's Change cover image page.
     993 *
     994 * @since 2.4.0
     995 */
     996function groups_screen_group_admin_cover_image() {
     997    if ( 'group-cover-image' != bp_get_group_current_admin_tab() ) {
     998        return false;
     999    }
     1000
     1001    // If the logged-in user doesn't have permission or if cover image uploads are disabled, then stop here
     1002    if ( ! bp_is_item_admin() || ! bp_group_use_cover_image_header() ) {
     1003        return false;
     1004    }
     1005
     1006    /**
     1007     * Fires before the loading of the group Change cover image page template.
     1008     *
     1009     * @since 2.4.0
     1010     *
     1011     * @param int $id ID of the group that is being displayed.
     1012     */
     1013    do_action( 'groups_screen_group_admin_cover_image', bp_get_current_group_id() );
     1014
     1015    /**
     1016     * Filters the template to load for a group's Change cover image page.
     1017     *
     1018     * @since 2.4.0
     1019     *
     1020     * @param string $value Path to a group's Change cover image template.
     1021     */
     1022    bp_core_load_template( apply_filters( 'groups_template_group_admin_cover_image', 'groups/single/home' ) );
     1023}
     1024add_action( 'bp_screens', 'groups_screen_group_admin_cover_image' );
    9901025
    9911026/**
  • trunk/src/bp-groups/bp-groups-template.php

    r10148 r10158  
    10051005    }
    10061006
     1007/** Group cover image *********************************************************/
     1008
     1009/**
     1010 * Should we use the group's cover image header
     1011 *
     1012 * @since 2.4.0
     1013 *
     1014 * @return bool True if the displayed user has a cover image,
     1015 *              False otherwise
     1016 */
     1017function bp_group_use_cover_image_header() {
     1018    return (bool) bp_is_active( 'groups', 'cover_image' ) && ! bp_disable_group_cover_image_uploads() && bp_attachments_is_wp_version_supported();
     1019}
     1020
    10071021/**
    10081022 * Output the 'last active' string for the current group in the loop.
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/create.php

    r10150 r10158  
    253253            <?php endif; ?>
    254254
    255             <?php /* Group creation step 4: Invite friends to group */ ?>
     255            <?php /* Group creation step 4: Cover image */ ?>
     256            <?php if ( bp_is_group_creation_step( 'group-cover-image' ) ) : ?>
     257
     258                <?php
     259
     260                /**
     261                 * Fires before the display of the group cover image creation step.
     262                 *
     263                 * @since 2.4.0
     264                 */
     265                do_action( 'bp_before_group_cover_image_creation_step' ); ?>
     266
     267                <div id="header-cover-image"></div>
     268
     269                <p><?php _e( 'The Cover Image will be used to customize the header of your group.', 'buddypress' ); ?></p>
     270
     271                <?php bp_attachments_get_template_part( 'cover-images/index' ); ?>
     272
     273                <?php
     274
     275                /**
     276                 * Fires after the display of the group cover image creation step.
     277                 *
     278                 * @since 2.4.0
     279                 */
     280                do_action( 'bp_after_group_cover_image_creation_step' ); ?>
     281
     282                <?php wp_nonce_field( 'groups_create_save_group-cover-image' ); ?>
     283
     284            <?php endif; ?>
     285
     286            <?php /* Group creation step 5: Invite friends to group */ ?>
    256287            <?php if ( bp_is_group_creation_step( 'group-invites' ) ) : ?>
    257288
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/admin.php

    r10150 r10158  
    205205
    206206    <?php endif; ?>
     207
     208<?php endif; ?>
     209
     210<?php /* Group Cover image Settings */ ?>
     211<?php if ( bp_is_group_admin_screen( 'group-cover-image' ) ) : ?>
     212
     213    <h4><?php _e( 'Change Cover Image', 'buddypress' ); ?></h4>
     214
     215    <?php
     216
     217    /**
     218     * Fires before the display of profile cover image upload content.
     219     *
     220     * @since 2.4.0
     221     */
     222    do_action( 'bp_before_group_settings_cover_image' ); ?>
     223
     224    <p><?php _e( 'The Cover Image will be used to customize the header of your group.', 'buddypress' ); ?></p>
     225
     226    <?php bp_attachments_get_template_part( 'cover-images/index' ); ?>
     227
     228    <?php
     229
     230    /**
     231     * Fires after the display of group cover image upload content.
     232     *
     233     * @since 2.4.0
     234     */
     235    do_action( 'bp_after_group_settings_cover_image' ); ?>
    207236
    208237<?php endif; ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/home.php

    r10150 r10158  
    1414    <div id="item-header" role="complementary">
    1515
    16         <?php bp_get_template_part( 'groups/single/group-header' ); ?>
     16        <?php
     17        /**
     18         * If the cover image feature is enabled, use a specific header
     19         */
     20        if ( bp_group_use_cover_image_header() ) :
     21            bp_get_template_part( 'groups/single/cover-image-header' );
     22        else :
     23            bp_get_template_part( 'groups/single/group-header' );
     24        endif;
     25        ?>
    1726
    1827    </div><!-- #item-header -->
Note: See TracChangeset for help on using the changeset viewer.