buddypress / next-template-packs

is this the next BuddyPress template pack?
35 stars 9 forks source link

Error with Customize option "Display the Group's description in the front page body" #155

Closed Jon007 closed 7 years ago

Jon007 commented 7 years ago

Error with Customize option "Display the Group's description in the front page body"

When this option is set, all group pages produce the notice:

Notice: Undefined property: stdClass::$status in /Applications/MAMP/htdocs/acef/wp-content/plugins/next-template-packs/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php on line 29

<p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_group_meta()->status ); ?></strong></p>

The Group description is successfully moved from the header to the front page body.

This is reproducible on twenty-sixteen theme, with all plugins disabled except bbPress, BuddyPress, Next Template Packs.

Jon007 commented 7 years ago

Hi, the fix is to make the template header parts conditional with: <?php if ( ! bp_nouveau_groups_front_page_description() ) : ?> Otherwise the relevant header calls to bp_nouveau_group_meta() will fail because these attributes are intentionally not initialized if this option is set:

                /**
                 * If the Group's default front page isn't set to display
                 * the description inside it, include the description to metas
                 */
                if ( ! bp_nouveau_groups_front_page_description() ) {
                    $meta = array(
                        'status'          =>  bp_get_group_type(),
                        'group_type_list' =>  bp_get_group_type_list(),
                        'description'     =>  bp_get_group_description(),
                    );
                }
hnla commented 7 years ago

@Jon007 Thanks for the report & PR I'll test this a bit later.