Skip to:
Content
Pages
Categories
Search
Top
Bottom

Help with xprofile field


  • Drifty
    Participant

    @drifty

    WordPress 4.8 running
    BuddyPress 2.8.2

    Buddy child Theme

    Hi

    I’v been trying to get xprofile field data to echo but so no joy any help would be grateful thanks

    in function.php I have

    function bp_get_custom_profile_data($atts){
      extract(shortcode_atts(array('field' => false, 'user_id' => false), $atts));
      if(!$user_id){
        global $user_ID;
        $user_id = $user_ID;
      }
      return xprofile_get_field_data($field, $user_id);
    }
    

    then in page I have `<?php echo xprofile_get_field_data(‘autojoin’); ?>

    But I been unable to get it echo any help would be grateful thanks
    David

Viewing 2 replies - 1 through 2 (of 2 total)

  • Drifty
    Participant

    @drifty

    Anyhelp Please?


    Drifty
    Participant

    @drifty

    ok worked it out in the end

    need to put in the

    global $current_user; get_currentuserinfo();
    $current_user = wp_get_current_user();
    $current_user_id = $current_user->ID;

    and then use

    <?php bp_profile_field_data( array('user_id'=>$current_user_id,'field'=>'autojoin' )); ?>

    hope that helps anyone who may have a problem as I did

    Thanks
    David

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar