Job and Expert with Q&A Reputation Points integration

Hi,
I've seen you Q&A system is somehow integrated with your job and expert section. My question, is this available out of box? For example, I can order experts (in jobs& experts plugin) based on their points at Q&A plugin, also their Reputation Points will be shown on their expert profile? Is that possible?

Thanks Best wpmu DEV site!

  • Predrag Dubajic

    Hey @btati1,

    Hope you're doing well today :slight_smile:

    There is no direct integration for J&E and Q&A that will give solution for this out of the box.

    Are you looking only to show Q&A reputation on Expert page?
    If this is all you need to do I believe we can get something working for you with a little help of our devs, just let me know if this is what you are looking for or am I missing something :slight_smile:

    Best regards,
    Predrag

  • Adam Czajczyk

    Hey btati1

    I hope you're well today!

    1- Yes I want to show to sho Q&A reputation on Expert page (profile)?

    There's a template tag function included in Q&A plugin that should let you display reputation point of selected user anywhere in your site's template.

    <?php  the_qa_user_rep( 10); ?>

    The number as parameter is an ID of user.

    2-(if possible) Browse Expert results based on their reputation (higher points > top rank)

    I'm pretty sure this should be doable so let me please ask the developer for a little help here. Please keep an eye on this thread for further updates and information!

    Cheers,
    Adam

  • Hoang Ngo

    Hi @btati1,

    I hope you are well today and thanks for your question.

    2-(if possible) Browse Expert results based on their reputation (higher points > top rank)

    This can be doable, first, we will need to sync the authors reputation point with experts profile. Please add this code to your theme functions.php or use mu-plugins

    add_action( 'updated_user_meta', 'sync_rep_to_expert', 10, 4 );
    function sync_rep_to_expert( $meta_id, $object_id, $meta_key, $meta_value ) {
    	if ( $meta_key != '_qa_rep' ) {
    		return;
    	}
    
    	//find the export profile
    	$model = JE_Expert_Model::model()->find_one_by_attributes( array(
    		'user_id' => $object_id
    	) );
    	if ( is_object( $model ) ) {
    		update_post_meta( $model->id, '_qa_rep', $meta_value );
    	}
    }
    
    add_action( 'wp_loaded', 'sync_qa_rep_with_experts' );
    function sync_qa_rep_with_experts() {
    	if ( ! get_option( 'qa_synced_expert' ) ) {
    		$users = get_users();
    		foreach ( $users as $user ) {
    			$rep   = get_user_meta( $user->ID, 'qa_rep', true );
    			$model = JE_Expert_Model::model()->find_one_by_attributes( array(
    				'user_id' => $user->ID
    			) );
    			if ( is_object( $model ) ) {
    				update_post_meta( $model->id, '_qa_rep', $rep );
    			}
    		}
    		update_option( 'qa_synced_expert', 1 );
    	}
    }
    
    add_action( 'jbp_pro_after_save', 'je_init_rep_point' );
    function je_init_rep_point( $model ) {
    	if ( ! get_post_meta( $model->id, '_qa_rep', true ) ) {
    		update_post_meta( $model->id, '_qa_rep', 0 );
    	}
    }

    And now, we will need to modify the experts query a little bit. Please add this code to your site same the way you adding the above code :slight_smile:

    add_filter( 'jbp_expert_search_params', 'update_default_sorting_experts' );
    function update_default_sorting_experts( $args ) {
    	if ( ! isset( $args['meta_query'] ) ) {
    		$args['meta_query'] = array();
    	}
    	$args['meta_key'] = '_qa_rep';
    	$args['orderby']  = 'meta_value';
    	$args['order']    = 'DESC';
    
    	return $args;
    }

    Lets see if this works for you :slight_smile:

    Best regards,
    Hoang

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.