本文整理汇总了PHP中wppb_required_field_error函数的典型用法代码示例。如果您正苦于以下问题:PHP wppb_required_field_error函数的具体用法?PHP wppb_required_field_error怎么用?PHP wppb_required_field_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wppb_required_field_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wppb_check_username_value
function wppb_check_username_value($message, $field, $request_data, $form_location)
{
global $wpdb;
if ($field['required'] == 'Yes') {
if (isset($request_data['username']) && trim($request_data['username']) == '' || $form_location == 'register' && !isset($request_data['username'])) {
return wppb_required_field_error($field["field-title"]);
}
}
if (!empty($request_data['username'])) {
if ($form_location == 'register') {
$search_by_user_login = get_users('search=' . $request_data['username']);
}
if (!empty($search_by_user_login)) {
return __('This username already exists.', 'profile-builder') . '<br/>' . __('Please try a different one!', 'profile-builder');
}
if (!validate_username($request_data['username'])) {
return __('This username is invalid because it uses illegal characters.', 'profile-builder') . '<br/>' . __('Please enter a valid username.', 'profile-builder');
}
$wppb_generalSettings = get_option('wppb_general_settings');
if ($wppb_generalSettings['emailConfirmation'] == 'yes') {
if (is_multisite() && $request_data['username'] != preg_replace('/\\s+/', '', $request_data['username'])) {
return __('This username is invalid because it uses illegal characters.', 'profile-builder') . '<br/>' . __('Please enter a valid username.', 'profile-builder');
}
$userSignup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_login = %s", $request_data['username']));
if (!empty($userSignup)) {
return __('This username is already reserved to be used soon.', 'profile-builder') . '<br/>' . __('Please try a different one!', 'profile-builder');
}
}
}
return $message;
}
示例2: wppb_check_email_value
function wppb_check_email_value($message, $field, $request_data, $form_location)
{
global $wpdb;
if (isset($request_data['email']) && trim($request_data['email']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
if (isset($request_data['email']) && !is_email(trim($request_data['email']))) {
return __('The email you entered is not a valid email address.', 'profilebuilder');
}
if (is_multisite() || !is_multisite() && (isset($wppb_generalSettings['emailConfirmation']) && $wppb_generalSettings['emailConfirmation'] == 'yes')) {
$user_signup = $wpdb->get_results($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "signups WHERE user_email = %s", $request_data['email']));
if (!empty($user_signup)) {
return __('This email is already reserved to be used soon.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
$users = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$wpdb->users} WHERE user_email = %s", $request_data['email']));
if (!empty($users)) {
if ($form_location == 'register') {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
if ($form_location == 'edit_profile') {
$current_user = wp_get_current_user();
foreach ($users as $user) {
if ($user->ID != $current_user->ID) {
return __('This email is already in use.', 'profilebuilder') . '<br/>' . __('Please try a different one!', 'profilebuilder');
}
}
}
}
return $message;
}
示例3: wppb_check_description_value
function wppb_check_description_value($message, $field, $request_data, $form_location)
{
if (isset($request_data['description']) && trim($request_data['description']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
return $message;
}
示例4: wppb_check_radio_value
function wppb_check_radio_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Radio') {
if (!isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
}
return $message;
}
示例5: wppb_check_yim_value
function wppb_check_yim_value($message, $field, $request_data, $form_location)
{
if ($field['required'] == 'Yes') {
if (isset($request_data['yim']) && trim($request_data['yim']) == '' || !isset($request_data['yim'])) {
return wppb_required_field_error($field["field-title"]);
}
}
return $message;
}
示例6: wppb_check_toa_value
function wppb_check_toa_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Checkbox (Terms and Conditions)') {
if ($form_location == 'register') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && trim($request_data[wppb_handle_meta_name($field['meta-name'])]) == '' && $field['required'] == 'Yes' || !isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
}
}
return $message;
}
示例7: wppb_check_input_value
function wppb_check_input_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Input') {
if ($field['required'] == 'Yes') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && trim($request_data[wppb_handle_meta_name($field['meta-name'])]) == '' || !isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
return wppb_required_field_error($field["field-title"]);
}
}
}
return $message;
}
示例8: wppb_ecf_check_email_value
function wppb_ecf_check_email_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Email Confirmation') {
if (isset($request_data['wppb_email_confirmation']) && trim($request_data['wppb_email_confirmation']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
if (isset($request_data['wppb_email_confirmation']) && $field['required'] == 'Yes' && $request_data['email'] != $request_data['wppb_email_confirmation']) {
return __('The email confirmation does not match your email address.', 'profilebuilder');
}
}
return $message;
}
示例9: wppb_check_repeat_password_value
function wppb_check_repeat_password_value($message, $field, $request_data, $form_location)
{
if ($form_location == 'register') {
if (isset($request_data['passw2']) && trim($request_data['passw2']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
} elseif (!isset($request_data['passw2']) && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
} elseif (isset($request_data['passw1']) && isset($request_data['passw2']) && trim($request_data['passw1']) != trim($request_data['passw2']) && $field['required'] == 'Yes') {
return __("The passwords do not match", "profilebuilder");
}
} elseif ($form_location == 'edit_profile') {
if (isset($request_data['passw1']) && isset($request_data['passw2']) && trim($request_data['passw1']) != trim($request_data['passw2'])) {
return __("The passwords do not match", "profilebuilder");
}
}
return $message;
}
示例10: wppb_check_phone_value
function wppb_check_phone_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Phone') {
if ($field['required'] == 'Yes') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && trim($request_data[wppb_handle_meta_name($field['meta-name'])]) == '' || !isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
return wppb_required_field_error($field["field-title"]);
}
}
if (!empty($field['phone-format'])) {
$is_phone_error = wppb_check_phone_number_format($field, $request_data);
if (!empty($is_phone_error)) {
return wppb_phone_field_error($field["field-title"]);
}
}
}
return $message;
}
示例11: wppb_check_password_value
function wppb_check_password_value($message, $field, $request_data, $form_location)
{
if ($form_location == 'register') {
if (isset($request_data['passw1']) && trim($request_data['passw1']) == '' && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
} elseif (!isset($request_data['passw1']) && $field['required'] == 'Yes') {
return wppb_required_field_error($field["field-title"]);
}
}
if (trim($request_data['passw1']) != '') {
$wppb_generalSettings = get_option('wppb_general_settings');
if (wppb_check_password_length($request_data['passw1'])) {
return '<br/>' . sprintf(__("The password must have the minimum length of %s characters", "profile-builder"), $wppb_generalSettings['minimum_password_length']);
}
if (wppb_check_password_strength()) {
return '<br/>' . sprintf(__("The password must have a minimum strength of %s", "profile-builder"), wppb_check_password_strength());
}
}
return $message;
}
示例12: wppb_check_user_role_value
function wppb_check_user_role_value($message, $field, $request_data, $form_location)
{
if ($form_location == 'back_end') {
return;
}
$field['meta-name'] = 'custom_field_user_role';
if ($field['field'] == 'Select (User Role)') {
if ($field['required'] == 'Yes') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && trim($request_data[wppb_handle_meta_name($field['meta-name'])]) == '' || !isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
return wppb_required_field_error($field["field-title"]);
}
}
if (isset($field['user-roles']) && isset($request_data['custom_field_user_role'])) {
$available_user_roles = explode(', ', $field['user-roles']);
if (!in_array($request_data['custom_field_user_role'], $available_user_roles)) {
return __('You cannot register this user role', 'profile-builder');
}
}
}
return $message;
}
示例13: wppb_check_validation_value
function wppb_check_validation_value($message, $field, $request_data, $form_location)
{
if ($form_location != 'register') {
return $message;
}
if ($field['field'] == 'Validation') {
// Field must not be empty
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && trim($request_data[wppb_handle_meta_name($field['meta-name'])]) == '' || !isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
return wppb_required_field_error($field["field-title"]);
}
// Check if the provided value matches the allowable values
if (!empty($field['validation-possible-values'])) {
$allowed_values = explode(',', $field['validation-possible-values']);
if (!in_array($request_data[wppb_handle_meta_name($field['meta-name'])], $allowed_values)) {
if (!empty($field['custom-error-message'])) {
return $field['custom-error-message'];
} else {
return wppb_required_field_error($field["field-title"]);
}
}
}
}
return $message;
}
示例14: wppb_check_multiple_select_value
function wppb_check_multiple_select_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Select (Multiple)') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
$selected_values = '';
foreach ($request_data[wppb_handle_meta_name($field['meta-name'])] as $key => $value) {
$selected_values .= $value . ',';
}
if ($field['required'] == 'Yes' && trim($selected_values, ',') == '') {
return wppb_required_field_error($field["field-title"]);
}
}
}
return $message;
}
示例15: wppb_check_map_value
function wppb_check_map_value($message, $field, $request_data, $form_location)
{
if ($field['field'] == 'Map') {
// Validate the coordinates
$error = false;
if (!empty($request_data[wppb_handle_meta_name($field['meta-name'])])) {
foreach ($request_data[wppb_handle_meta_name($field['meta-name'])] as $position) {
$position = explode(',', $position);
// We should only have a latitude and longitude
if (count($position) != 2) {
$error = true;
}
if (strpos($position[0], '.') === false || strpos($position[1], '.') === false) {
$error = true;
}
}
}
if ($error) {
return __('Something went wrong. Please try again.', 'profile-builder');
}
// Check to see if required
if ($field['required'] == 'Yes') {
if (isset($request_data[wppb_handle_meta_name($field['meta-name'])]) && empty($request_data[wppb_handle_meta_name($field['meta-name'])]) || !isset($request_data[wppb_handle_meta_name($field['meta-name'])])) {
return wppb_required_field_error($field["field-title"]);
}
}
}
return $message;
}