Skip to:
Content

BuddyPress.org

Changeset 10157


Ignore:
Timestamp:
09/29/2015 11:02:46 PM (9 years ago)
Author:
imath
Message:

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

Props r-a-y

See #6570

Location:
trunk/src
Files:
2 added
5 edited

Legend:

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

    r10149 r10157  
    14801480}
    14811481
     1482/** Cover image ***************************************************************/
     1483
     1484/**
     1485 * Should we use the cover image header
     1486 *
     1487 * @since 2.4.0
     1488 *
     1489 * @return bool True if the displayed user has a cover image,
     1490 *              False otherwise
     1491 */
     1492function bp_displayed_user_use_cover_image_header() {
     1493    return (bool) bp_is_active( 'xprofile', 'cover_image' ) && ! bp_disable_cover_image_uploads() && bp_attachments_is_wp_version_supported();
     1494}
     1495
    14821496/** Avatars *******************************************************************/
    14831497
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/home.php

    r10150 r10157  
    1212    <div id="item-header" role="complementary">
    1313
    14         <?php bp_get_template_part( 'members/single/member-header' ) ?>
     14        <?php
     15        /**
     16         * If the cover image feature is enabled, use a specific header
     17         */
     18        if ( bp_displayed_user_use_cover_image_header() ) :
     19            bp_get_template_part( 'members/single/cover-image-header' );
     20        else :
     21            bp_get_template_part( 'members/single/member-header' );
     22        endif;
     23        ?>
    1524
    1625    </div><!-- #item-header -->
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/profile.php

    r10150 r10157  
    3838        break;
    3939
     40    // Change Cover Image
     41    case 'change-cover-image' :
     42        bp_get_template_part( 'members/single/profile/change-cover-image' );
     43        break;
     44
    4045    // Compose
    4146    case 'public' :
  • trunk/src/bp-xprofile/bp-xprofile-loader.php

    r10140 r10157  
    228228        }
    229229
     230        // Change Cover image
     231        if ( bp_displayed_user_use_cover_image_header() ) {
     232            $sub_nav[] = array(
     233                'name'            => _x( 'Change Cover Image', 'Profile header sub menu', 'buddypress' ),
     234                'slug'            => 'change-cover-image',
     235                'parent_url'      => $profile_link,
     236                'parent_slug'     => $slug,
     237                'screen_function' => 'xprofile_screen_change_cover_image',
     238                'position'        => 40,
     239                'user_has_access' => $access
     240            );
     241        }
     242
    230243        // The Settings > Profile nav item can only be set up after
    231244        // the Settings component has run its own nav routine
     
    316329            }
    317330
     331            if ( bp_displayed_user_use_cover_image_header() ) {
     332                $wp_admin_nav[] = array(
     333                    'parent' => 'my-account-' . $this->id,
     334                    'id'     => 'my-account-' . $this->id . '-change-cover-image',
     335                    'title'  => _x( 'Change Cover Image', 'My Account Profile sub nav', 'buddypress' ),
     336                    'href'   => trailingslashit( $profile_link . 'change-cover-image' )
     337                );
     338            }
    318339        }
    319340
  • trunk/src/bp-xprofile/bp-xprofile-screens.php

    r10140 r10157  
    297297
    298298/**
     299 * Displays the change cover image page.
     300 *
     301 * @package BuddyPress XProfile
     302 *
     303 * @since 2.4.0
     304 */
     305function xprofile_screen_change_cover_image() {
     306
     307    // Bail if not the correct screen
     308    if ( ! bp_is_my_profile() && ! bp_current_user_can( 'bp_moderate' ) ) {
     309        return false;
     310    }
     311
     312    /**
     313     * Fires right before the loading of the XProfile change cover image screen template file.
     314     *
     315     * @since 2.4.0
     316     */
     317    do_action( 'xprofile_screen_change_cover_image' );
     318
     319    /**
     320     * Filters the template to load for the XProfile cover image screen.
     321     *
     322     * @since 2.4.0
     323     *
     324     * @param string $template Path to the XProfile cover image template to load.
     325     */
     326    bp_core_load_template( apply_filters( 'xprofile_template_cover_image', 'members/single/home' ) );
     327}
     328
     329/**
    299330 * Show the xprofile settings template
    300331 *
Note: See TracChangeset for help on using the changeset viewer.