/** * Function that creates the Manage Fields submenu and populates it with a repeater field form * * @since v.2.0 * * @return void */ function wppb_manage_fields_submenu() { // create a new sub_menu page which holds the data for the default + extra fields $args = array('menu_title' => __('Manage Fields', 'profilebuilder'), 'page_title' => __('Manage Default and Extra Fields', 'profilebuilder'), 'menu_slug' => 'manage-fields', 'page_type' => 'submenu_page', 'capability' => 'manage_options', 'priority' => 5, 'parent_slug' => 'profile-builder'); $all_fields = new WCK_Page_Creator_PB($args); // populate this page $manage_field_types[] = 'Default - Name (Heading)'; $manage_field_types[] = 'Default - Contact Info (Heading)'; $manage_field_types[] = 'Default - About Yourself (Heading)'; $manage_field_types[] = 'Default - Username'; $manage_field_types[] = 'Default - First Name'; $manage_field_types[] = 'Default - Last Name'; $manage_field_types[] = 'Default - Nickname'; $manage_field_types[] = 'Default - E-mail'; $manage_field_types[] = 'Default - Website'; // Default contact methods were removed in WP 3.6. A filter dictates contact methods. if (apply_filters('wppb_remove_default_contact_methods', get_site_option('initial_db_version') < 23588)) { $manage_field_types[] = 'Default - AIM'; $manage_field_types[] = 'Default - Yahoo IM'; $manage_field_types[] = 'Default - Jabber / Google Talk'; } $manage_field_types[] = 'Default - Password'; $manage_field_types[] = 'Default - Repeat Password'; $manage_field_types[] = 'Default - Biographical Info'; $manage_field_types[] = 'Default - Display name publicly as'; if (PROFILE_BUILDER != 'Profile Builder Free') { $manage_field_types[] = 'Heading'; $manage_field_types[] = 'Input'; $manage_field_types[] = 'Input (Hidden)'; $manage_field_types[] = 'Textarea'; $manage_field_types[] = 'Select'; $manage_field_types[] = 'Select (Multiple)'; $manage_field_types[] = 'Select (Country)'; $manage_field_types[] = 'Select (Timezone)'; $manage_field_types[] = 'Checkbox'; $manage_field_types[] = 'Checkbox (Terms and Conditions)'; $manage_field_types[] = 'Radio'; $manage_field_types[] = 'Upload'; $manage_field_types[] = 'Avatar'; $manage_field_types[] = 'Datepicker'; $manage_field_types[] = 'reCAPTCHA'; } //Free to Pro call to action on Manage Fields page $field_description = 'Choose one of the supported field types'; if (PROFILE_BUILDER == 'Profile Builder Free') { $field_description .= '. Extra Field Types are available in %1$sHobbyist or PRO versions%2$s.'; } // set up the fields array $fields = apply_filters('wppb_manage_fields', array(array('type' => 'text', 'slug' => 'field-title', 'title' => __('Field Title', 'profilebuilder'), 'description' => __('Title of the field', 'profilebuilder')), array('type' => 'select', 'slug' => 'field', 'title' => __('Field', 'profilebuilder'), 'options' => apply_filters('wppb_manage_fields_types', $manage_field_types), 'default-option' => true, 'description' => sprintf(__($field_description, 'profilebuilder'), '<a href="http://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree">', '</a>')), array('type' => 'text', 'slug' => 'meta-name', 'title' => __('Meta-name', 'profilebuilder'), 'default' => wppb_get_meta_name(), 'description' => __('Use this in conjuction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be uniqe)<br/>Changing this might take long in case of a very big user-count', 'profilebuilder')), array('type' => 'text', 'slug' => 'id', 'title' => __('ID', 'profilebuilder'), 'default' => wppb_get_unique_id(), 'description' => __("A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profilebuilder'), 'readonly' => true), array('type' => 'textarea', 'slug' => 'description', 'title' => __('Description', 'profilebuilder'), 'description' => __('Enter a (detailed) description of the option for end users to read<br/>Optional', 'profilebuilder')), array('type' => 'text', 'slug' => 'row-count', 'title' => __('Row Count', 'profilebuilder'), 'default' => 5, 'description' => __("Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profilebuilder')), array('type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __('Allowed Image Extensions', 'profilebuilder'), 'default' => '.*', 'description' => __('Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all existing image extensions (.*)', 'profilebuilder')), array('type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __('Allowed Upload Extensions', 'profilebuilder'), 'default' => '.*', 'description' => __('Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all existing extensions (.*)', 'profilebuilder')), array('type' => 'text', 'slug' => 'avatar-size', 'title' => __('Avatar Size', 'profilebuilder'), 'default' => 100, 'description' => __("Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profilebuilder')), array('type' => 'text', 'slug' => 'date-format', 'title' => __('Date-format', 'profilebuilder'), 'default' => 'mm/dd/yy', 'description' => __('Specify the format of the date when using Datepicker<br/>Valid options: mm/dd/yy, mm/yy/dd, dd/yy/mm, dd/mm/yy, yy/dd/mm, yy/mm/dd<br/>If not specified, defaults to mm/dd/yy', 'profilebuilder')), array('type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __('Terms of Agreement', 'profilebuilder'), 'description' => __('Enter a detailed description of the temrs of agreement for the user to read.<br/>Links can be inserted by using standard HTML syntax: <a href="custom_url">custom_text</a>', 'profilebuilder')), array('type' => 'text', 'slug' => 'options', 'title' => __('Options', 'profilebuilder'), 'description' => __("Enter a comma separated list of values<br/>This can be anything, as it is hidden from the user, but should not contain special characters or apostrophes", 'profilebuilder')), array('type' => 'text', 'slug' => 'labels', 'title' => __('Labels', 'profilebuilder'), 'description' => __("Enter a comma separated list of labels<br/>Visible for the user", 'profilebuilder')), array('type' => 'text', 'slug' => 'public-key', 'title' => __('Public Key', 'profilebuilder'), 'description' => __('The public key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profilebuilder')), array('type' => 'text', 'slug' => 'private-key', 'title' => __('Private Key', 'profilebuilder'), 'description' => __('The private key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profilebuilder')), array('type' => 'text', 'slug' => 'default-value', 'title' => __('Default Value', 'profilebuilder'), 'description' => __("Default value of the field", 'profilebuilder')), array('type' => 'text', 'slug' => 'default-option', 'title' => __('Default Option', 'profilebuilder'), 'description' => __("Specify the option which should be selected by default", 'profilebuilder')), array('type' => 'text', 'slug' => 'default-options', 'title' => __('Default Option(s)', 'profilebuilder'), 'description' => __("Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profilebuilder')), array('type' => 'textarea', 'slug' => 'default-content', 'title' => __('Default Content', 'profilebuilder'), 'description' => __("Default value of the textarea", 'profilebuilder')), array('type' => 'select', 'slug' => 'required', 'title' => __('Required', 'profilebuilder'), 'options' => array('No', 'Yes'), 'default' => 'No', 'description' => __('Whether the field is required or not', 'profilebuilder')), array('type' => 'select', 'slug' => 'overwrite-existing', 'title' => __('Overwrite Existing', 'profilebuilder'), 'options' => array('No', 'Yes'), 'default' => 'No', 'description' => __("Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profilebuilder')))); // create the new submenu with the above options $args = array('metabox_id' => 'manage-fields', 'metabox_title' => __('Field Properties', 'profilebuilder'), 'post_type' => 'manage-fields', 'meta_name' => 'wppb_manage_fields', 'meta_array' => $fields, 'context' => 'option'); new Wordpress_Creation_Kit_PB($args); wppb_prepopulate_fields(); // create the info side meta-box $args = array('metabox_id' => 'manage-fields-info', 'metabox_title' => __('Registration & Edit Profile', 'profilebuilder'), 'post_type' => 'manage-fields', 'meta_name' => 'wppb_manage_fields_info', 'meta_array' => '', 'context' => 'option', 'mb_context' => 'side'); new Wordpress_Creation_Kit_PB($args); }
/** * Function that creates the Manage Fields submenu and populates it with a repeater field form * * @since v.2.0 * * @return void */ function wppb_manage_fields_submenu() { // create a new sub_menu page which holds the data for the default + extra fields $args = array('menu_title' => __('Manage Fields', 'profile-builder'), 'page_title' => __('Manage Default and Extra Fields', 'profile-builder'), 'menu_slug' => 'manage-fields', 'page_type' => 'submenu_page', 'capability' => 'manage_options', 'priority' => 5, 'parent_slug' => 'profile-builder'); $all_fields = new WCK_Page_Creator_PB($args); // populate this page $manage_field_types[] = 'Default - Name (Heading)'; $manage_field_types[] = 'Default - Contact Info (Heading)'; $manage_field_types[] = 'Default - About Yourself (Heading)'; $manage_field_types[] = 'Default - Username'; $manage_field_types[] = 'Default - First Name'; $manage_field_types[] = 'Default - Last Name'; $manage_field_types[] = 'Default - Nickname'; $manage_field_types[] = 'Default - E-mail'; $manage_field_types[] = 'Default - Website'; // Default contact methods were removed in WP 3.6. A filter dictates contact methods. if (apply_filters('wppb_remove_default_contact_methods', get_site_option('initial_db_version') < 23588)) { $manage_field_types[] = 'Default - AIM'; $manage_field_types[] = 'Default - Yahoo IM'; $manage_field_types[] = 'Default - Jabber / Google Talk'; } $manage_field_types[] = 'Default - Password'; $manage_field_types[] = 'Default - Repeat Password'; $manage_field_types[] = 'Default - Biographical Info'; $manage_field_types[] = 'Default - Display name publicly as'; if (PROFILE_BUILDER != 'Profile Builder Free') { $manage_field_types[] = 'Heading'; $manage_field_types[] = 'Input'; $manage_field_types[] = 'Input (Hidden)'; $manage_field_types[] = 'Textarea'; $manage_field_types[] = 'WYSIWYG'; $manage_field_types[] = 'Phone'; $manage_field_types[] = 'Select'; $manage_field_types[] = 'Select (Multiple)'; $manage_field_types[] = 'Select (Country)'; $manage_field_types[] = 'Select (Timezone)'; $manage_field_types[] = 'Select (User Role)'; $manage_field_types[] = 'Select (Currency)'; $manage_field_types[] = 'Checkbox'; $manage_field_types[] = 'Checkbox (Terms and Conditions)'; $manage_field_types[] = 'Radio'; $manage_field_types[] = 'Upload'; $manage_field_types[] = 'Avatar'; $manage_field_types[] = 'Datepicker'; $manage_field_types[] = 'Timepicker'; $manage_field_types[] = 'Colorpicker'; $manage_field_types[] = 'reCAPTCHA'; $manage_field_types[] = 'Validation'; $manage_field_types[] = 'Map'; $manage_field_types[] = 'HTML'; } //Free to Pro call to action on Manage Fields page $field_description = __('Choose one of the supported field types', 'profile-builder'); if (PROFILE_BUILDER == 'Profile Builder Free') { $field_description .= sprintf(__('. Extra Field Types are available in <a href="%s">Hobbyist or PRO versions</a>.', 'profile-builder'), esc_url('https://www.cozmoslabs.com/wordpress-profile-builder/?utm_source=wpbackend&utm_medium=clientsite&utm_content=manage-fields-link&utm_campaign=PBFree')); } //user roles global $wp_roles; $user_roles = array(); foreach ($wp_roles->roles as $user_role_slug => $user_role) { if ($user_role_slug !== 'administrator') { array_push($user_roles, '%' . $user_role['name'] . '%' . $user_role_slug); } } // country select $default_country_array = wppb_country_select_options('back_end'); foreach ($default_country_array as $iso_country_code => $country_name) { $default_country_values[] = $iso_country_code; $default_country_options[] = $country_name; } // currency select $default_currency_array = wppb_get_currencies('back_end'); array_unshift($default_currency_array, ''); foreach ($default_currency_array as $iso_currency_code => $currency_name) { $default_currency_values[] = $iso_currency_code; $default_currency_options[] = $currency_name; } // set up the fields array $fields = apply_filters('wppb_manage_fields', array(array('type' => 'text', 'slug' => 'field-title', 'title' => __('Field Title', 'profile-builder'), 'description' => __('Title of the field', 'profile-builder')), array('type' => 'select', 'slug' => 'field', 'title' => __('Field', 'profile-builder'), 'options' => apply_filters('wppb_manage_fields_types', $manage_field_types), 'default-option' => true, 'description' => $field_description), array('type' => 'text', 'slug' => 'meta-name', 'title' => __('Meta-name', 'profile-builder'), 'default' => wppb_get_meta_name(), 'description' => __('Use this in conjuction with WordPress functions to display the value in the page of your choosing<br/>Auto-completed but in some cases editable (in which case it must be uniqe)<br/>Changing this might take long in case of a very big user-count', 'profile-builder')), array('type' => 'text', 'slug' => 'id', 'title' => __('ID', 'profile-builder'), 'default' => wppb_get_unique_id(), 'description' => __("A unique, auto-generated ID for this particular field<br/>You can use this in conjuction with filters to target this element if needed<br/>Can't be edited", 'profile-builder'), 'readonly' => true), array('type' => 'textarea', 'slug' => 'description', 'title' => __('Description', 'profile-builder'), 'description' => __('Enter a (detailed) description of the option for end users to read<br/>Optional', 'profile-builder')), array('type' => 'text', 'slug' => 'row-count', 'title' => __('Row Count', 'profile-builder'), 'default' => 5, 'description' => __("Specify the number of rows for a 'Textarea' field<br/>If not specified, defaults to 5", 'profile-builder')), array('type' => 'text', 'slug' => 'allowed-image-extensions', 'title' => __('Allowed Image Extensions', 'profile-builder'), 'default' => '.*', 'description' => __('Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to: .jpg,.jpeg,.gif,.png (.*)', 'profile-builder')), array('type' => 'text', 'slug' => 'allowed-upload-extensions', 'title' => __('Allowed Upload Extensions', 'profile-builder'), 'default' => '.*', 'description' => __('Specify the extension(s) you want to limit to upload<br/>Example: .ext1,.ext2,.ext3<br/>If not specified, defaults to all WordPress allowed file extensions (.*)', 'profile-builder')), array('type' => 'text', 'slug' => 'avatar-size', 'title' => __('Avatar Size', 'profile-builder'), 'default' => 100, 'description' => __("Enter a value (between 20 and 200) for the size of the 'Avatar'<br/>If not specified, defaults to 100", 'profile-builder')), array('type' => 'text', 'slug' => 'date-format', 'title' => __('Date-format', 'profile-builder'), 'default' => 'mm/dd/yy', 'description' => __('Specify the format of the date when using Datepicker<br/>Valid options: mm/dd/yy, mm/yy/dd, dd/yy/mm, dd/mm/yy, yy/dd/mm, yy/mm/dd<br/>If not specified, defaults to mm/dd/yy', 'profile-builder')), array('type' => 'textarea', 'slug' => 'terms-of-agreement', 'title' => __('Terms of Agreement', 'profile-builder'), 'description' => __('Enter a detailed description of the temrs of agreement for the user to read.<br/>Links can be inserted by using standard HTML syntax: <a href="custom_url">custom_text</a>', 'profile-builder')), array('type' => 'text', 'slug' => 'options', 'title' => __('Options', 'profile-builder'), 'description' => __("Enter a comma separated list of values<br/>This can be anything, as it is hidden from the user, but should not contain special characters or apostrophes", 'profile-builder')), array('type' => 'text', 'slug' => 'labels', 'title' => __('Labels', 'profile-builder'), 'description' => __("Enter a comma separated list of labels<br/>Visible for the user", 'profile-builder')), array('type' => 'text', 'slug' => 'public-key', 'title' => __('Site Key', 'profile-builder'), 'description' => __('The site key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder')), array('type' => 'text', 'slug' => 'private-key', 'title' => __('Secret Key', 'profile-builder'), 'description' => __('The secret key from Google, <a href="http://www.google.com/recaptcha" target="_blank">www.google.com/recaptcha</a>', 'profile-builder')), array('type' => 'checkbox', 'slug' => 'captcha-pb-forms', 'title' => __('Display on PB forms', 'profile-builder'), 'options' => array('%' . __('PB Login', 'profile-builder') . '%' . 'pb_login', '%' . __('PB Register', 'profile-builder') . '%' . 'pb_register', '%' . __('PB Recover Password', 'profile-builder') . '%' . 'pb_recover_password'), 'default' => 'pb_register', 'description' => __("Select on which Profile Builder forms to display reCAPTCHA", 'profile-builder')), array('type' => 'checkbox', 'slug' => 'captcha-wp-forms', 'title' => __('Display on default WP forms', 'profile-builder'), 'options' => array('%' . __('Default WP Login', 'profile-builder') . '%' . 'default_wp_login', '%' . __('Default WP Register', 'profile-builder') . '%' . 'default_wp_register', '%' . __('Default WP Recover Password', 'profile-builder') . '%' . 'default_wp_recover_password'), 'default' => 'default_wp_register', 'description' => __("Select on which default WP forms to display reCAPTCHA", 'profile-builder')), array('type' => 'checkbox', 'slug' => 'user-roles', 'title' => __('User Roles', 'profile-builder'), 'options' => $user_roles, 'description' => __("Select which user roles to show to the user ( drag and drop to re-order )", 'profile-builder')), array('type' => 'text', 'slug' => 'user-roles-sort-order', 'title' => __('User Roles Order', 'profile-builder'), 'description' => __("Save the user role order from the user roles checkboxes", 'profile-builder')), array('type' => 'text', 'slug' => 'default-value', 'title' => __('Default Value', 'profile-builder'), 'description' => __("Default value of the field", 'profile-builder')), array('type' => 'text', 'slug' => 'default-option', 'title' => __('Default Option', 'profile-builder'), 'description' => __("Specify the option which should be selected by default", 'profile-builder')), array('type' => 'text', 'slug' => 'default-options', 'title' => __('Default Option(s)', 'profile-builder'), 'description' => __("Specify the option which should be checked by default<br/>If there are multiple values, separate them with a ',' (comma)", 'profile-builder')), array('type' => 'select', 'slug' => 'default-option-country', 'title' => __('Default Option', 'profile-builder'), 'values' => isset($default_country_values) ? $default_country_values : '', 'options' => isset($default_country_options) ? $default_country_options : '', 'description' => __("Default option of the field", 'profile-builder')), array('type' => 'select', 'slug' => 'default-option-timezone', 'title' => __('Default Option', 'profile-builder'), 'options' => wppb_timezone_select_options('back_end'), 'description' => __("Default option of the field", 'profile-builder')), array('type' => 'select', 'slug' => 'default-option-currency', 'title' => __('Default Option', 'profile-builder'), 'values' => isset($default_currency_values) ? $default_currency_values : '', 'options' => isset($default_currency_options) ? $default_currency_options : '', 'description' => __("Default option of the field", 'profile-builder')), array('type' => 'select', 'slug' => 'show-currency-symbol', 'title' => __('Show Currency Symbol', 'profile-builder'), 'options' => array('No', 'Yes'), 'default' => 'No', 'description' => __('Whether the currency symbol should be displayed after the currency name in the select option.', 'profile-builder')), array('type' => 'text', 'slug' => 'validation-possible-values', 'title' => __('Allowable Values', 'profile-builder'), 'description' => __("Enter a comma separated list of possible values. Upon registration if the value provided by the user does not match one of these values, the user will not be registered.", 'profile-builder')), array('type' => 'text', 'slug' => 'custom-error-message', 'title' => __('Error Message', 'profile-builder'), 'description' => __("Set a custom error message that will be displayed to the user.", 'profile-builder')), array('type' => 'select', 'slug' => 'time-format', 'title' => __('Time Format', 'profile-builder'), 'options' => array('%12 Hours%12', '%24 Hours%24'), 'description' => __('Specify the time format.', 'profile-builder')), array('type' => 'text', 'slug' => 'map-api-key', 'title' => __('Google Maps API Key', 'profile-builder'), 'description' => __('Enter your Google Maps API key ( <a href="https://console.developers.google.com/flows/enableapi?apiid=maps_backend" target="_blank">Get your API key</a> ). If more than one map fields are added to a form the API key from the first map displayed will be used.', 'profile-builder')), array('type' => 'text', 'slug' => 'map-default-lat', 'title' => __('Default Latitude', 'profile-builder'), 'description' => __("The latitude at which the map should be displayed when no pins are attached.", 'profile-builder')), array('type' => 'text', 'slug' => 'map-default-lng', 'title' => __('Default Longitude', 'profile-builder'), 'description' => __("The longitude at which the map should be displayed when no pins are attached.", 'profile-builder')), array('type' => 'text', 'slug' => 'map-default-zoom', 'title' => __('Default Zoom Level', 'profile-builder'), 'description' => __("Add a number from 0 to 19. The higher the number the higher the zoom.", 'profile-builder'), 'default' => 16), array('type' => 'text', 'slug' => 'map-height', 'title' => __('Map Height', 'profile-builder'), 'description' => __("The height of the map.", 'profile-builder'), 'default' => 400), array('type' => 'textarea', 'slug' => 'default-content', 'title' => __('Default Content', 'profile-builder'), 'description' => __("Default value of the textarea", 'profile-builder')), array('type' => 'textarea', 'slug' => 'html-content', 'title' => __('HTML Content', 'profile-builder'), 'description' => __("Add your HTML (or text) content", 'profile-builder')), array('type' => 'text', 'slug' => 'phone-format', 'title' => __('Phone Format', 'profile-builder'), 'default' => '(###) ###-####', 'description' => __("You can use: # for numbers, parentheses ( ), - sign, + sign, dot . and spaces.", 'profile-builder') . '<br>' . __("Eg. (###) ###-####", 'profile-builder') . '<br>' . __("Empty field won't check for correct phone number.", 'profile-builder')), array('type' => 'select', 'slug' => 'required', 'title' => __('Required', 'profile-builder'), 'options' => array('No', 'Yes'), 'default' => 'No', 'description' => __('Whether the field is required or not', 'profile-builder')), array('type' => 'select', 'slug' => 'overwrite-existing', 'title' => __('Overwrite Existing', 'profile-builder'), 'options' => array('No', 'Yes'), 'default' => 'No', 'description' => __("Selecting 'Yes' will add the field to the list, but will overwrite any other field in the database that has the same meta-name<br/>Use this at your own risk", 'profile-builder')))); // create the new submenu with the above options $args = array('metabox_id' => 'manage-fields', 'metabox_title' => __('Field Properties', 'profile-builder'), 'post_type' => 'manage-fields', 'meta_name' => 'wppb_manage_fields', 'meta_array' => $fields, 'context' => 'option'); new Wordpress_Creation_Kit_PB($args); wppb_prepopulate_fields(); // create the info side meta-box $args = array('metabox_id' => 'manage-fields-info', 'metabox_title' => __('Registration & Edit Profile', 'profile-builder'), 'post_type' => 'manage-fields', 'meta_name' => 'wppb_manage_fields_info', 'meta_array' => '', 'context' => 'option', 'mb_context' => 'side'); new Wordpress_Creation_Kit_PB($args); }