Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/17/2020 07:31:44 PM (5 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/cover-image-header.php

    r12595 r12789  
    44 *
    55 * @since 3.0.0
    6  * @version 3.2.0
     6 * @version 7.0.0
    77 */
    88?>
     
    2222        <?php endif; ?>
    2323
    24 <?php   if ( ! bp_nouveau_groups_front_page_description() ) : ?>
    25         <div id="item-header-content">
     24        <?php if ( ! bp_nouveau_groups_front_page_description() ) : ?>
     25            <div id="item-header-content">
    2626
    27             <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_group_meta()->status ); ?></strong></p>
    28             <p class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>">
     27                <?php if ( bp_nouveau_group_has_meta( 'status' ) ) : ?>
     28                    <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ) ); ?></strong></p>
     29                <?php endif; ?>
     30
     31                <p class="activity">
     32                    <?php
     33                        printf(
     34                            /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */
     35                            esc_html__( 'Active %s', 'buddypress' ),
     36                            sprintf(
     37                                '<span data-livestamp="%1$s">%2$s</span>',
     38                                bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ),
     39                                esc_html( bp_get_group_last_active() )
     40                            )
     41                        );
     42                    ?>
     43                </p>
     44
    2945                <?php
    30                 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */
    31                 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
     46                bp_group_type_list(
     47                    bp_get_group_id(),
     48                    array(
     49                        'label'        => __( 'Group Types', 'buddypress' ),
     50                        'list_element' => 'span',
     51                    )
     52                );
    3253                ?>
    33             </p>
    3454
    35             <?php echo bp_nouveau_group_meta()->group_type_list; ?>
    36             <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?>
     55                <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?>
    3756
    38             <?php if ( bp_nouveau_group_has_meta_extra() ) : ?>
    39                 <div class="item-meta">
     57                <?php if ( bp_nouveau_group_has_meta_extra() ) : ?>
     58                    <div class="item-meta">
    4059
    41                     <?php echo bp_nouveau_group_meta()->extra; ?>
     60                        <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?>
    4261
    43                 </div><!-- .item-meta -->
    44             <?php endif; ?>
     62                    </div><!-- .item-meta -->
     63                <?php endif; ?>
    4564
    46             <?php bp_nouveau_group_header_buttons(); ?>
     65                <?php bp_nouveau_group_header_buttons(); ?>
    4766
    48         </div><!-- #item-header-content -->
    49 <?php endif; ?>
     67            </div><!-- #item-header-content -->
     68        <?php endif; ?>
    5069
    5170        <?php bp_get_template_part( 'groups/single/parts/header-item-actions' ); ?>
Note: See TracChangeset for help on using the changeset viewer.