The Grimlock BuddyPress plugin contains templates that render list items in ‘cards’. An example is viewing the members who belong to a BuddyPress group, or viewing the members directory.
The Grimlock plugin, places the
<?php do_action( 'bp_group_members_list_item' ); ?>call outside the card, meaning there are no hooks for third party plugins to display additional content inside the members card.
Additionally, the placement of the
do_actionfunction call is contrary to the default BuddyPress templates. BuddyPress places the
do_actionfunction call before list item actions are displayed.
I propose moving the
do_actioncall to be inside the card, before list item actions are output, to be inline with default BuddyPress behaviour, or adding a new
do_actioncall to allow proper plugin and theme integration.
This change would make the template inline with the Grimlock members directory template, which place
do_action( 'bp_directory_members_item' );inside the card.
An excerpt of the template is below:
<li class="bp-card-list__item bp-card-list--members__item has-post-thumbnail element-animated fade-in short element-animated-delay element-animated-both"> <div class="card"> <div class="card-img"> <a href="<?php bp_group_member_domain(); ?>"> <?php bp_group_member_avatar_thumb( 'type=full' ); ?> </a> </div> <!-- .card-img --> <div class="card-body pt-1 pb-4 pl-2 pr-2"> <header class="card-body-header entry-header clearfix"> <h2 class="entry-title"> <?php bp_group_member_link(); ?> </h2> <!-- .entry-title --> </header> <!-- .card-body-header --> <div class="card-body-meta"> <div class="bp-member-xprofile-custom-fields"><?php do_action( 'grimlock_buddypress_member_xprofile_custom_fields' ); ?></div> <!-- .bp-member-xprofile-custom-fields --> <div class="card-body-activity"> <?php $group_member_joined_since_args = array( 'relative' => false, ); ?> <span class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_member_joined_since( $group_member_joined_since_args ) ); ?>"><?php bp_group_member_joined_since(); ?></span> </div><!-- .card-body-activity --> </div> <!-- .card-body-meta --> <?php if ( bp_is_active( 'friends' ) ) : ?> <div class="card-body-actions action"> <?php bp_add_friend_button( bp_get_group_member_id(), bp_get_group_member_is_friend() ); ?> <?php do_action( 'bp_group_members_list_item_action' ); ?> </div> <!-- .card-body-actions --> <?php endif; ?> </div> <!-- .card-body --> </div> <!-- .card --> <?php do_action( 'bp_group_members_list_item' ); ?> </li> <!-- .bp-card-list__item -->September 22, 2022 at 09:05 #42721
Thank you for the feedback!
Your suggestion makes sense, we will make sure to position the
bp_group_members_list_itemhook before the item actions in the next update of Grimlock for BuddyPress.
Unfortunately we don’t know when the next update will come out so we can’t give you an ETA on that. In the meantime, if you are working with a theme you can simply override that template by copying it in buddypress/groups/single/members.php within your theme. This way you’ll be able to move the hook while waiting for the update, and even add extra stuff in the template should you need to.
Best regards,September 22, 2022 at 11:23 #42724
Thanks Jason, that would be great.
I’ve also see that
<?php do_action( 'bp_directory_members_item' ); ?>is called twice within
grimlock-buddypress/templates/members/members-loop.php, once on line #34 and again on line #58.
It looks like the call on #34 is meant to be for a different action.
Cheers.September 23, 2022 at 01:24 #42730
We have just released a new update of Grimlock for BuddyPress. Updating this plugin to the latest version should fix this issue.
After the update, the problem should now be fixed. However, you might still be seeing the issue because your browser cache is showing you an older version of the page (browsers do that to load pages faster). To see that the issue is resolved you will need to empty your browser cache and reload the page. If you want to read more on what browser cache is and how to clear it, here is an article that might help you: How to Clear Internet Cache in Every Major Browser.
Kindest regards,January 23, 2023 at 11:30 #43976
You must be logged in to reply to this topic.