__( 'General Settings', 'profile-builder' ), 'profile-builder-content_restriction' => __( 'Content Restriction', 'profile-builder' ), 'profile-builder-private-website' => __( 'Private Website', 'profile-builder' ), 'profile-builder-toolbox-settings' => __( 'Advanced Settings', 'profile-builder' ), ); //add tabs here for Advanced Settings $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['forms'] = __( 'Forms', 'profile-builder' ); $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['fields'] = __( 'Fields', 'profile-builder' ); if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) && isset( $wppb_module_settings['wppb_userListing'] ) && $wppb_module_settings['wppb_userListing'] === 'show' ) $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['userlisting'] = __( 'Userlisting', 'profile-builder' ); $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['shortcodes'] = __( 'Shortcodes', 'profile-builder' ); $settings_pages['sub-tabs']['profile-builder-toolbox-settings']['admin'] = __( 'Admin', 'profile-builder' ); //add sub-pages here for email customizer if( file_exists( WPPB_PLUGIN_DIR . '/features/email-customizer/email-customizer.php' ) ){ $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' ); $settings_pages['sub-pages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' ); $settings_pages['sub-pages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' ); } else if ( defined( 'WPPB_PAID_PLUGIN_DIR' ) && file_exists( WPPB_PAID_PLUGIN_DIR . '/add-ons/add-ons.php' ) ) { if( ( isset($wppb_module_settings['wppb_emailCustomizerAdmin']) && $wppb_module_settings['wppb_emailCustomizerAdmin'] == 'show' ) || ( isset($wppb_module_settings['wppb_emailCustomizer']) && $wppb_module_settings['wppb_emailCustomizer'] == 'show') ){ $settings_pages['pages']['user-email-customizer'] = __( 'Email Customizer', 'profile-builder' ); $settings_pages['sub-pages']['user-email-customizer']['user-email-customizer'] = __( 'User Emails', 'profile-builder' ); $settings_pages['sub-pages']['user-email-customizer']['admin-email-customizer'] = __( 'Administrator Emails', 'profile-builder' ); } } return $settings_pages; } /** * Function that generates the html for the tabs and subtabs on the settings page */ function wppb_generate_settings_tabs(){ ?> $subpages) { if (array_key_exists( sanitize_text_field( $active_subpage ), $subpages)) { echo ''; } } } if( !empty( $pages['sub-tabs'] ) ) { foreach ($pages['sub-tabs'] as $parent_slug => $tabs) { if ( $active_subpage == $parent_slug) { echo ''; } } } } /** * Function that creates the "General Settings" submenu page * * @since v.2.0 * * @return void */ function wppb_register_general_settings_submenu_page() { add_submenu_page( 'profile-builder', __( 'Settings', 'profile-builder' ), __( 'Settings', 'profile-builder' ), 'manage_options', 'profile-builder-general-settings', 'wppb_general_settings_content' ); } add_action( 'admin_menu', 'wppb_register_general_settings_submenu_page', 3 ); function wppb_generate_default_settings_defaults(){ add_option( 'wppb_general_settings', array( 'extraFieldsLayout' => 'default', 'automaticallyLogIn' => 'No', 'emailConfirmation' => 'no', 'activationLandingPage' => '', 'adminApproval' => 'no', 'loginWith' => 'usernameemail', 'rolesEditor' => 'no', 'conditional_fields_ajax' => 'no', 'formsDesign' => 'form-style-default', 'hide_admin_bar_for' => '' ) ); } /** * Function that adds content to the "General Settings" submenu page * * @since v.2.0 * * @return string */ function wppb_general_settings_content() { wppb_generate_default_settings_defaults(); ?>

>
>

All Users > Email Confirmation%2$s.', 'profile-builder' ), '', '' )?>


', '' )?>

>

All Users > Admin Approval%2$s.', 'profile-builder' ), '', '' )?>

>
>
>

value="default">

$settings_value ){ if( $settings_name == "minimum_password_length" || $settings_name == "activationLandingPage" ) $wppb_generalSettings[$settings_name] = absint( $settings_value ); elseif( $settings_name == "extraFieldsLayout" || $settings_name == "emailConfirmation" || $settings_name == "adminApproval" || $settings_name == "loginWith" || $settings_name == "minimum_password_strength" ) $wppb_generalSettings[$settings_name] = sanitize_text_field( $settings_value ); elseif( $settings_name == "adminApprovalOnUserRole" ){ if( is_array( $settings_value ) && !empty( $settings_value ) ){ foreach( $settings_value as $key => $value ){ $wppb_generalSettings[$settings_name][$key] = sanitize_text_field( $value ); } } } } } return $wppb_generalSettings; } /* * Function that pushes settings errors to the user * * @since v.2.0.7 */ function wppb_general_settings_admin_notices() { settings_errors( 'wppb_general_settings' ); } add_action( 'admin_notices', 'wppb_general_settings_admin_notices' ); /* * Function that return user roles * * @since v.2.2.0 * * @return array */ function wppb_adminApproval_onUserRole() { global $wp_roles; $wp_roles = new WP_Roles(); $roles = $wp_roles->get_names(); unset( $roles['administrator'] ); return $roles; } /* * Generate the Form Designs Preview Showcase * */ function wppb_display_form_designs_preview() { $form_designs_data = array( array( 'id' => 'form-style-default', 'name' => 'Default', 'images' => array( 'main' => WPPB_PLUGIN_URL.'assets/images/pb-default-forms.jpg', ), ), array( 'id' => 'form-style-1', 'name' => 'Sublime', 'images' => array( 'main' => WPPB_PLUGIN_URL.'assets/images/style1-slide1.jpg', 'slide1' => WPPB_PLUGIN_URL.'assets/images/style1-slide2.jpg', 'slide2' => WPPB_PLUGIN_URL.'assets/images/style1-slide3.jpg', ), ), array( 'id' => 'form-style-2', 'name' => 'Greenery', 'images' => array( 'main' => WPPB_PLUGIN_URL.'assets/images/style2-slide1.jpg', 'slide1' => WPPB_PLUGIN_URL.'assets/images/style2-slide2.jpg', 'slide2' => WPPB_PLUGIN_URL.'assets/images/style2-slide3.jpg', ), ), array( 'id' => 'form-style-3', 'name' => 'Slim', 'images' => array( 'main' => WPPB_PLUGIN_URL.'assets/images/style3-slide1.jpg', 'slide1' => WPPB_PLUGIN_URL.'assets/images/style3-slide2.jpg', 'slide2' => WPPB_PLUGIN_URL.'assets/images/style3-slide3.jpg', ), ) ); $output = '
'; foreach ( $form_designs_data as $form_design ) { if ( $form_design['id'] != 'form-style-default' ) { $preview_button = '
Preview
'; $title = esc_html__( 'Available in the Pro versions of the plugin', 'profile-builder' ); } else { $preview_button = ''; $title = ''; } $output .= '
Form Design '. $preview_button .'
'; $img_count = 0; $image_list = ''; foreach ( $form_design['images'] as $image ) { $img_count++; $active_img = ( $img_count == 1 ) ? ' active' : ''; $image_list .= ''; } if ( $img_count > 1 ) { $previous_button = '
<
'; $next_button = '
>
'; $justify_content = 'space-between'; } else { $previous_button = $next_button = ''; $justify_content = 'center'; } $output .= ''; } $output .= '
'; $output .= '

'. sprintf( esc_html__( 'You can now beautify your forms using pre-made templates. Enable %3$sForm Designs%4$s by upgrading to %1$sBasic or PRO versions%2$s.', 'profile-builder' ), '', '', '', '' ) .'

'; return $output; } /* * Generate the Register Version Form * */ function wppb_add_register_version_form() { $status = wppb_get_serial_number_status(); $license = wppb_get_serial_number(); $license_details = get_option( 'wppb_license_details', false ); if( !empty( $license ) ){ // process license so it doesn't get displayed in back-end $license_length = strlen( $license ); $license = substr_replace( $license, '***************', 7, $license_length - 14 ); } ?>

'; else echo ''; } else { $button_name = 'wppb_edd_license_activate'; $button_value = __('Activate License', 'profile-builder'); } ?>
expires ) && $license_details->expires !== 'lifetime' ) && ( ( !isset( $license_details->subscription_status ) || $license_details->subscription_status != 'active' ) && strtotime( $license_details->expires ) < strtotime( '+14 days' ) ) ) : ?>

' . PROFILE_BUILDER . '', '' . date_i18n( get_option( 'date_format' ), strtotime( $license_details->expires ) ) . '' ) ); ?>

", "" ) ); ?>

' . PROFILE_BUILDER . '' ) ); ?>

', '' ) ); ?>

' . PROFILE_BUILDER . '' ) ); ?>

', '' ) ); ?>

', '' ) ); ?>

', '' ) ); ?>