Skip to:
Content
Pages
Categories
Search
Top
Bottom

Passing xprofile user data to prefill forms

  • @taz101108

    Participant

    How do you pass xprofile user data to prefill forms? I am using EventOn and tried xprofile_get_field_data(‘Undergraduate College/University’), but it wasn’t working. The function is below. Do I need to somehow let this function know it’s a buddypress call?

    // Prefill form fields
    function prefill($current_user, $field){
        if($current_user){
            switch ($field) {
                case 'email':       echo $current_user->user_email; break;	
                case 'first_name':	echo $current_user->user_firstname; break;	
                case 'last_name':	echo $current_user->user_lastname; break;	
                case 'evors_addf1_1':   echo xprofile_get_field_data( 'Undergraduate College/University' ); break;
            }				
        }else{ return null;}
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • @shanebp

    Moderator

    Please use the code button.

    You need to include the user id:
    echo xprofile_get_field_data( 'Undergraduate College/University', $current_user->ID );

    @taz101108

    Participant

    That worked, thank you shanebp!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Passing xprofile user data to prefill forms’ is closed to new replies.
Skip to toolbar