Skip to:
Content

BuddyPress.org

Changeset 9757


Ignore:
Timestamp:
04/16/2015 10:36:38 PM (4 years ago)
Author:
imath
Message:

Avatar UI: Add Backbone templates and adapt the legacy avatar templates.

The Backone templates will be in a new "assets" sub directory of bp-templates\bp-legacy\buddypress. For the introduction of the feature we are advising you *to not override* these specific templates from your theme. The underscore in each sub folder names of this "assets" directory is informing we wish to restrict the content of the sub folder to Core use only.

We are introducing a new template tag to load these Backbone templates : bp_avatar_get_templates(). We recommand that you update the avatar templates of your theme if you are overriding groups/create, groups/single/admin or members/single/profile/change-avatar once 2.3 will be released. If this new template tag is not into the template, then bp_avatar_template_check() will try to load them using template hooks.

Props johnjamesjacoby, hnla, r-a-y.

See #6290

Location:
trunk/src
Files:
7 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-avatars.php

    r9755 r9757  
    14381438    return apply_filters( 'bp_avatar_use_webcam', true );
    14391439}
     1440
     1441/**
     1442 * Template function to load the Avatar UI javascript templates
     1443 *
     1444 * @since  BuddyPress (2.3.0)
     1445 */
     1446function bp_avatar_get_templates() {
     1447    if ( ! bp_avatar_is_front_edit() ) {
     1448        return;
     1449    }
     1450
     1451    bp_attachments_get_template_part( 'avatars/index' );
     1452}
     1453
     1454/**
     1455 * Trick to check if the theme's BuddyPress templates are up to date
     1456 *
     1457 * If the "avatar templates" are not including the new template tag, this will
     1458 * help users to get the avatar UI and inform the most curious that their
     1459 * templates are out of date.
     1460 *
     1461 * @since  BuddyPress (2.3.0)
     1462 */
     1463function bp_avatar_template_check() {
     1464    if ( ! bp_avatar_is_front_edit() ) {
     1465        return;
     1466    }
     1467
     1468    if ( ! did_action( 'bp_attachments_avatar_check_template' ) ) {
     1469        bp_attachments_get_template_part( 'avatars/index' );
     1470    }
     1471}
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/create.php

    r9604 r9757  
    6161
    6262                    <label>
    63                         <input type="radio" name="group-status" value="private"<?php if ( 'private' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> 
     63                        <input type="radio" name="group-status" value="private"<?php if ( 'private' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
    6464                        <strong><?php _e( 'This is a private group', 'buddypress' ); ?></strong>
    6565                    </label>
     
    7272
    7373                    <label>
    74                         <input type="radio" name="group-status" value="hidden"<?php if ( 'hidden' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> /> 
     74                        <input type="radio" name="group-status" value="hidden"<?php if ( 'hidden' == bp_get_new_group_status() ) { ?> checked="checked"<?php } ?> />
    7575                        <strong><?php _e('This is a hidden group', 'buddypress' ); ?></strong>
    7676                    </label>
     
    153153                        <p><?php _e( 'To skip the group profile photo upload process, hit the "Next Step" button.', 'buddypress' ); ?></p>
    154154                    </div><!-- .main-column -->
     155
     156                    <?php
     157                    /**
     158                     * Load the Avatar UI templates
     159                     *
     160                     * @since  BuddyPress (2.3.0)
     161                     */
     162                    bp_avatar_get_templates(); ?>
    155163
    156164                <?php endif; ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/groups/single/admin.php

    r9604 r9757  
    140140
    141141            <?php endif; ?>
     142
     143            <?php
     144            /**
     145             * Load the Avatar UI templates
     146             *
     147             * @since  BuddyPress (2.3.0)
     148             */
     149            bp_avatar_get_templates(); ?>
    142150
    143151            <?php wp_nonce_field( 'bp_avatar_upload' ); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/profile/change-avatar.php

    r9604 r9757  
    5151    </form>
    5252
     53    <?php
     54    /**
     55     * Load the Avatar UI templates
     56     *
     57     * @since  BuddyPress (2.3.0)
     58     */
     59    bp_avatar_get_templates(); ?>
     60
    5361<?php else : ?>
    5462
Note: See TracChangeset for help on using the changeset viewer.