BuddyDev

Search

[Resolved] Connecting Xprofilefields to User insights

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46675

    hello any updates?

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #46678

    Hi Ethan,

    Please put this code in your bp-custom.php

    
    /**
     * Force Userinsights plugin to use age instead of date.
     */
    add_filter( 'usin_user_profile_data', function ( $user ) {
    
    	$filed_id = 25; // please change with your birthdate field id.
    
    	$key = "bxp_{$filed_id}";
    
    	if ( $user->{$key} ) {
    		$user->{$key} = xprofile_get_field_data( $filed_id, $user->ID );
    	}
    
    	return $user;
    } );
    

    and make sure to update the field id with the correct field id.

    It will fix the issue. Please let me know if it works for you or not?

    PS:- This is happening due to incorrect implementation of userinsights and I will recommend that you request them to fix it.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46777

    It does not work i switched the field id to the field we use and the date stays the same it does not pull the age any ideas or would you like screenshots?

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46778

    I reached out to user insights already and now again with your information i bet they will not help us but will post info if they do.

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #46779

    Hi Ethan,
    Please share the screenshot showing the location. I have re-checked and It is working fine when you click on a user’s name in the list and their data view is shown.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46792

    https://postimg.cc/mtxpF6Rj –> Showing Date instead of age
    https://postimg.cc/w1nQS1vV –> Showing code in bp-custom file.

    changed the field id I noticed its spelled filed instead of field but upon changing that not difference either.

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46793

    So now I see the code you provided an update on the user insights profile field but not on the search/table view if you understand me. The first screenshot above is where we want it to show. this is were the code is currenlty changing: https://postimg.cc/hQVk7kYF

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #46794

    Hi Ethan,
    Thank you for the reply.

    I did not fix this screen. I fixed the screen where you see an overview of user details after you click on user name in this list.

    I will need to re-check if this field is modifiable from external code.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 24211
    Brajesh Singh on #46795

    I see, we were replying at the same time. You found it correctly. I had fixed that screen. I will re-check and get back to you if this field is changeable on the filter screen or not.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 51
    Ethan Figliola on #46796

    awesome thank you!

You must be logged in to reply to this topic.

This topic is: resolved