javierllinas on "[Plugin: Buddypress Xprofile Custom Fields Type] Can't get Email Field ID"

ساخت وبلاگ

javierllinas
Member
Posted 4 days ago #

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/

xprofile_get_field_data is retuing the value of the field to be displayed. So if you have autolink feature enabled, it will retu a link with the buddypress search link. If you have autolink feature disabled it will retu 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);

javierllinas
Member
Posted 7 minutes ago #

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

Best,
Javier

WordPress ...
ما را در سایت WordPress دنبال می کنید

برچسب : نویسنده : استخدام کار wpss بازدید : 237 تاريخ : شنبه 22 خرداد 1395 ساعت: 17:56