Add profile filter with Xprofile
-
Hey, so i am trying to add a filter in the members search to only show the profiles that have a certain role in an Xprofile field, doing some research i came across the next code
if ( !defined( 'ABSPATH' ) ) exit; class BP_Loop_Filters { /** * Constructor */ public function __construct() { $this->setup_actions(); } private function setup_actions() { add_action( 'bp_members_directory_order_options', array( $this, 'random_order' ) ); if( bp_is_active( 'groups' ) ) add_action( 'bp_groups_directory_order_options', array( $this, 'random_order' ) ); if( is_multisite() && bp_is_active( 'blogs' ) ) add_action( 'bp_blogs_directory_order_options', array( $this, 'random_order' ) ); } public function random_order() { ?> <option value="random"><?php _e( 'Random', 'buddypress' ); ?></option> <?php } } function bp_loop_filters() { return new BP_Loop_Filters(); } add_action( 'bp_include', 'bp_loop_filters' );
i tried adjusting it to call the Xprofile fields i want but it caused a complete error on the website, any help?
- You must be logged in to reply to this topic.