Tagged: Default Tab, featured members
Hello,
I tried to find the answer in the forum but couldn´t find it, sorry if the soultion is already here!
I´d like to make our users see the Featured Members as the default tab, adding the “All Members” tab to be shown after that tab. It is possible to change it easily?
Thanks A LOT for any help!
Best regards,
RicardoHello Ricardo,
Thank you for posting. Please use the following code to make featured members tab as default.
/** * Set default activity directory tab for BuddyPress */ function buddydev_custom_set_default_members_directory_tab() { // If user is not logged in or // If the scope is already set, do not do anything ok. if ( ! function_exists( 'bp_featured_members' ) || isset( $_COOKIE['bp-members-scope'] ) ) { return ; } // additional check for members dir if ( ! bp_is_members_directory() ) { return ; } setcookie( 'bp-members-scope', 'featured',null, '/' ); $_COOKIE['bp-members-scope'] = 'featured'; } add_action( 'bp_template_redirect', 'buddydev_custom_set_default_members_directory_tab' );
To make feauted tab as first position. You have to override members/index.php template.
just copy the template from plugin directory to active theme directory path like
buddypress/members/index.php
and put the action
<?php /** * Fires inside the members directory member types. * * @since 1.2.0 */ do_action( 'bp_members_directory_member_types' ); ?>
above the following line
<li id="members-all">
Please let me know if it works or not.
Regards
Ravi
You must be logged in to reply to this topic.