'; $item_description = wppb_icl_t( 'plugin profile-builder-pro', 'default_field_'.$field['id'].'_description_translation', $field['description'] ); $heading = '
  • '.wppb_icl_t('plugin profile-builder-pro', 'custom_field_'.$field['id'].'_title_translation', $field['field-title']).'

    '.$item_description.'
  • '; $output .= apply_filters( 'wppb_blog_details_heading', $heading ); ?> .wppb-blog-details-fields {display:none;} '; } $create_new_site_checkbox = '
  • '; $output .= apply_filters( 'wppb_blog_details_checkbox', $create_new_site_checkbox ); $output .= ''; $output .= ''; return apply_filters( 'wppb_blog_details_output', $output, $form_location, $field, $user_id, $field_check_errors, $request_data ); } add_filter( 'wppb_output_form_field_default-blog-details', 'wppb_blog_details_handler', 10, 6 ); /* handle field save */ function wppb_create_blog_on_registration( $field, $user_id, $request_data, $form_location ){ if( $form_location == 'register' && $field['field'] == 'Default - Blog Details' && isset( $request_data['wppb_create_new_site_checkbox'] ) && $request_data['wppb_create_new_site_checkbox'] == 'yes' ) { $blog_url = $request_data['wppb_blog_url']; $blog_title = $request_data['wppb_blog_title']; $usermeta['public'] = ( isset( $request_data['wppb_blog_privacy'] ) && 'Yes' == $request_data['wppb_blog_privacy'] ) ? true : false; $blog_details = wpmu_validate_blog_signup( $blog_url, $blog_title ); if ( empty($blog_details['errors']->errors['blogname']) && empty($blog_details['errors']->errors['blog_title'])) { wpmu_create_blog( $blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $user_id, $usermeta ); } } } add_action( 'wppb_save_form_field', 'wppb_create_blog_on_registration', 10, 4 ); /* handle field validation */ function wppb_check_blog_details_values( $message, $field, $request_data, $form_location ){ if ( isset( $request_data['wppb_create_new_site_checkbox'] ) && $request_data['wppb_create_new_site_checkbox'] == 'yes' ){ $blog_fields_array = wppb_blog_details_fields_array(); foreach ( $blog_fields_array as $blog_field ){ if( ( isset( $request_data[$blog_field] ) && ( trim( $request_data[$blog_field] ) == '' ) ) || !isset( $request_data[$blog_field] ) ){ return wppb_required_field_error($blog_field); } } } return $message; } add_filter( 'wppb_check_form_field_default-blog-details', 'wppb_check_blog_details_values', 10, 4 ); /* Add blog details information to wp_signups table (when Email Confirmation is active) */ function wppb_add_blog_details_to_signup_table( $meta, $global_request, $role ){ if ( isset( $global_request['wppb_create_new_site_checkbox'] ) && $global_request['wppb_create_new_site_checkbox'] == 'yes' ) { $blog_details_fields_array = wppb_blog_details_fields_array(); foreach ($blog_details_fields_array as $blog_field) { $meta[$blog_field] = $global_request[$blog_field]; } } return $meta; } add_filter( 'wppb_add_to_user_signup_form_meta', 'wppb_add_blog_details_to_signup_table',10, 3 ); function wppb_blog_details_fields_array(){ return array( 'wppb_blog_title', 'wppb_blog_url', 'wppb_blog_privacy', 'wppb_create_new_site_checkbox' ); } function wppb_check_individual_blog_fields( $field_key, $request_data, $form_location ){ if ( isset( $request_data['wppb_create_new_site_checkbox'] ) && $request_data['wppb_create_new_site_checkbox'] == 'yes' ) { if ( $field_key == 'wppb_blog_privacy' && ( ! isset( $request_data[$field_key] ) || ( isset( $request_data[$field_key] ) && ( trim( $request_data[$field_key] ) == '' ) ) ) ) { return '' . wppb_required_field_error($field_key) . ''; } $wp_error = wpmu_validate_blog_signup($request_data['wppb_blog_url'], $request_data['wppb_blog_title']); if ( $field_key == 'wppb_blog_url' && !empty($wp_error['errors']->errors['blogname'])){ return '' . $wp_error['errors']->errors['blogname'][0] . ''; } if ( $field_key == 'wppb_blog_title' && !empty($wp_error['errors']->errors['blog_title'])){ return '' . $wp_error['errors']->errors['blog_title'][0] . ''; } } return ''; }