• Resolved javierllinas

    (@javierllinas)


    Hello!

    I created an optional email xProfile field for pass recovery purposes. Worked nice with the single line text field, but not with plugin’s html5 email.
    As you can see here I’m getting the field ID and checking if its empty or valid email:

    $field_id = 'My Custom Email Field';
    $user_email = xprofile_get_field_data( $field_id, $user_data->id );
    
    //Check if empty or valid email
    if ( !is_email( $user_email ) ) {
    	$user_email = $user_data->user_email;
    }
    
    [...]

    My guess is that is_email isn’t working with plugin’s html5 email field… or may I be missing something getting that field ID

    https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Miguel López

    (@atallos)

    xprofile_get_field_data is returning the value of the field to be displayed. So if you have autolink feature enabled, it will return a link with the buddypress search link. If you have autolink feature disabled it will return a link with a mailto.

    If you want the email in plain text you can strip tags or use this method instead:

    $user_email = BP_XProfile_ProfileData::get_value_byid($field_id, $user_data->id);

    Thread Starter javierllinas

    (@javierllinas)

    Thanks for the clarification, @donmik. As we need the email in plain text, html5 email brings no advantage in this case.

    Best,
    Javier

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can't get Email Field ID’ is closed to new replies.