public function settings_updated() { global $pagenow, $usp_advanced; if (is_admin() && $pagenow == 'options-general.php') { if (isset($_GET['page']) && $_GET['page'] == 'usp_options') { if (isset($_GET['settings-updated']) && $_GET['settings-updated']) { if (isset($usp_advanced['post_type_role'])) { $roles = $usp_advanced['post_type_role']; $matches = array(); $misses = array(); foreach (get_editable_roles() as $role_name => $role_info) { if (in_array($role_name, $roles)) { $matches[] = $role_name; } else { $misses[] = $role_name; } } foreach ($matches as $match) { $this->add_capability($match); } foreach ($misses as $miss) { $this->remove_capability($miss); } } } } } }
function get_all_privilege() { global $wpdb; $query = "SELECT option_name, option_value FROM {$wpdb->prefix}options WHERE option_name LIKE 'sm_%_dashboard';"; $results = $wpdb->get_results($query); $rows_roles = $wpdb->num_rows; $roles = array(); foreach ($results as $obj) { $roles_detail = unserialize($obj->option_value); $roles[$obj->option_name] = $roles_detail; } $all_roles = get_editable_roles(); if (isset($all_roles['administrator'])) { unset($all_roles['administrator']); } foreach ($all_roles as $role => $details) { $name = translate_user_role($details['name']); $checked = array(); if ($rows_roles > 0) { for ($i = 0; $i < count($roles['sm_' . $role . '_dashboard']); $i++) { $checked[$roles['sm_' . $role . '_dashboard'][$i]] = 'checked'; } } $products_checked = isset($checked['Products']) && $checked['Products'] === 'checked' ? 'checked' : 'unchecked'; $customers_orders_checked = isset($checked['Customers_Orders']) && $checked['Customers_Orders'] === 'checked' ? 'checked' : 'unchecked'; if ($name != 'Administrator') { echo "\n <tr>\n <th scope='row'>{$name}</th>\n <td align='center'><input name='sm_" . $role . "_dashboard[]' type='checkbox' id='Products' value='Products' " . $products_checked . "></td>\n <td align='center'><input name='sm_" . $role . "_dashboard[]' type='checkbox' id='Customers_Orders' value='Customers_Orders' " . $customers_orders_checked . "></td>\n </tr>\n "; } } }
public function save($params = array()) { $data = array('message' => ''); $roles = $this->getWpRoles(); $editable_roles = get_editable_roles(); foreach ($params as $role => $parts) { if (is_string($parts)) { $parts = json_decode(stripslashes($parts), true); } if (isset($editable_roles[$role])) { foreach ($parts as $part => $settings) { $part_key = vc_role_access()->who($role)->part($part)->getStateKey(); $stateValue = '0'; $roles->use_db = false; // Disable saving in DB on every cap change foreach ($settings as $key => $value) { if ('_state' === $key) { $stateValue = in_array($value, array('0', '1')) ? (bool) $value : $value; } else { if (empty($value)) { $roles->remove_cap($role, $part_key . '/' . $key); } else { $roles->add_cap($role, $part_key . '/' . $key, true); } } } $roles->use_db = true; // Enable for the lat change in cap of role to store data in DB $roles->add_cap($role, $part_key, $stateValue); } } } $data['message'] = __('Roles settings successfully saved.', 'js_composer'); return $data; }
function aviators_settings_render_field($args) { $option = $args['option']; if (isset($option->default)) { $value = get_option($args['id'], $option->default); } else { $value = get_option($args['id']); } $args = array('args' => $args, 'value' => $value, 'option' => $option); if ($option->type == 'select_user_role') { $args['user_roles'] = get_editable_roles(); } if ($option->type == 'select_post_type') { $args['post_types'] = get_post_types(array('public' => true, '_builtin' => false), 'objects'); } if ($option->type == 'select_post_type_for_submission') { $types = array(); $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects'); if (is_array($post_types)) { foreach ($post_types as $key => $post_type) { if (function_exists('aviators_' . $key . '_form')) { $types[] = $post_type; } } } $args['post_types'] = $types; } echo View::render('settings/fields/' . $option->type . '.twig', $args); }
function bbconnect_dropdown_roles($selected = false) { $p = ''; $r = ''; $editable_roles = get_editable_roles(); foreach ($editable_roles as $role => $details) { $name = translate_user_role($details['name']); if (is_array($selected)) { if (in_array($role, $selected)) { // preselect specified role $p .= "\n\t<option selected='selected' value='" . esc_attr($role) . "'>{$name}</option>"; } else { $r .= "\n\t<option value='" . esc_attr($role) . "'>{$name}</option>"; } } else { if ($selected == $role) { // preselect specified role $p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>{$name}</option>"; } else { $r .= "\n\t<option value='" . esc_attr($role) . "'>{$name}</option>"; } } } echo $p . $r; }
public function vtmin_fill_roles_checklist($tax_class, $checked_list = NULL) { $roles = get_editable_roles(); $roles['notLoggedIn'] = array('name' => 'Not logged in (just visiting)'); foreach ($roles as $role => $info) { $name_translated = translate_user_role($info['name']); $output = '<li id=' . $role . '>'; $output .= '<label class="selectit">'; $output .= '<input id="' . $role . '_' . $tax_class . ' " '; $output .= 'type="checkbox" name="tax-input-' . $tax_class . '[]" '; $output .= 'value="' . $role . '" '; if ($checked_list) { if (in_array($role, $checked_list)) { //if cat_id is in previously checked_list $output .= 'checked="checked"'; } } $output .= '>'; //end input statement $output .= ' ' . $name_translated; $output .= '</label>'; $output .= '</li>'; echo $output; } return; }
public function role($role = null) { if (is_null($role)) { $role = array_keys(get_editable_roles()); } return $this->generator->randomElement($role); }
/** * Bypass the hide_guest_role() filter * * @return array $roles List of roles. */ public static function get_roles_with_guest() { remove_filter('editable_roles', array(self::class, 'hide_guest_role'), 11); $roles = get_editable_roles(); add_filter('editable_roles', array(self::class, 'hide_guest_role'), 11, 1); return $roles; }
protected function prepare_data($delete_roles) { $this->roles = array(); $editable_roles = get_editable_roles(); global $wp_roles; $override = $this->main->override_edit_permissions(); if ($override) { $editable_roles = $wp_roles->get_names(); } foreach ($delete_roles as $value) { if (array_key_exists($value, $wp_roles->role_names)) { $status_message = ''; $is_deletable = TRUE; if (!array_key_exists($value, $editable_roles)) { $status_message = 'This role cannot be deleted: Permission denied.'; $is_deletable = FALSE; } else { if ($value == self::ADMINISTRATOR_ROLE_KEY) { $status_message = '\'administrator\' role cannot be deleted.'; $is_deletable = FALSE; } else { global $user_ID; $user = new WP_User($user_ID); if (!$override && in_array($value, $user->roles)) { $status_message = 'Current user\'s role cannot be deleted.'; $is_deletable = FALSE; } } } $this->roles[$value] = (object) array('name' => $value, 'display_name' => $wp_roles->role_names[$value], 'is_deletable' => $is_deletable, 'status_message' => $status_message); } } }
function ninja_forms_register_feditor_sub_settings_metabox() { $all_roles = get_editable_roles(); $tmp_array = array(); if (is_array($all_roles) and !empty($all_roles)) { foreach ($all_roles as $key => $role) { $tmp_array[] = array('name' => $role['name'], 'value' => $key); } } $all_roles = $tmp_array; $edit_table_cols = array(); if (isset($_REQUEST['form_id'])) { $form_id = $_REQUEST['form_id']; $fields = ninja_forms_get_fields_by_form_id($form_id); foreach ($fields as $field) { if (isset($field['data']['label'])) { $edit_table_cols[] = array('name' => $field['data']['label'], 'value' => $field['id']); } else { $edit_table_cols[] = array('name' => 'Field ID: ' . $field['id'], 'value' => $field['id']); } } } else { } $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'sub_settings', 'title' => __('Submission management settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'manage_sub', 'type' => 'checkbox', 'label' => __('Enable front-end submission management', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table', 'type' => 'checkbox', 'label' => __('Show submission management table above this form?', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'manage_sub_table_cols', 'type' => 'multi_select', 'label' => __('Use these fields as table columns', 'ninja-forms-feditor'), 'options' => $edit_table_cols, 'size' => 10, 'desc' => __('Use CTRL + click to select multiple fields (COMMAND + click for Mac users). The number of field columns you want will depend upon the size of your field labels and values. Three is a good, standard value.', 'ninja-forms-feditor')), array('name' => 'manage_sub_hide_form', 'type' => 'checkbox', 'label' => __('Hide this form when a user has submissions to manage', 'ninja-forms-feditor')), array('name' => 'override_sub_rules', 'type' => 'checkbox', 'label' => __('Override rules settings', 'ninja-forms-feditor')), array('name' => '', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_feditor_sub_settings_user_list'), array('name' => 'manage_sub_roles', 'type' => 'checkbox_list', 'select_all' => false, 'options' => $all_roles, 'label' => __('Allow these roles', 'ninja-forms')), array('name' => 'edit_sub', 'type' => 'checkbox', 'label' => __('To Edit Submissions', 'ninja-forms-feditor')), array('name' => 'delete_sub', 'type' => 'checkbox', 'label' => __('To Delete Submissions', 'ninja-forms-feditor')))); if (function_exists('ninja_forms_register_tab_metabox')) { ninja_forms_register_tab_metabox($args); } }
function ninja_forms_register_feditor_post_settings_metabox() { //Get an array of post types for our post type option. $post_types = get_post_types(); //Remove the built-in post types that we aren't using. unset($post_types['nav_menu_item']); unset($post_types['mediapage']); unset($post_types['attachment']); unset($post_types['revision']); //Loop through the remaining post types and put the array in ['name'] and ['value'] format. $tmp_array = array(); $x = 0; foreach ($post_types as $type) { $type_obj = get_post_type_object($type); $tmp_array[$x]['name'] = $type_obj->labels->singular_name; $tmp_array[$x]['value'] = $type_obj->name; $x++; } $post_types = $tmp_array; //Get a list of user roles $all_roles = get_editable_roles(); //Reset the tmp_array variable to store our user roles array $tmp_array = array(); $tmp_array[] = array('name' => __('Non-logged in user', 'ninja-forms-feditor'), 'value' => '_none'); foreach ($all_roles as $key => $role) { $tmp_array[] = array('name' => $role['name'], 'value' => $key); } $all_roles = $tmp_array; $args = array('page' => 'ninja-forms', 'tab' => 'form_settings', 'slug' => 'create_post', 'title' => __('Post creation settings', 'ninja-forms-feditor'), 'display_function' => '', 'state' => 'closed', 'settings' => array(array('name' => 'create_post', 'type' => 'checkbox', 'desc' => '', 'label' => __('Create Post From Input?', 'ninja-forms-feditor'), 'display_function' => '', 'help' => __('If this box is checked, Ninja Forms will create a post from user input.', 'ninja-forms-feditor'), 'default' => 0), array('name' => 'post_as', 'type' => '', 'desc' => '', 'label' => __('Users must be logged in to create post?', 'ninja-forms-feditor'), 'display_function' => 'ninja_forms_metabox_post_as', 'help' => ''), array('name' => 'post_status', 'type' => 'select', 'options' => array(array('name' => 'Draft', 'value' => 'draft'), array('name' => 'Pending', 'value' => 'pending'), array('name' => 'Publish', 'value' => 'publish')), 'desc' => '', 'label' => __('Select a post status', 'ninja-forms-feditor'), 'display_function' => '', 'help' => ''), array('name' => 'post_type', 'type' => 'select', 'desc' => '', 'options' => $post_types, 'label' => __('Select a post type', 'ninja-forms-feditor'), 'display_function' => '', 'help' => '', 'class' => 'ninja-forms-post-type'), array('name' => 'comment_status', 'type' => 'checkbox', 'label' => __('Allow Comments', 'ninja-forms-feditor')), array('name' => 'before_post_terms', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_metabox_before_post_terms'), array('name' => 'post_terms', 'type' => '', 'desc' => '', 'label' => __('Default post terms', 'ninja-forms-feditor'), 'display_function' => 'ninja_forms_metabox_post_terms', 'help' => ''), array('name' => 'post_tags', 'type' => 'text', 'label' => __('Default post tags', 'ninja-forms-feditor'), 'display_function' => '', 'help' => '', 'desc' => __('Comma separated list', 'ninja-forms-feditor')), array('name' => 'post_title', 'type' => 'text', 'label' => __('Default post title', 'ninja-forms-feditor')), array('name' => 'post_content', 'type' => 'rte', 'label' => __('Default Post Content', 'ninja-forms-feditor'), 'display_function' => ''), array('name' => 'post_content_location', 'type' => 'radio', 'label' => __('Where should the default content be placed?', 'ninja-forms-feditor'), 'options' => array(array('name' => 'Before user submitted content', 'value' => 'prepend'), array('name' => 'After user submitted content', 'value' => 'append')), 'desc' => __('If you do not have a "Post Content" field in your form, the default content will be used instead of the main content.', 'ninja-forms-feditor')), array('name' => 'post_excerpt', 'type' => 'rte', 'label' => __('Default Post Excerpt', 'ninja-forms-feditor'), 'display_function' => ''), array('name' => '', 'type' => '', 'display_function' => 'ninja_forms_feditor_metabox_hr'), array('name' => 'enable_post_edit', 'type' => 'checkbox', 'label' => __('Enable Front-End Post Editing', 'ninja-forms-feditor'), 'desc' => __('If this box is unchecked, users will NOT be able to edit this post, regardless of rules settings.', 'ninja-forms-feditor'), 'default_value' => 1), array('name' => 'override_post_edit', 'type' => 'checkbox', 'label' => __('Override Editing Rules Settings', 'ninja-forms-feditor'), 'desc' => __('If this box is checked, the settings below will override any rules settings that may apply.', 'ninja-forms-feditor')), array('name' => 'enable_post_delete', 'type' => 'checkbox', 'label' => __('Allow Users To Delete This Post', 'ninja-forms-feditor'), 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => 'post_edit_author', 'type' => 'checkbox', 'label' => __('Allow the author to edit this post', 'ninja-forms-feditor'), 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => '', 'type' => '', 'label' => '', 'display_function' => 'ninja_forms_feditor_metabox_post_edit_users', 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')), array('name' => 'post_edit_roles', 'type' => 'checkbox_list', 'label' => __('Allow these roles to edit', 'ninja-forms-feditor'), 'options' => $all_roles, 'desc' => __('This setting will only be used if the "Override" option above is set.', 'ninja-forms-feditor')))); if (function_exists('ninja_forms_register_tab_metabox')) { ninja_forms_register_tab_metabox($args); } }
function wp_roles_dropdown($field_name, $capability) { $field_value = FrmAppHelper::get_param($field_name); $editable_roles = get_editable_roles(); ?> <select name="<?php echo $field_name; ?> " id="<?php echo $field_name; ?> " class="frm-dropdown frm-pages-dropdown"> <?php foreach ($editable_roles as $role => $details) { $name = translate_user_role($details['name']); ?> <option value="<?php echo esc_attr($role); ?> " <?php echo (isset($_POST[$field_name]) and $_POST[$field_name] == $role or !isset($_POST[$field_name]) and $capability == $role) ? ' selected="selected"' : ''; ?> ><?php echo $name; ?> </option> <?php } ?> </select> <?php }
public function parse_request($qty, $request = array()) { if (is_null($qty)) { $qty = Variable::super(INPUT_POST, array(Plugin::$slug, 'qty'), FILTER_UNSAFE_RAW); $min = absint($qty['min']); $max = max(absint(isset($qty['max']) ? $qty['max'] : 0), $min); $qty = $this->faker->numberBetween($min, $max); } if (0 === $qty) { return esc_attr__('Zero is not a good number of users to fake...', 'fakerpress'); } $meta_module = Meta::instance(); $description_use_html = Variable::super($request, array('use_html'), FILTER_SANITIZE_STRING, 'off') === 'on'; $description_html_tags = array_map('trim', explode(',', Variable::super($request, array('html_tags'), FILTER_SANITIZE_STRING))); $roles = array_intersect(array_keys(get_editable_roles()), array_map('trim', explode(',', Variable::super($request, array('roles'), FILTER_SANITIZE_STRING)))); $metas = Variable::super($request, array('meta'), FILTER_UNSAFE_RAW); $results = array(); for ($i = 0; $i < $qty; $i++) { $this->param('role', $roles); $this->param('description', $description_use_html, array('elements' => $description_html_tags)); $this->generate(); $user_id = $this->save(); if ($user_id && is_numeric($user_id)) { foreach ($metas as $meta_index => $meta) { $meta_module->object($user_id, 'user')->build($meta['type'], $meta['name'], $meta)->save(); } } $results[] = $user_id; } $results = array_filter($results, 'absint'); return $results; }
public function get_roles() { $roles = array(); foreach (get_editable_roles() as $role_name => $role) { $roles[$role_name] = $role['name']; } return $roles; }
public function get_roles() { $roles = array(self::ANON_ROLE => 'Anonymous User'); foreach (get_editable_roles() as $role_name => $role) { $roles[$role_name] = $role['name']; } return $roles; }
function TS_VCSC_RemoveCap() { $roles = get_editable_roles(); foreach ($GLOBALS['wp_roles']->role_objects as $key => $role) { if (isset($roles[$key]) && $role->has_cap('ts_vcsc_extend')) { $role->remove_cap('ts_vcsc_extend'); } } }
/** * Get all editable roles by the current user * * @return array editable roles */ public function get_editable_roles() { $editable_roles = get_editable_roles(); $final_roles = array(); foreach ($editable_roles as $key => $role) { $final_roles[$key] = $role['name']; } return apply_filters('mdmr_get_editable_roles', (array) $final_roles); }
/** * * @return array; */ public function getPicklistOptions() { $editable_roles = get_editable_roles(); foreach ($editable_roles as $role => $details) { $name = translate_user_role($details['name']); $options[esc_attr($role)] = $name; } return $options; }
public function getRoles() { $editableRoles = array_reverse(get_editable_roles()); $rolesOptions = array(); foreach ($editableRoles as $role => $details) { $name = translate_user_role($details['name']); $rolesOptions[esc_attr($role)] = $name; } return $rolesOptions; }
public function get_user_roles() { $roles = get_editable_roles(); //echo '<pre>';var_dump($roles);die; $role_names = array(); foreach ($roles as $key => $role) { $role_names[$key] = $role['name']; } return $role_names; }
public function getRole() { if (!$this->roleName) { $user = wp_get_current_user(); $user_roles = array_intersect(array_values($user->roles), array_keys(get_editable_roles())); $this->roleName = reset($user_roles); $this->role = get_role($this->roleName); } return $this->role; }
/** * Setup color scheme choices for use by control */ public function choices() { $choices = array('' => __('— No role for this site —')); $editable_roles = array_reverse(get_editable_roles()); foreach ($editable_roles as $role => $details) { $name = translate_user_role($details['name']); $choices[$role] = $name; } return $choices; }
/** * Get all editable user roles assignable for cornerstone * Administrator role will be skip since it can't be turned off and on when it should be permitted for everything */ public function getRoles() { $roles = get_editable_roles(); $active_roles = array(); foreach ($roles as $name => $info) { if ($name !== 'administrator') { $active_roles[$info['name']] = $name; } } return $active_roles; }
public static function render_toolbar() { $curruri = Skeleteon_Generic::curruri(); // var_dump(self::$vars); //var_dump($this->vars); ?> <div id="ske-toolbar"> <input id="eopfwtb_cboxt" type="checkbox" class="cbox_toggle_i" checked="checked" role="button"> <label class="cbox_toggle flr" for="eopfwtb_cboxt"> <span class="label label-success cbt_s">+ Show {<?php _e('Toolbar', 'eop_dcod'); ?> }</span><span class="label label-default cbt_h">— Hide {<?php _e('Toolbar', self::$vars['lang_slug']); ?> }</span></label> <div id="tbwell" class="cbt_cont well"> <a href="<?php echo add_query_arg('ske_action', 'reset_mboxes', $curruri); ?> " class="btn btn-xs btn-primary"><i class="fa fa-bars"></i>Reset Metaboxes</a> <a href="#" class="btn btn-xs btn-primary"><i class="fa fa-bars"></i>Reset Metaboxes</a> <a href="#" class="btn btn-xs btn-primary"><i class="fa fa-bars"></i>Reset Metaboxes</a> <dl> <?php foreach (get_editable_roles() as $role_name => $role_info) { ?> <dt><?php echo $role_name; ?> </dt> <dd> <ul> <?php foreach ($role_info['capabilities'] as $capability => $_) { ?> <li><?php echo $capability; ?> </li> <?php } ?> </ul> </dd> <?php } ?> </dl> </div> </div> <?php }
/** * Get available WordPress user account roles * * @return array */ public static function get_roles() { $roles = array(); // get WP roles $wp_roles = \get_editable_roles(); if (count($wp_roles) > 0) { foreach ($wp_roles as $key => $role) { $roles[$key] = $role['name']; } } return $roles; }
public static function categoryEditFormAccess($term = null) { $roles = get_editable_roles(); if (!empty($term) and is_object($term)) { $category = CMA_Category::getInstance($term->term_id); $categoryRoles = $category->getAccessRoles(); } else { $term = $category = null; $categoryRoles = array(); } include CMA_PATH . '/views/backend/meta/edit-tag-form-access.php'; }
function render_field($args) { $all_roles = get_editable_roles(); if (!empty($all_roles)) { foreach ($all_roles as $k => $r) { echo '<input type="checkbox" name="' . $args['field_name'] . '[]" id="' . $args['field_id'] . '-' . esc_attr($k) . '" value="' . esc_attr($k) . '" class="stylish-checkbox" '; checked(is_array($args['field_value']) && in_array($k, $args['field_value']), true, true); echo ' />'; echo '<label for="' . $args['field_id'] . '-' . esc_attr($k) . '">' . esc_attr($r['name']) . '</label><br />'; } } }
public function run($arguments) { $arguments = Ithemes_Sync_Functions::merge_defaults($arguments, $this->default_arguments); require_once ABSPATH . 'wp-admin/includes/user.php'; $roles = get_editable_roles(); if ($arguments['just-names']) { foreach ($roles as $index => $data) { $roles[$index] = $data['name']; } } return $roles; }
/** * init_settings function. * * @access protected * @return void */ protected function init_settings() { // Prepare roles option $roles = get_editable_roles(); $account_roles = array(); foreach ($roles as $key => $role) { if ($key == 'administrator') { continue; } $account_roles[$key] = $role['name']; } $this->settings = apply_filters('job_manager_settings', array('job_listings' => array(__('Job Listings', 'wp-job-manager'), array(array('name' => 'job_manager_per_page', 'std' => '10', 'placeholder' => '', 'label' => __('Listings Per Page', 'wp-job-manager'), 'desc' => __('How many listings should be shown per page by default?', 'wp-job-manager'), 'attributes' => array()), array('name' => 'job_manager_hide_filled_positions', 'std' => '0', 'label' => __('Filled Positions', 'wp-job-manager'), 'cb_label' => __('Hide filled positions', 'wp-job-manager'), 'desc' => __('If enabled, filled positions will be hidden.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_enable_categories', 'std' => '0', 'label' => __('Job Categories', 'wp-job-manager'), 'cb_label' => __('Enable categories for listings', 'wp-job-manager'), 'desc' => __('Choose whether to enable categories. Categories must be setup by an admin to allow users to choose them during submission.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_enable_default_category_multiselect', 'std' => '0', 'label' => __('Multi-select Categories', 'wp-job-manager'), 'cb_label' => __('Enable category multiselect by default', 'wp-job-manager'), 'desc' => __('If enabled, the category select box will default to a multiselect on the [jobs] shortcode.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_category_filter_type', 'std' => 'any', 'label' => __('Category Filter Type', 'wp-job-manager'), 'desc' => __('If enabled, the category select box will default to a multiselect on the [jobs] shortcode.', 'wp-job-manager'), 'type' => 'select', 'options' => array('any' => __('Jobs will be shown if within ANY selected category', 'wp-job-manager'), 'all' => __('Jobs will be shown if within ALL selected categories', 'wp-job-manager'))))), 'job_submission' => array(__('Job Submission', 'wp-job-manager'), array(array('name' => 'job_manager_user_requires_account', 'std' => '1', 'label' => __('Account Required', 'wp-job-manager'), 'cb_label' => __('Submitting listings requires an account', 'wp-job-manager'), 'desc' => __('If disabled, non-logged in users will be able to submit listings without creating an account.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_enable_registration', 'std' => '1', 'label' => __('Account Creation', 'wp-job-manager'), 'cb_label' => __('Allow account creation', 'wp-job-manager'), 'desc' => __('If enabled, non-logged in users will be able to create an account by entering their email address on the submission form.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_registration_role', 'std' => 'employer', 'label' => __('Account Role', 'wp-job-manager'), 'desc' => __('If you enable registration on your submission form, choose a role for the new user.', 'wp-job-manager'), 'type' => 'select', 'options' => $account_roles), array('name' => 'job_manager_submission_requires_approval', 'std' => '1', 'label' => __('Approval Required', 'wp-job-manager'), 'cb_label' => __('New submissions require admin approval', 'wp-job-manager'), 'desc' => __('If enabled, new submissions will be inactive, pending admin approval.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_user_can_edit_pending_submissions', 'std' => '0', 'label' => __('Allow Pending Edits', 'wp-job-manager'), 'cb_label' => __('Submissions awaiting approval can be edited', 'wp-job-manager'), 'desc' => __('If enabled, submissions awaiting admin approval can be edited by the user.', 'wp-job-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'job_manager_submission_duration', 'std' => '30', 'label' => __('Listing Duration', 'wp-job-manager'), 'desc' => __('How many <strong>days</strong> listings are live before expiring. Can be left blank to never expire.', 'wp-job-manager'), 'attributes' => array()), array('name' => 'job_manager_allowed_application_method', 'std' => '', 'label' => __('Application Method', 'wp-job-manager'), 'desc' => __('Choose the contact method for listings.', 'wp-job-manager'), 'type' => 'select', 'options' => array('' => __('Email address or website URL', 'wp-job-manager'), 'email' => __('Email addresses only', 'wp-job-manager'), 'url' => __('Website URLs only', 'wp-job-manager'))))), 'job_pages' => array(__('Pages', 'wp-job-manager'), array(array('name' => 'job_manager_submit_job_form_page_id', 'std' => '', 'label' => __('Submit Job Form Page', 'wp-job-manager'), 'desc' => __('Select the page where you have placed the [submit_job_form] shortcode. This lets the plugin know where the form is located.', 'wp-job-manager'), 'type' => 'page'), array('name' => 'job_manager_job_dashboard_page_id', 'std' => '', 'label' => __('Job Dashboard Page', 'wp-job-manager'), 'desc' => __('Select the page where you have placed the [job_dashboard] shortcode. This lets the plugin know where the dashboard is located.', 'wp-job-manager'), 'type' => 'page'), array('name' => 'job_manager_jobs_page_id', 'std' => '', 'label' => __('Job Listings Page', 'wp-job-manager'), 'desc' => __('Select the page where you have placed the [jobs] shortcode. This lets the plugin know where the job listings page is located.', 'wp-job-manager'), 'type' => 'page'))))); }
/** * init_settings function. * * @access protected * @return void */ protected function init_settings() { // Prepare roles option $roles = get_editable_roles(); $account_roles = array(); foreach ($roles as $key => $role) { if ($key == 'administrator') { continue; } $account_roles[$key] = $role['name']; } $this->settings = apply_filters('event_manager_settings', array('event_listings' => array(__('Event Listings', 'gam-event-manager'), array(array('name' => 'event_manager_per_page', 'std' => '10', 'placeholder' => '', 'label' => __('Listings Per Page', 'gam-event-manager'), 'desc' => __('How many listings should be shown per page by default?', 'gam-event-manager'), 'attributes' => array()), array('name' => 'event_manager_hide_cancelled_events', 'std' => '0', 'label' => __('Cancelled Events', 'gam-event-manager'), 'cb_label' => __('Hide cancelled events', 'gam-event-manager'), 'desc' => __('If enabled, cancelled events will be hidden from archives.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_hide_expired_content', 'std' => '1', 'label' => __('Expired Listings', 'gam-event-manager'), 'cb_label' => __('Hide content within expired listings', 'gam-event-manager'), 'desc' => __('If enabled, the content within expired listings will be hidden. Otherwise, expired listings will be displayed as normal (without the event registration area).', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_categories', 'std' => '0', 'label' => __('Categories', 'gam-event-manager'), 'cb_label' => __('Enable categories for listings', 'gam-event-manager'), 'desc' => __('Choose whether to enable categories. Categories must be setup by an admin to allow users to choose them during submission.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_event_types', 'std' => '0', 'label' => __('Event Types', 'gam-event-manager'), 'cb_label' => __('Enable event types for listings', 'gam-event-manager'), 'desc' => __('Choose whether to enable event types. event types must be setup by an admin to allow users to choose them during submission.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_event_ticket_prices', 'std' => '0', 'label' => __('Ticket prices', 'gam-event-manager'), 'cb_label' => __('Enable ticket prices for listings', 'gam-event-manager'), 'desc' => __('Choose whether to enable ticket prices. Ticket prices must be setup by an admin to allow users to choose them during submission.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_default_category_multiselect', 'std' => '0', 'label' => __('Multi-select Categories', 'gam-event-manager'), 'cb_label' => __('Enable category multiselect by default', 'gam-event-manager'), 'desc' => __('If enabled, the category select box will default to a multi select on the [events] shortcode.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_default_event_type_multiselect', 'std' => '0', 'label' => __('Multi-select Event Types', 'gam-event-manager'), 'cb_label' => __('Enable event type multiselect by default', 'gam-event-manager'), 'desc' => __('If enabled, the event type select box will default to a multi select on the [events] shortcode.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_category_filter_type', 'std' => 'any', 'label' => __('Category Filter Type', 'gam-event-manager'), 'desc' => __('If enabled, the category select box will default to a multi select on the [events] shortcode.', 'gam-event-manager'), 'type' => 'select', 'options' => array('any' => __('Events will be shown if within ANY selected category', 'gam-event-manager'), 'all' => __('Events will be shown if within ALL selected categories', 'gam-event-manager'))), array('name' => 'event_manager_event_type_filter_type', 'std' => 'any', 'label' => __('Event Type Filter', 'gam-event-manager'), 'desc' => __('If enabled, the event type select box will default to a multi select on the [events] shortcode.', 'gam-event-manager'), 'type' => 'select', 'options' => array('any' => __('Events will be shown if within ANY selected event type', 'gam-event-manager'), 'all' => __('Events will be shown if within ALL selected event types', 'gam-event-manager'))))), 'event_submission' => array(__('Event Submission', 'gam-event-manager'), array(array('name' => 'event_manager_user_requires_account', 'std' => '1', 'label' => __('Account Required', 'gam-event-manager'), 'cb_label' => __('Submitting listings requires an account', 'gam-event-manager'), 'desc' => __('If disabled, non-logged in users will be able to submit listings without creating an account.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_enable_registration', 'std' => '1', 'label' => __('Account Creation', 'gam-event-manager'), 'cb_label' => __('Allow account creation', 'gam-event-manager'), 'desc' => __('If enabled, non-logged in users will be able to create an account by entering their email address on the submission form.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_generate_username_from_email', 'std' => '1', 'label' => __('Account Username', 'gam-event-manager'), 'cb_label' => __('Automatically Generate Username from Email Address', 'gam-event-manager'), 'desc' => __('If enabled, a username will be generated from the first part of the user email address. Otherwise, a username field will be shown.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_registration_role', 'std' => 'employer', 'label' => __('Account Role', 'gam-event-manager'), 'desc' => __('If you enable registration on your submission form, choose a role for the new user.', 'gam-event-manager'), 'type' => 'select', 'options' => $account_roles), array('name' => 'event_manager_submission_requires_approval', 'std' => '1', 'label' => __('Moderate New Listings', 'gam-event-manager'), 'cb_label' => __('New listing submissions require admin approval', 'gam-event-manager'), 'desc' => __('If enabled, new submissions will be inactive, pending admin approval.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_user_can_edit_pending_submissions', 'std' => '0', 'label' => __('Allow Pending Edits', 'gam-event-manager'), 'cb_label' => __('Submissions awaiting approval can be edited', 'gam-event-manager'), 'desc' => __('If enabled, submissions awaiting admin approval can be edited by the user.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_delete_expired_events', 'std' => '0', 'label' => __('Delete Expired listings', 'gam-event-manager'), 'cb_label' => __('Expired listings are deleted after 30 days', 'gam-event-manager'), 'desc' => __('If enabled, expired listings will automatically deleted after 30 days.', 'gam-event-manager'), 'type' => 'checkbox', 'attributes' => array()), array('name' => 'event_manager_submission_expire_options', 'std' => 'event_end_date', 'label' => __('Listing Expire', 'gam-event-manager'), 'desc' => __('You can set event submission expiry time either event end date or specific days.', 'gam-event-manager'), 'type' => 'select', 'options' => array('event_end_date' => __('Listing expire on Event End Date', 'gam-event-manager'), 'days' => __('Listing expire on Specified Below Days', 'gam-event-manager'))), array('name' => 'event_manager_submission_duration', 'std' => '30', 'label' => __('Listing Duration', 'gam-event-manager'), 'desc' => __('How many <strong>days</strong> listings are live before expiring. Can be left blank to never expire.', 'gam-event-manager'), 'attributes' => array()), array('name' => 'event_manager_allowed_registration_method', 'std' => '', 'label' => __('Registration Method', 'gam-event-manager'), 'desc' => __('Choose the registratoin method for listings.', 'gam-event-manager'), 'type' => 'select', 'options' => array('' => __('Email address or website URL', 'gam-event-manager'), 'email' => __('Email addresses only', 'gam-event-manager'), 'url' => __('Website URLs only', 'gam-event-manager'))))), 'event_pages' => array(__('Pages', 'gam-event-manager'), array(array('name' => 'event_manager_submit_event_form_page_id', 'std' => '', 'label' => __('Submit Event Form Page', 'gam-event-manager'), 'desc' => __('Select the page where you have placed the [submit_event_form] shortcode. This lets the plugin know where the form is located.', 'gam-event-manager'), 'type' => 'page'), array('name' => 'event_manager_event_dashboard_page_id', 'std' => '', 'label' => __('Event Dashboard Page', 'gam-event-manager'), 'desc' => __('Select the page where you have placed the [event_dashboard] shortcode. This lets the plugin know where the dashboard is located.', 'gam-event-manager'), 'type' => 'page'), array('name' => 'event_manager_events_page_id', 'std' => '', 'label' => __('Event Listings Page', 'gam-event-manager'), 'desc' => __('Select the page where you have placed the [events] shortcode. This lets the plugin know where the event listings page is located.', 'gam-event-manager'), 'type' => 'page'))))); }