Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/17/2020 07:31:44 PM (4 years ago)
Author:
imath
Message:

BP Nouveau: improve the way Groups template meta data are managed

Deprecate bp_nouveau_group_meta() and introduce bp_nouveau_the_group_meta() as a replacement. This function is used into BP Nouveau template parts to output specific Groups data mainly inside the .item-meta container of the Groups templates.

Stop using bp_nouveau_group_meta() to display Group Types inside the Group's header (and actually make sure the regular and cover image headers are outputting the Group Types if necessary). BP Nouveau is now directly using the BP Groups template tag bp_group_type_list().

Finally, make sure the Group's last activity .item-meta container always shows the "Active" word before the human time diff we're live updating using JavaScript.

Fixes #8391

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php

    r12595 r12789  
    44 *
    55 * @since 3.0.0
    6  * @version 3.2.0
     6 * @version 7.0.0
    77 */
    88?>
     
    2222<div id="item-header-content">
    2323
    24     <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_group_meta()->status ); ?></strong></p>
     24    <?php if ( bp_nouveau_group_has_meta( 'status' ) ) : ?>
     25        <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ) ); ?></strong></p>
     26    <?php endif; ?>
    2527
    26     <p class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>">
     28    <p class="activity">
    2729        <?php
    28         echo esc_html(
    29             sprintf(
     30            printf(
    3031                /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */
    31                 __( 'active %s', 'buddypress' ),
    32                 bp_get_group_last_active()
    33             )
    34         );
     32                esc_html__( 'Active %s', 'buddypress' ),
     33                sprintf(
     34                    '<span data-livestamp="%1$s">%2$s</span>',
     35                    bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ),
     36                    esc_html( bp_get_group_last_active() )
     37                )
     38            );
    3539        ?>
    3640    </p>
     41
     42    <?php
     43    bp_group_type_list(
     44        bp_get_group_id(),
     45        array(
     46            'label'        => __( 'Group Types', 'buddypress' ),
     47            'list_element' => 'span',
     48        )
     49    );
     50    ?>
    3751
    3852    <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?>
     
    4155        <div class="item-meta">
    4256
    43             <?php echo bp_nouveau_group_meta()->extra; ?>
     57            <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
    4458
    4559        </div><!-- .item-meta -->
Note: See TracChangeset for help on using the changeset viewer.