diff --git a/includes/admin/class-admin.php b/includes/admin/class-admin.php
index 992a2052..985630fc 100644
--- a/includes/admin/class-admin.php
+++ b/includes/admin/class-admin.php
@@ -6,9 +6,20 @@ if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin' ) ) {
+
+ /**
+ * Class Admin
+ * @package um\admin
+ */
class Admin {
+
+
+ /**
+ * @var string
+ */
var $templates_path;
+
/**
* Admin constructor.
*/
@@ -16,7 +27,6 @@ if ( ! class_exists( 'Admin' ) ) {
$this->templates_path = um_path . 'includes/admin/templates/';
add_action( 'admin_init', array( &$this, 'admin_init' ), 0 );
-
add_action( 'admin_notices', array( $this, 'check_wrong_install_folder' ), 3 );
}
diff --git a/includes/admin/core/class-admin-columns.php b/includes/admin/core/class-admin-columns.php
index 7c779aba..a13e51b1 100644
--- a/includes/admin/core/class-admin-columns.php
+++ b/includes/admin/core/class-admin-columns.php
@@ -156,7 +156,7 @@ if ( ! class_exists( 'Admin_Columns' ) ) {
$page_id = UM()->options()->get( UM()->options()->get_core_page_id( $page_key ) );
if ( $page_id == $post->ID ) {
- $post_states['um_core_page_' . $page_key] = sprintf( 'UM %s', $page_value['title'] );
+ $post_states[ 'um_core_page_' . $page_key ] = sprintf( 'UM %s', $page_value['title'] );
}
}
diff --git a/includes/admin/core/class-admin-forms-settings.php b/includes/admin/core/class-admin-forms-settings.php
index 5fef3440..47121681 100644
--- a/includes/admin/core/class-admin-forms-settings.php
+++ b/includes/admin/core/class-admin-forms-settings.php
@@ -5,6 +5,12 @@ namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Forms_Settings' ) ) {
+
+
+ /**
+ * Class Admin_Forms_Settings
+ * @package um\admin\core
+ */
class Admin_Forms_Settings extends Admin_Forms {
/**
diff --git a/includes/admin/core/class-admin-functions.php b/includes/admin/core/class-admin-functions.php
index ae37c426..d7974daa 100644
--- a/includes/admin/core/class-admin-functions.php
+++ b/includes/admin/core/class-admin-functions.php
@@ -5,82 +5,111 @@ namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Functions' ) ) {
- class Admin_Functions {
-
- function __construct() {
-
- $this->slug = 'ultimatemember';
-
- add_action('parent_file', array(&$this, 'parent_file'), 9);
-
- add_filter('gettext', array(&$this, 'gettext'), 10, 4);
-
- add_filter('post_updated_messages', array(&$this, 'post_updated_messages') );
-
- }
-
- /***
- *** @updated post messages
- ***/
- function post_updated_messages($messages) {
- global $post, $post_ID;
-
- $post_type = get_post_type( $post_ID );
- if ($post_type == 'um_form') {
-
- $messages['um_form'] = array(
- 0 => '',
- 1 => __('Form updated.'),
- 2 => __('Custom field updated.'),
- 3 => __('Custom field deleted.'),
- 4 => __('Form updated.'),
- 5 => isset($_GET['revision']) ? __('Form restored to revision.') : false,
- 6 => __('Form created.'),
- 7 => __('Form saved.'),
- 8 => __('Form submitted.'),
- 9 => __('Form scheduled.'),
- 10=> __('Form draft updated.'),
- );
-
- }
-
- return $messages;
- }
- /***
- *** @gettext filters
- ***/
- function gettext($translation, $text, $domain) {
- global $post;
- //$screen = get_current_screen();
- if ( isset( $post->post_type ) && UM()->admin()->is_plugin_post_type() ) {
- $translations = get_translations_for_domain( $domain);
- if ( $text == 'Publish') {
- return $translations->translate( 'Create' );
- }
- if ( $text == 'Move to Trash') {
- return $translations->translate( 'Delete' );
- }
- }
+ /**
+ * Class Admin_Functions
+ * @package um\admin\core
+ */
+ class Admin_Functions {
- return $translation;
- }
- /***
- *** @Fix parent file for correct highlighting
- ***/
- function parent_file($parent_file){
- global $current_screen;
- $screen_id = $current_screen->id;
- if ( strstr($screen_id, 'um_') ) {
- $parent_file = $this->slug;
- }
- return $parent_file;
- }
+ /**
+ * Admin_Functions constructor.
+ */
+ function __construct() {
+ add_action( 'parent_file', array( &$this, 'parent_file' ), 9 );
+ add_filter( 'gettext', array( &$this, 'gettext' ), 10, 4 );
+ add_filter( 'post_updated_messages', array( &$this, 'post_updated_messages' ) );
+ }
+
+
+ /**
+ * Updated post messages
+ *
+ * @param array $messages
+ *
+ * @return array
+ */
+ function post_updated_messages( $messages ) {
+ global $post_ID;
+
+ $post_type = get_post_type( $post_ID );
+
+ if ( $post_type == 'um_form' ) {
+ $messages['um_form'] = array(
+ 0 => '',
+ 1 => __( 'Form updated.', 'ultimate-member' ),
+ 2 => __( 'Custom field updated.', 'ultimate-member' ),
+ 3 => __( 'Custom field deleted.', 'ultimate-member' ),
+ 4 => __( 'Form updated.', 'ultimate-member' ),
+ 5 => isset( $_GET['revision'] ) ? __( 'Form restored to revision.', 'ultimate-member' ) : false,
+ 6 => __( 'Form created.', 'ultimate-member' ),
+ 7 => __( 'Form saved.', 'ultimate-member' ),
+ 8 => __( 'Form submitted.', 'ultimate-member' ),
+ 9 => __( 'Form scheduled.', 'ultimate-member' ),
+ 10 => __( 'Form draft updated.', 'ultimate-member' ),
+ );
+ }
+
+ return $messages;
+ }
+
+
+ /**
+ * Gettext filters
+ *
+ * @param $translation
+ * @param $text
+ * @param $domain
+ *
+ * @return string
+ */
+ function gettext( $translation, $text, $domain ) {
+ global $post;
+ if ( isset( $post->post_type ) && UM()->admin()->is_plugin_post_type() ) {
+ $translations = get_translations_for_domain( $domain );
+ if ( $text == 'Publish' ) {
+ return $translations->translate( 'Create' );
+ } elseif ( $text == 'Move to Trash' ) {
+ return $translations->translate( 'Delete' );
+ }
+ }
+
+ return $translation;
+ }
+
+
+ /**
+ * Fix parent file for correct highlighting
+ *
+ * @param $parent_file
+ *
+ * @return string
+ */
+ function parent_file( $parent_file ) {
+ global $current_screen;
+ $screen_id = $current_screen->id;
+ if ( strstr( $screen_id, 'um_' ) ) {
+ $parent_file = 'ultimatemember';
+ }
+ return $parent_file;
+ }
-
- }
+ /**
+ * Boolean check if we're viewing UM backend
+ *
+ * @todo global for all admin classes
+ * @return bool
+ */
+ function is_UM_admin_screen() {
+ global $current_screen;
+ $screen_id = $current_screen->id;
+ if ( is_admin() && ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') ) )
+ return true;
+ return false;
+ }
+ }
}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-menu.php b/includes/admin/core/class-admin-menu.php
index 1ab6303a..da5ac2c0 100644
--- a/includes/admin/core/class-admin-menu.php
+++ b/includes/admin/core/class-admin-menu.php
@@ -7,312 +7,385 @@ use \RecursiveDirectoryIterator;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Menu' ) ) {
- class Admin_Menu {
-
- function __construct() {
- $this->slug = 'ultimatemember';
-
- add_action('admin_menu', array(&$this, 'primary_admin_menu'), 0);
- add_action('admin_menu', array(&$this, 'secondary_menu_items'), 1000);
- add_action('admin_menu', array(&$this, 'extension_menu'), 9999);
-
- add_action( 'admin_head', array( $this, 'menu_order_count' ) );
-
- add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1000 );
- }
-
- /**
- * Change the admin footer text on UM admin pages
- */
- public function admin_footer_text( $footer_text ) {
- $current_screen = get_current_screen();
-
- // Add the dashboard pages
- $um_pages[] = 'toplevel_page_ultimatemember';
- $um_pages[] = 'ultimate-member_page_um_options';
- $um_pages[] = 'edit-um_form';
- $um_pages[] = 'edit-um_role';
- $um_pages[] = 'edit-um_directory';
- $um_pages[] = 'ultimate-member_page_ultimatemember-extensions';
-
- if ( isset( $current_screen->id ) && in_array( $current_screen->id, $um_pages ) ) {
- // Change the footer text
- if ( ! get_option( 'um_admin_footer_text_rated' ) ) {
-
- $footer_text = sprintf( __( 'If you like Ultimate Member please consider leaving a %s★★★★★%s review. It will help us to grow the plugin and make it more popular. Thank you.', 'ultimate-member' ), '', ' ' );
-
- $footer_text .= "";
- }
- }
-
- return $footer_text;
- }
-
- /**
- * When user clicks the review link in backend
- */
- function ultimatemember_rated() {
- update_option('um_admin_footer_text_rated', 1 );
- die();
- }
-
-
- /**
- * Manage order of admin menu items
- */
- public function menu_order_count() {
- global $menu, $submenu;
-
- if ( ! current_user_can( 'list_users' ) )
- return;
-
- $count = UM()->user()->get_pending_users_count();
- if ( is_array( $menu ) ) {
- foreach ( $menu as $key => $menu_item ) {
- if ( 0 === strpos( $menu_item[0], _x( 'Users', 'Admin menu name' ) ) ) {
- $menu[ $key ][0] .= ' '.$count.' ';
- }
- }
-
- }
- if ( is_array( $submenu ) ) {
- foreach ( $submenu['users.php'] as $key => $menu_item ) {
- if ( 0 === strpos( $menu_item[0], _x( 'All Users', 'Admin menu name' ) ) ) {
- $submenu['users.php'][ $key ][0] .= ' '.$count.' ';
- }
- }
- }
- }
-
- /***
- *** @setup admin menu
- ***/
- function primary_admin_menu() {
-
- $this->pagehook = add_menu_page( __('Ultimate Member', $this->slug), __('Ultimate Member', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page'), 'dashicons-admin-users', '42.78578');
- add_action( 'load-' . $this->pagehook, array( &$this, 'on_load_page' ) );
-
- add_submenu_page( $this->slug, __('Dashboard', $this->slug), __('Dashboard', $this->slug), 'manage_options', $this->slug, array(&$this, 'admin_page') );
- }
-
-
- /***
- *** @secondary admin menu (after settings)
- ***/
- function secondary_menu_items() {
-
- add_submenu_page( $this->slug, __( 'Forms', 'ultimate-member' ), __( 'Forms', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_form', '' );
-
- add_submenu_page( $this->slug, __( 'User Roles', 'ultimate-member' ), __( 'User Roles', 'ultimate-member' ), 'manage_options', 'um_roles', array( &$this, 'um_roles_pages' ) );
-
- if ( UM()->options()->get( 'members_page' ) ) {
- add_submenu_page( $this->slug, __( 'Member Directories', 'ultimate-member' ), __( 'Member Directories', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_directory', '' );
- }
-
- /**
- * UM hook
- *
- * @type action
- * @title um_extend_admin_menu
- * @description Extend UM menu
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_extend_admin_menu', 'function_name', 10 );
- * @example
- *
- */
- do_action( 'um_extend_admin_menu' );
- }
-
-
- function um_roles_pages() {
-
- if ( empty( $_GET['tab'] ) ) {
- include_once um_path . 'includes/admin/core/list-tables/roles-list-table.php';
- } elseif ( $_GET['tab'] == 'add' || $_GET['tab'] == 'edit' ) {
- include_once um_path . 'includes/admin/templates/role/role-edit.php';
- } else {
- um_js_redirect( add_query_arg( array( 'page' => 'um_roles' ), get_admin_url( 'admin.php' ) ) );
- }
-
- }
-
-
- /***
- *** @extension menu
- ***/
- function extension_menu() {
-
- add_submenu_page( $this->slug, __('Extensions', $this->slug), '' .__('Extensions', $this->slug) . ' ', 'manage_options', $this->slug . '-extensions', array(&$this, 'admin_page') );
-
- }
-
- /***
- *** @load metabox stuff
- ***/
- function on_load_page() {
- wp_enqueue_script('common');
- wp_enqueue_script('wp-lists');
- wp_enqueue_script('postbox');
-
- /** custom metaboxes for dashboard defined here **/
-
- add_meta_box('um-metaboxes-contentbox-1', __('Users Overview','ultimate-member'), array(&$this, 'users_overview'), $this->pagehook, 'core', 'core');
-
- add_meta_box('um-metaboxes-mainbox-1', __('Latest from our blog','ultimate-member'), array(&$this, 'um_news'), $this->pagehook, 'normal', 'core');
-
- add_meta_box('um-metaboxes-sidebox-1', __('Purge Temp Files','ultimate-member'), array(&$this, 'purge_temp'), $this->pagehook, 'side', 'core');
- add_meta_box('um-metaboxes-sidebox-2', __('User Cache','ultimate-member'), array(&$this, 'user_cache'), $this->pagehook, 'side', 'core');
-
- if ( $this->language_avaialable_not_installed() ) {
- add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'dl_language'), $this->pagehook, 'side', 'core');
- } else if ( $this->language_avaialable_installed() ) {
- add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'up_language'), $this->pagehook, 'side', 'core');
- } else if ( $this->language_not_available() ) {
- add_meta_box('um-metaboxes-sidebox-2', __('Language','ultimate-member'), array(&$this, 'ct_language'), $this->pagehook, 'side', 'core');
- }
-
- }
-
- function up_language() {
- $locale = get_option('WPLANG');
- include_once UM()->admin()->templates_path . 'dashboard/language-update.php';
- }
-
- function dl_language() {
- $locale = get_option('WPLANG');
- include_once UM()->admin()->templates_path . 'dashboard/language-download.php';
- }
-
- function ct_language() {
- $locale = get_option('WPLANG');
- include_once UM()->admin()->templates_path . 'dashboard/language-contrib.php';
- }
-
- function um_news() {
- include_once UM()->admin()->templates_path . 'dashboard/feed.php';
- }
-
- function users_overview() {
- include_once UM()->admin()->templates_path . 'dashboard/users.php';
- }
-
- function purge_temp() {
- include_once UM()->admin()->templates_path . 'dashboard/purge.php';
- }
-
- function user_cache() {
- include_once UM()->admin()->templates_path . 'dashboard/cache.php';
- }
-
- /***
- *** @language not available
- ***/
- function language_not_available() {
- $locale = get_option('WPLANG');
- if ( $locale && !strstr($locale, 'en_') && !isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
- return true;
- return false;
- }
- /***
- *** @language available but not installed
- ***/
- function language_avaialable_not_installed() {
- $locale = get_option('WPLANG');
- if ( $locale && isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
- return true;
- return false;
- }
- /***
- *** @language available and installed
- ***/
- function language_avaialable_installed() {
- $locale = get_option('WPLANG');
- if ( $locale && isset( UM()->available_languages[$locale] ) && file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
- return true;
- return false;
- }
+ /**
+ * Class Admin_Menu
+ * @package um\admin\core
+ */
+ class Admin_Menu {
+
+
+ /**
+ * @var string
+ */
+ var $pagehook;
+
+
+ /**
+ * Admin_Menu constructor.
+ */
+ function __construct() {
+ $this->slug = 'ultimatemember';
+
+ add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
+ add_action( 'admin_menu', array( &$this, 'secondary_menu_items' ), 1000 );
+ add_action( 'admin_menu', array( &$this, 'extension_menu' ), 9999 );
+
+ add_action( 'admin_head', array( $this, 'menu_order_count' ) );
+
+ add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1000 );
+ }
- /***
- *** @get a directory size
- ***/
- function dir_size( $directory ) {
- if ( $directory == 'temp' ) {
- $directory = UM()->files()->upload_temp;
- $size = 0;
- foreach( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $directory ) ) as $file ) {
- $size+=$file->getSize();
- }
- return round ( $size / 1048576, 2);
- }
- return 0;
- }
+ /**
+ * Change the admin footer text on UM admin pages
+ *
+ * @param $footer_text
+ *
+ * @return string
+ */
+ public function admin_footer_text( $footer_text ) {
+ $current_screen = get_current_screen();
+
+ // Add the dashboard pages
+ $um_pages[] = 'toplevel_page_ultimatemember';
+ $um_pages[] = 'ultimate-member_page_um_options';
+ $um_pages[] = 'edit-um_form';
+ $um_pages[] = 'edit-um_role';
+ $um_pages[] = 'edit-um_directory';
+ $um_pages[] = 'ultimate-member_page_ultimatemember-extensions';
+
+ if ( isset( $current_screen->id ) && in_array( $current_screen->id, $um_pages ) ) {
+ // Change the footer text
+ if ( ! get_option( 'um_admin_footer_text_rated' ) ) {
+
+ ob_start(); ?>
+
+ ★★★★★
+
+
+
+
+
+ user()->get_pending_users_count();
+ if ( is_array( $menu ) ) {
+ foreach ( $menu as $key => $menu_item ) {
+ if ( 0 === strpos( $menu_item[0], _x( 'Users', 'Admin menu name' ) ) ) {
+ $menu[ $key ][0] .= ' '.$count.' ';
+ }
+ }
+ }
+
+ if ( is_array( $submenu ) ) {
+ foreach ( $submenu['users.php'] as $key => $menu_item ) {
+ if ( 0 === strpos( $menu_item[0], _x( 'All Users', 'Admin menu name' ) ) ) {
+ $submenu['users.php'][ $key ][0] .= ' '.$count.' ';
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Setup admin menu
+ */
+ function primary_admin_menu() {
+ $this->pagehook = add_menu_page( __( 'Ultimate Member', 'ultimate-member' ), __( 'Ultimate Member', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ), 'dashicons-admin-users', '42.78578');
+
+ add_action( 'load-' . $this->pagehook, array( &$this, 'on_load_page' ) );
+
+ add_submenu_page( $this->slug, __( 'Dashboard', 'ultimate-member' ), __( 'Dashboard', 'ultimate-member' ), 'manage_options', $this->slug, array( &$this, 'admin_page' ) );
+ }
+
+
+ /**
+ * Secondary admin menu (after settings)
+ */
+ function secondary_menu_items() {
+ add_submenu_page( $this->slug, __( 'Forms', 'ultimate-member' ), __( 'Forms', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_form', '' );
+
+ add_submenu_page( $this->slug, __( 'User Roles', 'ultimate-member' ), __( 'User Roles', 'ultimate-member' ), 'manage_options', 'um_roles', array( &$this, 'um_roles_pages' ) );
+
+ if ( UM()->options()->get( 'members_page' ) ) {
+ add_submenu_page( $this->slug, __( 'Member Directories', 'ultimate-member' ), __( 'Member Directories', 'ultimate-member' ), 'manage_options', 'edit.php?post_type=um_directory', '' );
+ }
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_extend_admin_menu
+ * @description Extend UM menu
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_extend_admin_menu', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_extend_admin_menu' );
+ }
+
+
+ /**
+ * Role page menu callback
+ */
+ function um_roles_pages() {
+ if ( empty( $_GET['tab'] ) ) {
+ include_once um_path . 'includes/admin/core/list-tables/roles-list-table.php';
+ } elseif ( $_GET['tab'] == 'add' || $_GET['tab'] == 'edit' ) {
+ include_once um_path . 'includes/admin/templates/role/role-edit.php';
+ } else {
+ um_js_redirect( add_query_arg( array( 'page' => 'um_roles' ), get_admin_url( 'admin.php' ) ) );
+ }
+ }
+
+
+ /**
+ * Extension menu
+ */
+ function extension_menu() {
+ add_submenu_page( $this->slug, __( 'Extensions', 'ultimate-member' ), '' .__( 'Extensions', 'ultimate-member' ) . ' ', 'manage_options', $this->slug . '-extensions', array( &$this, 'admin_page' ) );
+ }
+
+
+ /**
+ * Load metabox stuff
+ */
+ function on_load_page() {
+ wp_enqueue_script( 'common' );
+ wp_enqueue_script( 'wp-lists' );
+ wp_enqueue_script( 'postbox' );
+
+ /** custom metaboxes for dashboard defined here **/
+ add_meta_box( 'um-metaboxes-contentbox-1', __( 'Users Overview','ultimate-member' ), array( &$this, 'users_overview' ), $this->pagehook, 'core', 'core' );
+
+ add_meta_box( 'um-metaboxes-mainbox-1', __( 'Latest from our blog', 'ultimate-member' ), array( &$this, 'um_news' ), $this->pagehook, 'normal', 'core' );
+
+ add_meta_box( 'um-metaboxes-sidebox-1', __( 'Purge Temp Files', 'ultimate-member' ), array( &$this, 'purge_temp' ), $this->pagehook, 'side', 'core' );
+ add_meta_box( 'um-metaboxes-sidebox-2', __( 'User Cache', 'ultimate-member' ), array( &$this, 'user_cache' ), $this->pagehook, 'side', 'core' );
+
+ if ( $this->language_avaialable_not_installed() ) {
+ add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'dl_language' ), $this->pagehook, 'side', 'core' );
+ } else if ( $this->language_avaialable_installed() ) {
+ add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'up_language' ), $this->pagehook, 'side', 'core' );
+ } else if ( $this->language_not_available() ) {
+ add_meta_box( 'um-metaboxes-sidebox-2', __( 'Language', 'ultimate-member' ), array( &$this, 'ct_language' ), $this->pagehook, 'side', 'core' );
+ }
+ }
+
+
+ /**
+ *
+ */
+ function up_language() {
+ $locale = get_option('WPLANG');
+ include_once UM()->admin()->templates_path . 'dashboard/language-update.php';
+ }
+
+
+ /**
+ *
+ */
+ function dl_language() {
+ $locale = get_option('WPLANG');
+ include_once UM()->admin()->templates_path . 'dashboard/language-download.php';
+ }
+
+
+ /**
+ *
+ */
+ function ct_language() {
+ $locale = get_option('WPLANG');
+ include_once UM()->admin()->templates_path . 'dashboard/language-contrib.php';
+ }
+
+
+ /**
+ *
+ */
+ function um_news() {
+ include_once UM()->admin()->templates_path . 'dashboard/feed.php';
+ }
+
+
+ /**
+ *
+ */
+ function users_overview() {
+ include_once UM()->admin()->templates_path . 'dashboard/users.php';
+ }
+
+
+ /**
+ *
+ */
+ function purge_temp() {
+ include_once UM()->admin()->templates_path . 'dashboard/purge.php';
+ }
+
+
+ /**
+ *
+ */
+ function user_cache() {
+ include_once UM()->admin()->templates_path . 'dashboard/cache.php';
+ }
+
+
+ /**
+ * Language not available
+ *
+ * @return bool
+ */
+ function language_not_available() {
+ $locale = get_option( 'WPLANG' );
+ if ( $locale && !strstr($locale, 'en_') && !isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Language available but not installed
+ *
+ * @return bool
+ */
+ function language_avaialable_not_installed() {
+ $locale = get_option('WPLANG');
+ if ( $locale && isset( UM()->available_languages[$locale] ) && !file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Language available and installed
+ *
+ * @return bool
+ */
+ function language_avaialable_installed() {
+ $locale = get_option('WPLANG');
+ if ( $locale && isset( UM()->available_languages[$locale] ) && file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) )
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Get a directory size
+ *
+ * @param $directory
+ *
+ * @return float|int
+ */
+ function dir_size( $directory ) {
+ if ( $directory == 'temp' ) {
+ $directory = UM()->files()->upload_temp;
+ $size = 0;
+
+ foreach( new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $directory ) ) as $file ) {
+ $size+=$file->getSize();
+ }
+ return round ( $size / 1048576, 2);
+ }
+ return 0;
+ }
+
+
+ /**
+ * Which admin page to show?
+ */
+ function admin_page() {
- /***
- *** @which admin page to show?
- ***/
- function admin_page() {
+ $page = $_REQUEST['page'];
+ if ( $page == 'ultimatemember' && ! isset( $_REQUEST['um-addon'] ) ) { ?>
+
+
';
- wp_editor( '', 'um_editor_edit', $settings );
- echo '
';
-
- echo '';
- wp_editor( '', 'um_editor_new', $settings );
- echo '
';
-
- $this->is_loaded = true;
- }
-
- }
- /***
- *** @Show field input for edit
- ***/
- function field_input( $attribute, $form_id = null, $field_args = array() ) {
- if ( $this->in_edit == true ) { // we're editing a field
- $real_attr = substr( $attribute, 1 );
- $this->edit_mode_value = (isset( $this->edit_array[ $real_attr ] ) ) ? $this->edit_array[ $real_attr ] : null;
- }
+ /**
+ * Class Admin_Metabox
+ * @package um\admin\core
+ */
+ class Admin_Metabox {
+
+
+ /**
+ * @var bool
+ */
+ private $form_nonce_added = false;
+
+
+ /**
+ * Admin_Metabox constructor.
+ */
+ function __construct() {
+
+ $this->slug = 'ultimatemember';
+
+ $this->in_edit = false;
+ $this->edit_mode_value = null;
+
+ add_action('admin_head', array(&$this, 'admin_head'), 9);
+ add_action('admin_footer', array(&$this, 'load_modal_content'), 9);
+
+ add_action( 'load-post.php', array(&$this, 'add_metabox'), 9 );
+ add_action( 'load-post-new.php', array(&$this, 'add_metabox'), 9 );
+
+ add_action( 'admin_init', array(&$this, 'add_taxonomy_metabox'), 9 );
+
+ //roles metaboxes
+ add_action( 'um_roles_add_meta_boxes', array( &$this, 'add_metabox_role' ) );
+ }
+
+
+ /**
+ * Boolean check if we're viewing UM backend
+ *
+ * @return bool
+ */
+ function is_UM_admin() {
+ global $current_screen;
+ $screen_id = $current_screen->id;
+ if ( is_admin() && ( strstr( $screen_id, 'ultimatemember') || strstr( $screen_id, 'um_') || strstr($screen_id, 'user') || strstr($screen_id, 'profile') ) )
+ return true;
+ return false;
+ }
+
+
+ /**
+ * Gets the role meta
+ *
+ * @param $id
+ *
+ * @return mixed
+ */
+ function get_custom_post_meta( $id ) {
+ $all_meta = get_post_custom( $id );
+ foreach ( $all_meta as $k => $v ) {
+ if ( strstr( $k, '_um_' ) ) {
+ $um_meta[ $k ] = $v;
+ }
+ }
+ if ( isset( $um_meta ) ) {
+ return $um_meta;
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Runs on admin head
+ */
+ function admin_head(){
+ global $post;
+ if ( UM()->admin()->is_plugin_post_type() && isset($post->ID) ){
+ $this->postmeta = $this->get_custom_post_meta($post->ID);
+ }
+ }
+
+
+ /**
+ * Init the metaboxes
+ */
+ function add_metabox() {
+ global $current_screen;
+
+ if ( $current_screen->id == 'um_form' ) {
+ add_action( 'add_meta_boxes', array(&$this, 'add_metabox_form'), 1 );
+ add_action( 'save_post', array(&$this, 'save_metabox_form'), 10, 2 );
+ }
+
+ if ( $current_screen->id == 'um_directory' ) {
+ add_action( 'add_meta_boxes', array(&$this, 'add_metabox_directory'), 1 );
+ add_action( 'save_post', array(&$this, 'save_metabox_directory'), 10, 2 );
+ }
+
+ //restrict content metabox
+ $post_types = UM()->options()->get( 'restricted_access_post_metabox' );
+ if ( ! empty( $post_types[ $current_screen->id ] ) ) {
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_restrict_content_hide_metabox
+ * @description Show/Hide Restrict content metabox
+ * @input_vars
+ * [{"var":"$show","type":"bool","desc":"Show Metabox"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_restrict_content_hide_metabox', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $hide_metabox = apply_filters( 'um_restrict_content_hide_metabox', false );
+
+ if ( ! $hide_metabox ) {
+ add_action( 'add_meta_boxes', array(&$this, 'add_metabox_restrict_content'), 1 );
+ add_action( 'save_post', array( &$this, 'save_metabox_restrict_content' ), 10, 2 );
+ }
+
+ if ( $current_screen->id == 'attachment' ) {
+ add_action( 'add_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
+ add_action( 'edit_attachment', array( &$this, 'save_attachment_metabox_restrict_content' ), 10, 2 );
+ }
+ }
+
+
+ add_action( 'save_post', array( &$this, 'save_metabox_custom' ), 10, 2 );
+ }
+
+
+ /**
+ * @param $post_id
+ * @param $post
+ *
+ * @return mixed
+ */
+ function save_metabox_custom( $post_id, $post ) {
+ // validate nonce
+ if ( ! isset( $_POST['um_admin_save_metabox_custom_nonce'] ) ||
+ ! wp_verify_nonce( $_POST['um_admin_save_metabox_custom_nonce'], basename( __FILE__ ) ) ) {
+ return $post_id;
+ }
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_custom_restrict_content_metaboxes
+ * @description Save metabox custom with restrict content
+ * @input_vars
+ * [{"var":"$post_id","type":"int","desc":"Post ID"},
+ * {"var":"$post","type":"array","desc":"Post data"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_custom_restrict_content_metaboxes', $post_id, $post );
+ }
+
+
+ /**
+ *
+ */
+ function add_metabox_restrict_content() {
+ global $current_screen;
+
+ add_meta_box(
+ 'um-admin-restrict-content',
+ __( 'UM Content Restriction', 'ultimate-member' ),
+ array( &$this, 'restrict_content_cb' ),
+ $current_screen->id,
+ 'normal',
+ 'default'
+ );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_custom_restrict_content_metaboxes
+ * @description Add restrict content custom metabox
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_custom_restrict_content_metaboxes', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_custom_restrict_content_metaboxes' );
+ }
+
+
+ /**
+ * Content restriction metabox
+ *
+ * @param $object
+ * @param $box
+ */
+ function restrict_content_cb( $object, $box ) {
+ include_once UM()->admin()->templates_path . 'access/restrict_content.php';
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_restrict_content_nonce' );
+ }
+
+
+ /**
+ * Init the metaboxes
+ */
+ function add_taxonomy_metabox() {
+ //restrict content metabox
+ $all_taxonomies = get_taxonomies( array( 'public' => true ) );
+ $tax_types = UM()->options()->get( 'restricted_access_taxonomy_metabox' );
+ $exclude_taxonomies = UM()->excluded_taxonomies();
+
+ foreach ( $all_taxonomies as $key => $taxonomy ) {
+ if ( in_array( $key, $exclude_taxonomies ) || empty( $tax_types[$key] ) )
+ continue;
+
+ add_action( $taxonomy . '_add_form_fields', array( &$this, 'um_category_access_fields_create' ) );
+ add_action( $taxonomy . '_edit_form_fields', array( &$this, 'um_category_access_fields_edit' ) );
+ add_action( 'create_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
+ add_action( 'edited_' . $taxonomy, array( &$this, 'um_category_access_fields_save' ) );
+ }
+ }
+
+
+ /**
+ * @param $post_id
+ * @param $post
+ *
+ * @return mixed
+ */
+ function save_metabox_restrict_content( $post_id, $post ) {
+ // validate nonce
+ if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) ) {
+ return $post_id;
+ }
+
+ // validate user
+ $post_type = get_post_type_object( $post->post_type );
+ if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
+ return $post_id;
+ }
+
+ if ( ! empty( $_POST['um_content_restriction'] ) ) {
+ update_post_meta( $post_id, 'um_content_restriction', $_POST['um_content_restriction'] );
+ } else {
+ delete_post_meta( $post_id, 'um_content_restriction' );
+ }
+
+ return $post_id;
+ }
+
+
+ /**
+ * @param $post_id
+ *
+ * @return mixed
+ */
+ function save_attachment_metabox_restrict_content( $post_id ) {
+ // validate nonce
+ if ( ! isset( $_POST['um_admin_save_metabox_restrict_content_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_restrict_content_nonce'], basename( __FILE__ ) ) )
+ return $post_id;
+
+ $post = get_post( $post_id );
+
+ // validate user
+ $post_type = get_post_type_object( $post->post_type );
+ if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) ) {
+ return $post_id;
+ }
+
+ if ( ! empty( $_POST['um_content_restriction'] ) ) {
+ update_post_meta( $post_id, 'um_content_restriction', $_POST['um_content_restriction'] );
+ } else {
+ delete_post_meta( $post_id, 'um_content_restriction' );
+ }
+
+ return $post_id;
+ }
+
+
+ /**
+ *
+ */
+ function um_category_access_fields_create() {
+ $data = array();
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_category_access_settings_fields
+ * @description Settings fields for terms
+ * @input_vars
+ * [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
+ * {"var":"$data","type":"array","desc":"Settings Data"},
+ * {"var":"$screen","type":"string","desc":"Category Screen"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
+ * @example
+ * 'my-field-key',
+ * 'type' => 'my-field-type',
+ * 'label' => __( 'My field Label', 'ultimate-member' ),
+ * 'description' => __( 'My Field Description', 'ultimate-member' ),
+ * 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
+ * );
+ * return $access_settings_fields;
+ * }
+ * ?>
+ */
+ $fields = apply_filters( 'um_admin_category_access_settings_fields', array(
+ array(
+ 'id' => '_um_custom_access_settings',
+ 'type' => 'checkbox',
+ 'label' => __( 'Restrict access to this content?', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
+ ),
+ array(
+ 'id' => '_um_accessible',
+ 'type' => 'select',
+ 'label' => __( 'Who can access this content?', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
+ 'options' => array(
+ '0' => __( 'Everyone', 'ultimate-member' ),
+ '1' => __( 'Logged out users', 'ultimate-member' ),
+ '2' => __( 'Logged in users', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_custom_access_settings', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_roles',
+ 'type' => 'multi_checkbox',
+ 'label' => __( 'Select which roles can access this content', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ),
+ 'columns' => 3,
+ 'conditional' => array( '_um_accessible', '=', '2' )
+ ),
+ array(
+ 'id' => '_um_noaccess_action',
+ 'type' => 'select',
+ 'label' => __( 'What happens when users without access tries to view the content?', 'ultimate-member' ),
+ 'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
+ 'options' => array(
+ '0' => __( 'Show access restricted message', 'ultimate-member' ),
+ '1' => __( 'Redirect user', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_by_custom_message',
+ 'type' => 'select',
+ 'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
+ 'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
+ 'options' => array(
+ '0' => __( 'Global default message (default)', 'ultimate-member' ),
+ '1' => __( 'Custom message', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_noaccess_action', '=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_custom_message',
+ 'type' => 'wp_editor',
+ 'label' => __( 'Custom Restrict Content message', 'ultimate-member' ),
+ 'description' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
+ 'conditional' => array( '_um_restrict_by_custom_message', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_redirect',
+ 'type' => 'select',
+ 'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
+ 'description' => __( 'Select redirect to page when user hasn\'t access to content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
+ 'conditional' => array( '_um_noaccess_action', '=', '1' ),
+ 'options' => array(
+ '0' => __( 'Login page', 'ultimate-member' ),
+ '1' => __( 'Custom URL', 'ultimate-member' ),
+ ),
+ ),
+ array(
+ 'id' => '_um_access_redirect_url',
+ 'type' => 'text',
+ 'label' => __( 'Redirect URL', 'ultimate-member' ),
+ 'description' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
+ 'conditional' => array( '_um_access_redirect', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_hide_from_queries',
+ 'type' => 'checkbox',
+ 'label' => __( 'Hide from queries', 'ultimate-member' ),
+ 'description' => __( 'Hide this content from archives, RSS feeds etc for users who do not have permission to view this content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ )
+ ), $data, 'create' );
+
+ UM()->admin_forms( array(
+ 'class' => 'um-restrict-content um-third-column',
+ 'prefix_id' => 'um_content_restriction',
+ 'without_wrapper' => true,
+ 'div_line' => true,
+ 'fields' => $fields
+ ) )->render_form();
+
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
+ }
+
+
+ /**
+ * @param $term
+ */
+ function um_category_access_fields_edit( $term ) {
+ $termID = $term->term_id;
+
+ $data = get_term_meta( $termID, 'um_content_restriction', true );
+
+ $_um_access_roles_value = array();
+ if ( ! empty( $data['_um_access_roles'] ) ) {
+ foreach ( $data['_um_access_roles'] as $key => $value ) {
+ if ( $value )
+ $_um_access_roles_value[] = $key;
+ }
+ }
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_category_access_settings_fields
+ * @description Settings fields for terms
+ * @input_vars
+ * [{"var":"$access_settings_fields","type":"array","desc":"Settings Fields"},
+ * {"var":"$data","type":"array","desc":"Settings Data"},
+ * {"var":"$screen","type":"string","desc":"Category Screen"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_category_access_settings_fields', 'function_name', 10, 3 );
+ * @example
+ * 'my-field-key',
+ * 'type' => 'my-field-type',
+ * 'label' => __( 'My field Label', 'ultimate-member' ),
+ * 'description' => __( 'My Field Description', 'ultimate-member' ),
+ * 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
+ * );
+ * return $access_settings_fields;
+ * }
+ * ?>
+ */
+ $fields = apply_filters( 'um_admin_category_access_settings_fields', array(
+ array(
+ 'id' => '_um_custom_access_settings',
+ 'type' => 'checkbox',
+ 'class' => 'form-field',
+ 'label' => __( 'Restrict access to this content?', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
+ ),
+ array(
+ 'id' => '_um_accessible',
+ 'type' => 'select',
+ 'class' => 'form-field',
+ 'label' => __( 'Who can access this content?', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
+ 'options' => array(
+ '0' => __( 'Everyone', 'ultimate-member' ),
+ '1' => __( 'Logged out users', 'ultimate-member' ),
+ '2' => __( 'Logged in users', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_custom_access_settings', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_roles',
+ 'type' => 'multi_checkbox',
+ 'class' => 'form-field',
+ 'label' => __( 'Select which roles can access this content', 'ultimate-member' ),
+ 'description' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => $_um_access_roles_value,
+ 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ),
+ 'columns' => 3,
+ 'conditional' => array( '_um_accessible', '=', '2' )
+ ),
+ array(
+ 'id' => '_um_noaccess_action',
+ 'type' => 'select',
+ 'class' => 'form-field',
+ 'label' => __( 'What happens when users without access tries to view the content?', 'ultimate-member' ),
+ 'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
+ 'options' => array(
+ '0' => __( 'Show access restricted message', 'ultimate-member' ),
+ '1' => __( 'Redirect user', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_by_custom_message',
+ 'type' => 'select',
+ 'class' => 'form-field',
+ 'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
+ 'description' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
+ 'options' => array(
+ '0' => __( 'Global default message (default)', 'ultimate-member' ),
+ '1' => __( 'Custom message', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_noaccess_action', '=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_custom_message',
+ 'type' => 'wp_editor',
+ 'class' => 'form-field',
+ 'label' => __( 'Custom Restrict Content message', 'ultimate-member' ),
+ 'description' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
+ 'conditional' => array( '_um_restrict_by_custom_message', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_redirect',
+ 'type' => 'select',
+ 'class' => 'form-field',
+ 'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
+ 'description' => __( 'Select redirect to page when user hasn\'t access to content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
+ 'conditional' => array( '_um_noaccess_action', '=', '1' ),
+ 'options' => array(
+ '0' => __( 'Login page', 'ultimate-member' ),
+ '1' => __( 'Custom URL', 'ultimate-member' ),
+ ),
+ ),
+ array(
+ 'id' => '_um_access_redirect_url',
+ 'type' => 'text',
+ 'class' => 'form-field',
+ 'label' => __( 'Redirect URL', 'ultimate-member' ),
+ 'description' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
+ 'conditional' => array( '_um_access_redirect', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_hide_from_queries',
+ 'type' => 'checkbox',
+ 'class' => 'form-field',
+ 'label' => __( 'Hide from queries', 'ultimate-member' ),
+ 'description' => __( 'Hide this content from archives, RSS feeds etc for users who do not have permission to view this content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ )
+ ), $data, 'edit' );
+
+ UM()->admin_forms( array(
+ 'class' => 'um-restrict-content um-third-column',
+ 'prefix_id' => 'um_content_restriction',
+ 'without_wrapper' => true,
+ 'fields' => $fields
+ ) )->render_form();
+
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_taxonomy_restrict_content_nonce' );
+ }
+
+
+ /**
+ * @param $termID
+ *
+ * @return mixed
+ */
+ function um_category_access_fields_save( $termID ) {
+
+ // validate nonce
+ if ( ! isset( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'] ) || ! wp_verify_nonce( $_REQUEST['um_admin_save_taxonomy_restrict_content_nonce'], basename( __FILE__ ) ) )
+ return $termID;
+
+ // validate user
+ $term = get_term( $termID );
+ $taxonomy = get_taxonomy( $term->taxonomy );
+
+ if ( ! current_user_can( $taxonomy->cap->edit_terms, $termID ) )
+ return $termID;
+
+ if ( ! empty( $_REQUEST['um_content_restriction'] ) ) {
+ update_term_meta( $termID, 'um_content_restriction', $_REQUEST['um_content_restriction'] );
+ } else {
+ delete_term_meta( $termID, 'um_content_restriction' );
+ }
+
+ return $termID;
+ }
+
+
+ /**
+ * Load a directory metabox
+ *
+ * @param $object
+ * @param $box
+ */
+ function load_metabox_directory( $object, $box ) {
+ $box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
+ include_once UM()->admin()->templates_path . 'directory/'. $box['id'] . '.php';
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_directory_nonce' );
+ }
+
+
+ /**
+ * Load a role metabox
+ *
+ * @param $object
+ * @param $box
+ */
+ function load_metabox_role( $object, $box ) {
+ global $post;
+
+ $box['id'] = str_replace( 'um-admin-form-', '', $box['id'] );
+
+ if ( $box['id'] == 'builder' ) {
+ UM()->builder()->form_id = get_the_ID();
+ }
+
+ preg_match('#\{.*?\}#s', $box['id'], $matches);
+
+ if ( isset($matches[0]) ){
+ $path = $matches[0];
+ $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
+ } else {
+ $path = um_path;
+ }
+
+ $path = str_replace('{','', $path );
+ $path = str_replace('}','', $path );
+
+ include_once $path . 'includes/admin/templates/role/'. $box['id'] . '.php';
+ //wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_role_nonce' );
+ }
+
+
+ /**
+ * Load a form metabox
+ *
+ * @param $object
+ * @param $box
+ */
+ function load_metabox_form( $object, $box ) {
+ global $post;
+
+ $box['id'] = str_replace( 'um-admin-form-','', $box['id'] );
+
+ if ( $box['id'] == 'builder' ) {
+ UM()->builder()->form_id = get_the_ID();
+ }
+
+ preg_match('#\{.*?\}#s', $box['id'], $matches);
+
+ if ( isset( $matches[0] ) ) {
+ $path = $matches[0];
+ $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
+ } else {
+ $path = um_path;
+ }
+
+ $path = str_replace('{','', $path );
+ $path = str_replace('}','', $path );
+
+ include_once $path . 'includes/admin/templates/form/'. $box['id'] . '.php';
+
+ if ( ! $this->form_nonce_added ) {
+ $this->form_nonce_added = true;
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_form_nonce' );
+ }
+ }
+
+
+ /**
+ * Load admin custom metabox
+ *
+ * @param $object
+ * @param $box
+ */
+ function load_metabox_custom( $object, $box ) {
+ global $post;
+
+ $box['id'] = str_replace('um-admin-custom-','', $box['id']);
+
+ preg_match('#\{.*?\}#s', $box['id'], $matches);
+
+ if ( isset($matches[0]) ){
+ $path = $matches[0];
+ $box['id'] = preg_replace('~(\\{[^}]+\\})~','', $box['id'] );
+ } else {
+ $path = um_path;
+ }
+
+ $path = str_replace('{','', $path );
+ $path = str_replace('}','', $path );
+
+ include_once $path . 'includes/admin/templates/'. $box['id'] . '.php';
+ wp_nonce_field( basename( __FILE__ ), 'um_admin_save_metabox_custom_nonce' );
+ }
+
+
+ /**
+ * Add directory metabox
+ */
+ function add_metabox_directory() {
+ add_meta_box( 'um-admin-form-general', __( 'General Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-profile', __( 'Profile Card', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-search', __( 'Search Options', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-pagination', __( 'Results & Pagination', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_directory' ), 'um_directory', 'side', 'default' );
+ add_meta_box( 'um-admin-form-appearance', __( 'Styling: General', 'ultimate-member' ), array( &$this, 'load_metabox_directory'), 'um_directory', 'side', 'default' );
+ }
+
+
+ /**
+ * Add role metabox
+ */
+ function add_metabox_role() {
+ $callback = array( &$this, 'load_metabox_role' );
+
+ $roles_metaboxes = array(
+ array(
+ 'id' => 'um-admin-form-admin-permissions',
+ 'title' => __( 'Administrative Permissions', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-general',
+ 'title' => __( 'General Permissions', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-profile',
+ 'title' => __( 'Profile Access', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ )
+ );
+
+ if ( ! isset( $_GET['id'] ) || 'administrator' != $_GET['id'] ) {
+ $roles_metaboxes[] = array(
+ 'id' => 'um-admin-form-home',
+ 'title' => __( 'Homepage Options', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ );
+ }
+
+ $roles_metaboxes = array_merge( $roles_metaboxes, array(
+ array(
+ 'id' => 'um-admin-form-register',
+ 'title' => __( 'Registration Options', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-login',
+ 'title' => __( 'Login Options', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-logout',
+ 'title' => __( 'Logout Options', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-delete',
+ 'title' => __( 'Delete Options', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ ),
+ array(
+ 'id' => 'um-admin-form-publish',
+ 'title' => __( 'Publish', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'side',
+ 'priority' => 'default'
+ )
+ ) );
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_role_metaboxes
+ * @description Extend metaboxes at Add/Edit User Role
+ * @input_vars
+ * [{"var":"$roles_metaboxes","type":"array","desc":"Metaboxes at Add/Edit UM Role"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_role_metaboxes', 'function_name', 10, 1 );
+ * @example
+ * 'um-admin-form-your-custom',
+ * 'title' => __( 'My Roles Metabox', 'ultimate-member' ),
+ * 'callback' => 'my-metabox-callback',
+ * 'screen' => 'um_role_meta',
+ * 'context' => 'side',
+ * 'priority' => 'default'
+ * );
+ *
+ * return $roles_metaboxes;
+ * }
+ * ?>
+ */
+ $roles_metaboxes = apply_filters( 'um_admin_role_metaboxes', $roles_metaboxes );
+
+ $wp_caps_metabox = false;
+ if ( ! empty( $_GET['id'] ) ) {
+ $data = get_option( "um_role_{$_GET['id']}_meta" );
+ if ( ! empty( $data['_um_is_custom'] ) )
+ $wp_caps_metabox = true;
+ }
+ if ( 'add' == $_GET['tab'] || $wp_caps_metabox ) {
+ $roles_metaboxes[] = array(
+ 'id' => 'um-admin-form-wp-capabilities',
+ 'title' => __( 'WP Capabilities', 'ultimate-member' ),
+ 'callback' => $callback,
+ 'screen' => 'um_role_meta',
+ 'context' => 'normal',
+ 'priority' => 'default'
+ );
+ }
+
+
+ foreach ( $roles_metaboxes as $metabox ) {
+ add_meta_box(
+ $metabox['id'],
+ $metabox['title'],
+ $metabox['callback'],
+ $metabox['screen'],
+ $metabox['context'],
+ $metabox['priority']
+ );
+ }
+ }
+
+
+ /**
+ * Add form metabox
+ */
+ function add_metabox_form() {
+
+ add_meta_box( 'um-admin-form-mode', __( 'Select Form Type', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-builder', __( 'Form Builder', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'normal', 'default' );
+ add_meta_box( 'um-admin-form-shortcode', __( 'Shortcode', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+
+ add_meta_box( 'um-admin-form-register_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_custom_register_metaboxes
+ * @description Add custom metaboxes for register form
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_custom_register_metaboxes', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_custom_register_metaboxes' );
+
+ add_meta_box( 'um-admin-form-profile_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+ add_meta_box( 'um-admin-form-profile_settings', __( 'User Meta', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_custom_profile_metaboxes
+ * @description Add custom metaboxes for profile form
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_custom_profile_metaboxes', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_custom_profile_metaboxes' );
+
+ add_meta_box( 'um-admin-form-login_customize', __( 'Customize this form', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+ add_meta_box( 'um-admin-form-login_settings', __( 'Options', 'ultimate-member' ), array( &$this, 'load_metabox_form' ), 'um_form', 'side', 'default' );
+
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_custom_login_metaboxes
+ * @description Add custom metaboxes for login form
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_custom_login_metaboxes', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_custom_login_metaboxes' );
+ }
+
+
+ /**
+ * Save directory metabox
+ *
+ * @param $post_id
+ * @param $post
+ *
+ * @return mixed
+ */
+ function save_metabox_directory( $post_id, $post ) {
+ global $wpdb;
+
+ // validate nonce
+ if ( !isset( $_POST['um_admin_save_metabox_directory_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_directory_nonce'], basename( __FILE__ ) ) ) return $post_id;
+
+ // validate post type
+ if ( $post->post_type != 'um_directory' ) return $post_id;
+
+ // validate user
+ $post_type = get_post_type_object( $post->post_type );
+ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id;
+
+ $where = array( 'ID' => $post_id );
+
+ if ( empty( $_POST['post_title'] ) )
+ $_POST['post_title'] = 'Directory #'.$post_id;
+
+ $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'] ), $where );
+
+ // save
+ delete_post_meta( $post_id, '_um_roles' );
+ delete_post_meta( $post_id, '_um_tagline_fields' );
+ delete_post_meta( $post_id, '_um_reveal_fields' );
+ delete_post_meta( $post_id, '_um_search_fields' );
+ delete_post_meta( $post_id, '_um_roles_can_search' );
+ delete_post_meta( $post_id, '_um_show_these_users' );
+
+ //save metadata
+ foreach ( $_POST['um_metadata'] as $k => $v ) {
+ if ( $k == '_um_show_these_users' && trim( $_POST['um_metadata'][ $k ] ) ) {
+ $v = preg_split( '/[\r\n]+/', $v, -1, PREG_SPLIT_NO_EMPTY );
+ }
+ if ( strstr( $k, '_um_' ) ) {
+ update_post_meta( $post_id, $k, $v );
+ }
+ }
+ }
+
+
+ /**
+ * Save form metabox
+ *
+ * @param $post_id
+ * @param $post
+ *
+ * @return mixed
+ */
+ function save_metabox_form( $post_id, $post ) {
+ global $wpdb;
+
+ // validate nonce
+ if ( !isset( $_POST['um_admin_save_metabox_form_nonce'] ) || !wp_verify_nonce( $_POST['um_admin_save_metabox_form_nonce'], basename( __FILE__ ) ) ) return $post_id;
+
+ // validate post type
+ if ( $post->post_type != 'um_form' ) return $post_id;
+
+ // validate user
+ $post_type = get_post_type_object( $post->post_type );
+ if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) return $post_id;
+
+ $where = array( 'ID' => $post_id );
+ if ( empty( $_POST['post_title'] ) ) $_POST['post_title'] = 'Form #' . $post_id;
+ $wpdb->update( $wpdb->posts, array( 'post_title' => $_POST['post_title'] ), $where );
+
+ // save
+ delete_post_meta( $post_id, '_um_profile_metafields' );
+ foreach ( $_POST['form'] as $k => $v ) {
+ if ( strstr( $k, '_um_' ) ){
+ update_post_meta( $post_id, $k, $v);
+ }
+ }
+
+ }
+
+
+ /**
+ * Load modal content
+ */
+ function load_modal_content() {
+
+ $screen = get_current_screen();
+ if ( $this->is_UM_admin() ) {
+ foreach ( glob( um_path . 'includes/admin/templates/modal/*.php' ) as $modal_content ) {
+ include_once $modal_content;
+ }
+ }
+
+ // needed on forms only
+ if ( ! isset( $this->is_loaded ) && isset( $screen->id ) && strstr( $screen->id, 'um_form' ) ) {
+ $settings['textarea_rows'] = 8;
+
+ echo '
-
-
+
Can user edit this field? tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field.', 'ultimate-member' ) ); ?>
+
+ edit_mode_value || $this->edit_mode_value ) ?> />
+
-
- case '_required':
+ set_field_type == 'password' )
- $def_required = 1;
- else
- $def_required = 0;
+ case '_number':
+ ?>
- ?>
+
Rating System tooltip( __( 'Choose whether you want a 5-stars or 10-stars ratings based here.', 'ultimate-member' ) ); ?>
+
+ edit_mode_value ); ?>>5 stars rating system
+ edit_mode_value ); ?>>10 stars rating system
+
+
-
+ Is this field required? tooltip( __( 'This option allows you to set whether the field must be filled in before the form can be processed.', 'ultimate-member' ) ); ?>
- edit_mode_value ) ? $this->edit_mode_value : $def_required ) ?> />
-
+ case '_custom_dropdown_options_source':
+ ?>
-
+
Choices Callbacktooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?>
+
+
-
-
+ case '_parent_dropdown_relationship':
+ ?>
-
Can user edit this field? tooltip( __( 'This option allows you to set whether or not the user can edit the information in this field.', 'ultimate-member' ) ); ?>
-
- edit_mode_value || $this->edit_mode_value ) ?> />
-
+
tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?>
+
+
-
+ builtin()->custom_fields ) {
+ foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
+ if ( in_array( $array['type'], array( 'select' ) ) && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) ) {
+ echo "
edit_mode_value ).">".$array['title']." ";
+ }
+ }
+ } ?>
+
+
-
-
Rating System tooltip( __( 'Choose whether you want a 5-stars or 10-stars ratings based here.', 'ultimate-member' ) ); ?>
-
- edit_mode_value ); ?>>5 stars rating system
- edit_mode_value ); ?>>10 stars rating system
-
-
+ }
-
-
-
Choices Callbacktooltip( __( 'Add a callback source to retrieve choices.', 'ultimate-member' ) ); ?>
-
-
-
-
-
-
tooltip( __( 'Dynamically populates the option based from selected parent option.', 'ultimate-member' ) ); ?>
-
-
-
- builtin()->custom_fields ) {
- foreach ( UM()->builtin()->custom_fields as $field_key => $array ) {
- if ( in_array( $array['type'], array( 'select' ) ) && ( ! isset( $field_args['metakey'] ) || $field_args['metakey'] != $array['metakey'] ) ) {
- echo "edit_mode_value ).">".$array['title']." ";
- }
- }
- } ?>
-
-
-
- files()->upload_basedir;
+ $path = str_replace( '/uploads/ultimatemember', '', $path );
+ $path = $path . '/languages/plugins/';
+ $path = str_replace( '//', '/', $path );
- /***
- *** @to store plugin languages
- ***/
- function create_languages_folder() {
-
- $path = UM()->files()->upload_basedir;
- $path = str_replace('/uploads/ultimatemember','',$path);
- $path = $path . '/languages/plugins/';
- $path = str_replace('//','/',$path);
-
- if ( !file_exists( $path ) ) {
- $old = umask(0);
- @mkdir( $path, 0777, true);
- umask($old);
- }
-
- }
+ if ( ! file_exists( $path ) ) {
+ $old = umask(0);
+ @mkdir( $path, 0777, true );
+ umask( $old );
+ }
+ }
/**
* Show main notices
*/
- function main_notices() {
+ function main_notices() {
- if ( ! defined( 'DOING_AJAX' ) ) {
+ if ( ! defined( 'DOING_AJAX' ) ) {
- $hide_exif_notice = get_option( 'um_hide_exif_notice' );
+ $hide_exif_notice = get_option( 'um_hide_exif_notice' );
- if ( !extension_loaded('exif') && !$hide_exif_notice ) {
+ if ( !extension_loaded('exif') && !$hide_exif_notice ) {
- echo '
';
+ echo '
';
- echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. Hide this notice ', 'ultimate-member' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') );
+ echo sprintf(__( 'Exif is not enabled on your server. Mobile photo uploads will not be rotated correctly until you enable the exif extension. Hide this notice ', 'ultimate-member' ), add_query_arg('um_adm_action', 'um_hide_exif_notice') );
- echo '
';
+ echo '
';
- }
+ }
- // Regarding page setup
- $pages = UM()->config()->permalinks;
- if ( $pages && is_array( $pages ) ) {
+ // Regarding page setup
+ $pages = UM()->config()->permalinks;
+ if ( $pages && is_array( $pages ) ) {
- $err = false;
+ $err = false;
- foreach( $pages as $slug => $page_id ) {
+ foreach( $pages as $slug => $page_id ) {
- $page = get_post( $page_id );
+ $page = get_post( $page_id );
- if ( !isset( $page->ID ) && in_array( $slug, array( 'user','account','members','register','login','logout','password-reset' ) ) ) {
- $err = true;
- }
+ if ( !isset( $page->ID ) && in_array( $slug, array( 'user','account','members','register','login','logout','password-reset' ) ) ) {
+ $err = true;
+ }
- }
+ }
- if ( $err ) {
- echo '
' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit Ultimate Member > Settings to re-assign your missing pages.','ultimate-member') . '
';
- }
+ if ( $err ) {
+ echo '
' . __('One or more of your Ultimate Member pages are not correctly setup. Please visit Ultimate Member > Settings to re-assign your missing pages.','ultimate-member') . '
';
+ }
- if ( isset( $pages['user'] ) ) {
- $test = get_post( $pages['user'] );
- if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
- echo '
' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimate-member') . '
';
- }
- }
+ if ( isset( $pages['user'] ) ) {
+ $test = get_post( $pages['user'] );
+ if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
+ echo '
' . __('Ultimate Member Setup Error: User page can not be a child page.','ultimate-member') . '
';
+ }
+ }
- if ( isset( $pages['account'] ) ) {
- $test = get_post( $pages['account'] );
- if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
- echo '
' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimate-member') . '
';
- }
- }
+ if ( isset( $pages['account'] ) ) {
+ $test = get_post( $pages['account'] );
+ if ( isset( $test->post_parent ) && $test->post_parent > 0 ) {
+ echo '
' . __('Ultimate Member Setup Error: Account page can not be a child page.','ultimate-member') . '
';
+ }
+ }
- }
+ }
- /**
- * UM hook
- *
- * @type action
- * @title um_admin_after_main_notices
- * @description Insert some content after main admin notices
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_admin_after_main_notices', 'function_name', 10 );
- * @example
- *
- */
- do_action( 'um_admin_after_main_notices' );
- }
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_after_main_notices
+ * @description Insert some content after main admin notices
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_after_main_notices', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( 'um_admin_after_main_notices' );
+ }
- }
+ }
- /***
- *** @localization notice
- ***/
- function localize_note() {
- $locale = get_option('WPLANG');
- if ( !$locale ) return;
- if ( strstr( $locale, 'en_' ) ) return; // really, english!
- if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) return;
+ /**
+ * Localization notice
+ */
+ function localize_note() {
+ $locale = get_option( 'WPLANG' );
+ if ( ! $locale || strstr( $locale, 'en_' ) ) {
+ return;
+ }
+ if ( file_exists( WP_LANG_DIR . '/plugins/ultimatemember-' . $locale . '.mo' ) ) {
+ return;
+ }
- if ( isset( UM()->available_languages[ $locale ] ) ) {
+ $hide_locale_notice = get_option( 'um_hide_locale_notice' );
+ if ( $hide_locale_notice ) {
+ return;
+ }
- $download_uri = add_query_arg('um_adm_action', 'um_language_downloader');
+ if ( isset( UM()->available_languages[ $locale ] ) ) {
- $hide_locale_notice = get_option('um_hide_locale_notice');
- if ( !$hide_locale_notice ) {
- echo '
';
+ $download_uri = add_query_arg( 'um_adm_action', 'um_language_downloader' );
- echo sprintf(__('Your site language is %1$s . Good news! Ultimate Member is already available in %2$s language . Download the translation files and start using the plugin in your language now. Hide this notice ','ultimate-member'), $locale, UM()->available_languages[$locale], $download_uri, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
+ echo '
';
- }
+ echo sprintf(__('Your site language is
%1$s . Good news! Ultimate Member is already available in
%2$s language .
Download the translation files and start using the plugin in your language now.
Hide this notice ','ultimate-member'), $locale, UM()->available_languages[$locale], $download_uri, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
+
+ echo '
';
- } else {
+ } else {
- $hide_locale_notice = get_option('um_hide_locale_notice');
- if ( !$hide_locale_notice ) {
- echo '
';
+ echo '
';
- echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: %1$s . If you have translated the plugin you need put these files ultimatemember-%1$s.po and ultimatemember-%1$s.mo in /wp-content/languages/plugins/ for the plugin to be translated in your language. Hide this notice ','ultimate-member'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
+ echo sprintf(__('Ultimate Member has not yet been translated to your langeuage: %1$s . If you have translated the plugin you need put these files ultimatemember-%1$s.po and ultimatemember-%1$s.mo in /wp-content/languages/plugins/ for the plugin to be translated in your language. Hide this notice ','ultimate-member'), $locale, add_query_arg('um_adm_action', 'um_hide_locale_notice') );
- echo '
';
+ echo '
';
- }
+ }
- }
+ }
- }
- /***
- *** @updating users
- ***/
- function show_update_messages(){
+ /**
+ * Updating users
+ */
+ function show_update_messages() {
- if ( !isset($_REQUEST['update']) ) return;
+ if ( ! isset( $_REQUEST['update'] ) ) {
+ return;
+ }
- $update = $_REQUEST['update'];
- switch($update) {
+ $update = $_REQUEST['update'];
+ switch( $update ) {
- case 'confirm_delete':
- $confirm_uri = admin_url('users.php?' . http_build_query(array(
- 'um_adm_action' => 'delete_users',
- 'user' => array_map('intval', (array) $_REQUEST['user']),
- 'confirm' => 1
- )));
- $users = '';
+ case 'confirm_delete':
+ $confirm_uri = admin_url( 'users.php?' . http_build_query( array(
+ 'um_adm_action' => 'delete_users',
+ 'user' => array_map( 'intval', (array) $_REQUEST['user'] ),
+ 'confirm' => 1
+ ) ) );
+ $users = '';
- if( isset( $_REQUEST['user'] ) ){
- foreach( $_REQUEST['user'] as $user_id ) {
- $user = get_userdata( $user_id );
- $users .= '#' . $user_id . ': ' . $user->user_login . '
';
- }
- }
+ if ( isset( $_REQUEST['user'] ) ){
+ foreach ( $_REQUEST['user'] as $user_id ) {
+ $user = get_userdata( $user_id );
+ $users .= '#' . $user_id . ': ' . $user->user_login . '
';
+ }
+ }
- $ignore = admin_url('users.php');
+ $ignore = admin_url('users.php');
- $messages[0]['err_content'] = sprintf(__('Are you sure you want to delete the selected user(s)? The following users will be deleted:
%s
This cannot be undone! ','ultimate-member'), $users);
- $messages[0]['err_content'] .= '
' . __('Remove','ultimate-member') . ' ' . __('Undo','ultimate-member') . '
';
+ $messages[0]['err_content'] = sprintf( __( 'Are you sure you want to delete the selected user(s)? The following users will be deleted:
%s
This cannot be undone! ','ultimate-member'), $users);
+ $messages[0]['err_content'] .= '
' . __( 'Remove', 'ultimate-member' ) . ' ' . __('Undo','ultimate-member') . '
';
- break;
+ break;
- case 'language_updated':
- $messages[0]['content'] = __('Your translation files have been updated successfully.','ultimate-member');
- break;
+ case 'language_updated':
+ $messages[0]['content'] = __( 'Your translation files have been updated successfully.', 'ultimate-member' );
+ break;
- case 'purged_temp':
- $messages[0]['content'] = __('Your temp uploads directory is now clean.','ultimate-member');
- break;
+ case 'purged_temp':
+ $messages[0]['content'] = __( 'Your temp uploads directory is now clean.', 'ultimate-member' );
+ break;
- case 'cleared_cache':
- $messages[0]['content'] = __('Your user cache is now removed.','ultimate-member');
- break;
+ case 'cleared_cache':
+ $messages[0]['content'] = __( 'Your user cache is now removed.', 'ultimate-member' );
+ break;
- case 'form_duplicated':
- $messages[0]['content'] = __('The form has been duplicated successfully.','ultimate-member');
- break;
+ case 'form_duplicated':
+ $messages[0]['content'] = __( 'The form has been duplicated successfully.', 'ultimate-member' );
+ break;
- case 'user_updated':
- $messages[0]['content'] = __('User has been updated.','ultimate-member');
- break;
+ case 'user_updated':
+ $messages[0]['content'] = __( 'User has been updated.', 'ultimate-member' );
+ break;
- case 'users_updated':
- $messages[0]['content'] = __('Users have been updated.','ultimate-member');
- break;
+ case 'users_updated':
+ $messages[0]['content'] = __( 'Users have been updated.', 'ultimate-member' );
+ break;
- case 'users_role_updated':
- $messages[0]['content'] = __('Changed roles.','ultimate-member');
- break;
+ case 'users_role_updated':
+ $messages[0]['content'] = __( 'Changed roles.', 'ultimate-member' );
+ break;
- case 'err_users_updated':
- $messages[0]['err_content'] = __('Super administrators cannot be modified.','ultimate-member');
- $messages[1]['content'] = __('Other users have been updated.','ultimate-member');
+ case 'err_users_updated':
+ $messages[0]['err_content'] = __( 'Super administrators cannot be modified.', 'ultimate-member' );
+ $messages[1]['content'] = __( 'Other users have been updated.', 'ultimate-member' );
- }
+ }
- if ( !empty( $messages ) ) {
- foreach( $messages as $message ) {
- if ( isset($message['err_content'])) {
- echo '
' . $message['err_content'] . '
';
- } else {
- echo '
' . $message['content'] . '
';
- }
- }
- }
+ if ( ! empty( $messages ) ) {
+ foreach ( $messages as $message ) {
+ if ( isset( $message['err_content'] ) ) {
+ echo '
' . $message['err_content'] . '
';
+ } else {
+ echo '
' . $message['content'] . '
';
+ }
+ }
+ }
- }
+ }
- }
+ }
}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-settings.php b/includes/admin/core/class-admin-settings.php
index 21012bc7..8d143a56 100644
--- a/includes/admin/core/class-admin-settings.php
+++ b/includes/admin/core/class-admin-settings.php
@@ -5,1197 +5,1238 @@ namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Settings' ) ) {
- class Admin_Settings {
-
- var $settings_structure;
- var $previous_licenses;
- var $need_change_permalinks;
-
- function __construct() {
- //init settings structure
- add_action( 'admin_init', array( &$this, 'init_variables' ), 9 );
-
- //admin menu
- add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
-
- //settings structure handlers
- add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) );
- add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 );
-
- //enqueue wp_media for profiles tab
- add_action( 'um_settings_page_appearance__before_section', array( $this, 'settings_appearance_profile_tab' ) );
-
- //custom content for licenses tab
- add_filter( 'um_settings_section_licenses__content', array( $this, 'settings_licenses_tab' ), 10, 2 );
-
- add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 );
- add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 );
+ /**
+ * Class Admin_Settings
+ * @package um\admin\core
+ */
+ class Admin_Settings {
- //save handlers
- add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
-
- //save pages options
- add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
- add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
+ /**
+ * @var
+ */
+ var $settings_structure;
- add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) );
+ /**
+ * @var
+ */
+ var $previous_licenses;
- //save licenses options
- add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
- add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
-
- add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 );
-
- //invalid licenses notice
- add_action( 'admin_notices', array( $this, 'check_wrong_licenses' ) );
-
- add_action( 'admin_init', array( &$this, 'um_download_install_info' ) );
-
- }
+ /**
+ * @var
+ */
+ var $need_change_permalinks;
- function init_variables() {
- $general_pages_fields = array(
- array(
- 'id' => 'pages_settings',
- 'type' => 'hidden',
- 'default' => true,
- 'is_option' => false
- )
- );
+ /**
+ * Admin_Settings constructor.
+ */
+ function __construct() {
+ //init settings structure
+ add_action( 'admin_init', array( &$this, 'init_variables' ), 9 );
- $core_pages = UM()->config()->core_pages;
+ //admin menu
+ add_action( 'admin_menu', array( &$this, 'primary_admin_menu' ), 0 );
- foreach ( $core_pages as $page_s => $page ) {
- $have_pages = UM()->query()->wp_pages();
- $page_id = UM()->options()->get_core_page_id( $page_s );
+ //settings structure handlers
+ add_action( 'um_settings_page_before_email__content', array( $this, 'settings_before_email_tab' ) );
+ add_filter( 'um_settings_section_email__content', array( $this, 'settings_email_tab' ), 10, 1 );
- $page_title = ! empty( $page['title'] ) ? $page['title'] : '';
+ //enqueue wp_media for profiles tab
+ add_action( 'um_settings_page_appearance__before_section', array( $this, 'settings_appearance_profile_tab' ) );
- if ( 'reached_maximum_limit' == $have_pages ) {
- $general_pages_fields[] = array(
- 'id' => $page_id,
- 'type' => 'text',
- 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
- 'placeholder' => __('Add page ID','ultimate-member'),
- 'compiler' => true,
- 'size' => 'small'
- );
- } else {
- $general_pages_fields[] = array(
- 'id' => $page_id,
- 'type' => 'select',
- 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
- 'options' => UM()->query()->wp_pages(),
- 'placeholder' => __('Choose a page...','ultimate-member'),
- 'compiler' => true,
- 'size' => 'small'
- );
- }
- }
+ //custom content for licenses tab
+ add_filter( 'um_settings_section_licenses__content', array( $this, 'settings_licenses_tab' ), 10, 2 );
+
+ add_filter( 'um_settings_section_install_info__content', array( $this, 'settings_install_info_tab' ), 10, 2 );
+
+
+ add_filter( 'um_settings_structure', array( $this, 'sorting_licenses_options' ), 9999, 1 );
+
+
+ //save handlers
+ add_action( 'admin_init', array( $this, 'save_settings_handler' ), 10 );
+
+ //save pages options
+ add_action( 'um_settings_before_save', array( $this, 'check_permalinks_changes' ) );
+ add_action( 'um_settings_save', array( $this, 'on_settings_save' ) );
+
+
+ add_filter( 'um_change_settings_before_save', array( $this, 'save_email_templates' ) );
+
+
+ //save licenses options
+ add_action( 'um_settings_before_save', array( $this, 'before_licenses_save' ) );
+ add_action( 'um_settings_save', array( $this, 'licenses_save' ) );
+
+ add_filter( 'um_change_settings_before_save', array( $this, 'remove_empty_values' ), 10, 1 );
+
+ //invalid licenses notice
+ add_action( 'admin_notices', array( $this, 'check_wrong_licenses' ) );
+
+ add_action( 'admin_init', array( &$this, 'um_download_install_info' ) );
+
+ }
+
+
+ /**
+ *
+ */
+ function init_variables() {
+ $general_pages_fields = array(
+ array(
+ 'id' => 'pages_settings',
+ 'type' => 'hidden',
+ 'default' => true,
+ 'is_option' => false
+ )
+ );
+
+ $core_pages = UM()->config()->core_pages;
+
+ foreach ( $core_pages as $page_s => $page ) {
+ $have_pages = UM()->query()->wp_pages();
+ $page_id = UM()->options()->get_core_page_id( $page_s );
+
+ $page_title = ! empty( $page['title'] ) ? $page['title'] : '';
+
+ if ( 'reached_maximum_limit' == $have_pages ) {
+ $general_pages_fields[] = array(
+ 'id' => $page_id,
+ 'type' => 'text',
+ 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
+ 'placeholder' => __('Add page ID','ultimate-member'),
+ 'compiler' => true,
+ 'size' => 'small'
+ );
+ } else {
+ $general_pages_fields[] = array(
+ 'id' => $page_id,
+ 'type' => 'select',
+ 'label' => sprintf( __( '%s page', 'ultimate-member' ), $page_title ),
+ 'options' => UM()->query()->wp_pages(),
+ 'placeholder' => __('Choose a page...','ultimate-member'),
+ 'compiler' => true,
+ 'size' => 'small'
+ );
+ }
+ }
- $appearances_profile_menu_fields = array(
- array(
- 'id' => 'profile_menu',
- 'type' => 'checkbox',
- 'label' => __('Enable profile menu','ultimate-member'),
- )
- );
+ $appearances_profile_menu_fields = array(
+ array(
+ 'id' => 'profile_menu',
+ 'type' => 'checkbox',
+ 'label' => __('Enable profile menu','ultimate-member'),
+ )
+ );
- $tabs = UM()->profile()->tabs_primary();
+ $tabs = UM()->profile()->tabs_primary();
- foreach( $tabs as $id => $tab ) {
+ foreach( $tabs as $id => $tab ) {
- $appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
- array(
- 'id' => 'profile_tab_' . $id,
- 'type' => 'checkbox',
- 'label' => sprintf(__('%s Tab','ultimate-member'), $tab ),
- 'conditional' => array( 'profile_menu', '=', 1 ),
- ),
- array(
- 'id' => 'profile_tab_' . $id . '_privacy',
- 'type' => 'select',
- 'label' => sprintf( __( 'Who can see %s Tab?','ultimate-member' ), $tab ),
- 'tooltip' => __( 'Select which users can view this tab.','ultimate-member' ),
- 'options' => UM()->profile()->tabs_privacy(),
- 'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_tab_' . $id . '_roles',
- 'type' => 'select',
- 'multi' => true,
- 'label' => __( 'Allowed roles','ultimate-member' ),
- 'tooltip' => __( 'Select the the user roles allowed to view this tab.','ultimate-member' ),
- 'options' => UM()->roles()->get_roles(),
- 'placeholder' => __( 'Choose user roles...','ultimate-member' ),
- 'conditional' => array( 'profile_tab_' . $id . '_privacy', '=', 4 ),
- 'size' => 'small'
- )
- ) );
- }
+ $appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
+ array(
+ 'id' => 'profile_tab_' . $id,
+ 'type' => 'checkbox',
+ 'label' => sprintf(__('%s Tab','ultimate-member'), $tab ),
+ 'conditional' => array( 'profile_menu', '=', 1 ),
+ ),
+ array(
+ 'id' => 'profile_tab_' . $id . '_privacy',
+ 'type' => 'select',
+ 'label' => sprintf( __( 'Who can see %s Tab?','ultimate-member' ), $tab ),
+ 'tooltip' => __( 'Select which users can view this tab.','ultimate-member' ),
+ 'options' => UM()->profile()->tabs_privacy(),
+ 'conditional' => array( 'profile_tab_' . $id, '=', 1 ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_tab_' . $id . '_roles',
+ 'type' => 'select',
+ 'multi' => true,
+ 'label' => __( 'Allowed roles','ultimate-member' ),
+ 'tooltip' => __( 'Select the the user roles allowed to view this tab.','ultimate-member' ),
+ 'options' => UM()->roles()->get_roles(),
+ 'placeholder' => __( 'Choose user roles...','ultimate-member' ),
+ 'conditional' => array( 'profile_tab_' . $id . '_privacy', '=', 4 ),
+ 'size' => 'small'
+ )
+ ) );
+ }
- $appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
- array(
- 'id' => 'profile_menu_default_tab',
- 'type' => 'select',
- 'label' => __( 'Profile menu default tab','ultimate-member' ),
- 'tooltip' => __( 'This will be the default tab on user profile page','ultimate-member' ),
- 'options' => UM()->profile()->tabs_enabled(),
- 'conditional' => array( 'profile_menu', '=', 1 ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_menu_icons',
- 'type' => 'checkbox',
- 'label' => __('Enable menu icons in desktop view','ultimate-member'),
- 'conditional' => array( 'profile_menu', '=', 1 ),
- )
- ) );
+ $appearances_profile_menu_fields = array_merge( $appearances_profile_menu_fields, array(
+ array(
+ 'id' => 'profile_menu_default_tab',
+ 'type' => 'select',
+ 'label' => __( 'Profile menu default tab','ultimate-member' ),
+ 'tooltip' => __( 'This will be the default tab on user profile page','ultimate-member' ),
+ 'options' => UM()->profile()->tabs_enabled(),
+ 'conditional' => array( 'profile_menu', '=', 1 ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_menu_icons',
+ 'type' => 'checkbox',
+ 'label' => __('Enable menu icons in desktop view','ultimate-member'),
+ 'conditional' => array( 'profile_menu', '=', 1 ),
+ )
+ ) );
- $all_post_types = get_post_types( array( 'public' => true ) );
+ $all_post_types = get_post_types( array( 'public' => true ) );
- $all_taxonomies = get_taxonomies( array( 'public' => true ) );
- $exclude_taxonomies = UM()->excluded_taxonomies();
+ $all_taxonomies = get_taxonomies( array( 'public' => true ) );
+ $exclude_taxonomies = UM()->excluded_taxonomies();
- foreach ( $all_taxonomies as $key => $taxonomy ) {
- if( in_array( $key , $exclude_taxonomies ) )
- unset( $all_taxonomies[$key] );
- }
+ foreach ( $all_taxonomies as $key => $taxonomy ) {
+ if( in_array( $key , $exclude_taxonomies ) )
+ unset( $all_taxonomies[$key] );
+ }
- $restricted_access_post_metabox_value = array();
- if ( $restricted_access_post_metabox = UM()->options()->get( 'restricted_access_post_metabox' ) ) {
- foreach ( $restricted_access_post_metabox as $key => $value ) {
- if ( $value )
- $restricted_access_post_metabox_value[] = $key;
- }
- }
+ $restricted_access_post_metabox_value = array();
+ if ( $restricted_access_post_metabox = UM()->options()->get( 'restricted_access_post_metabox' ) ) {
+ foreach ( $restricted_access_post_metabox as $key => $value ) {
+ if ( $value )
+ $restricted_access_post_metabox_value[] = $key;
+ }
+ }
- $restricted_access_taxonomy_metabox_value = array();
- if ( $restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' ) ) {
- foreach ( $restricted_access_taxonomy_metabox as $key => $value ) {
- if ( $value )
- $restricted_access_taxonomy_metabox_value[] = $key;
- }
- }
+ $restricted_access_taxonomy_metabox_value = array();
+ if ( $restricted_access_taxonomy_metabox = UM()->options()->get( 'restricted_access_taxonomy_metabox' ) ) {
+ foreach ( $restricted_access_taxonomy_metabox as $key => $value ) {
+ if ( $value )
+ $restricted_access_taxonomy_metabox_value[] = $key;
+ }
+ }
- /**
- * UM hook
- *
- * @type filter
- * @title um_settings_structure
- * @description Extend UM Settings
- * @input_vars
- * [{"var":"$settings","type":"array","desc":"UM Settings"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_settings_structure', 'function_name', 10, 1 );
- * @example
- *
- */
- $this->settings_structure = apply_filters( 'um_settings_structure', array(
- '' => array(
- 'title' => __( 'General', 'ultimate-member' ),
- 'sections' => array(
- '' => array(
- 'title' => __( 'Pages', 'ultimate-member' ),
- 'fields' => $general_pages_fields
- ),
- 'users' => array(
- 'title' => __( 'Users', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'permalink_base',
- 'type' => 'select',
- 'size' => 'small',
- 'label' => __( 'Profile Permalink Base','ultimate-member' ),
- 'tooltip' => __( 'Here you can control the permalink structure of the user profile URL globally e.g. ' . trailingslashit( um_get_core_page('user') ) . '
username /','ultimate-member' ),
- 'options' => array(
- 'user_login' => __('Username','ultimate-member'),
- 'name' => __('First and Last Name with \'.\'','ultimate-member'),
- 'name_dash' => __('First and Last Name with \'-\'','ultimate-member'),
- 'name_plus' => __('First and Last Name with \'+\'','ultimate-member'),
- 'user_id' => __('User ID','ultimate-member'),
- ),
- 'placeholder' => __('Select...','ultimate-member'),
- ),
- array(
- 'id' => 'display_name',
- 'type' => 'select',
- 'size' => 'medium',
- 'label' => __( 'User Display Name','ultimate-member' ),
- 'tooltip' => __( 'This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists','ultimate-member' ),
- 'options' => array(
- 'default' => __('Default WP Display Name','ultimate-member'),
- 'nickname' => __('Nickname','ultimate-member'),
- 'username' => __('Username','ultimate-member'),
- 'full_name' => __('First name & last name','ultimate-member'),
- 'sur_name' => __('Last name & first name','ultimate-member'),
- 'initial_name' => __('First name & first initial of last name','ultimate-member'),
- 'initial_name_f' => __('First initial of first name & last name','ultimate-member'),
- 'first_name' => __('First name only','ultimate-member'),
- 'field' => __('Custom field(s)','ultimate-member'),
- ),
- 'placeholder' => __('Select...'),
- ),
- array(
- 'id' => 'display_name_field',
- 'type' => 'text',
- 'label' => __( 'Display Name Custom Field(s)','ultimate-member' ),
- 'tooltip' => __('Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site','ultimate-member'),
- 'conditional' => array( 'display_name', '=', 'field' ),
- ),
- array(
- 'id' => 'author_redirect',
- 'type' => 'checkbox',
- 'label' => __( 'Automatically redirect author page to their profile?','ultimate-member'),
- 'tooltip' => __('If enabled, author pages will automatically redirect to the user\'s profile page','ultimate-member'),
- ),
- array(
- 'id' => 'members_page',
- 'type' => 'checkbox',
- 'label' => __( 'Enable Members Directory','ultimate-member' ),
- 'tooltip' => __('Control whether to enable or disable member directories on this site','ultimate-member'),
- ),
- array(
- 'id' => 'use_gravatars',
- 'type' => 'checkbox',
- 'label' => __( 'Use Gravatars?','ultimate-member' ),
- 'tooltip' => __('Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)','ultimate-member'),
- ),
- array(
- 'id' => 'use_um_gravatar_default_builtin_image',
- 'type' => 'select',
- 'label' => __( 'Use Gravatar builtin image','ultimate-member' ),
- 'tooltip' => __( 'Gravatar has a number of built in options which you can also use as defaults','ultimate-member' ),
- 'options' => array(
- 'default' => __('Default','ultimate-member'),
- '404' => __('404 ( File Not Found response )','ultimate-member'),
- 'mm' => __('Mystery Man','ultimate-member'),
- 'identicon' => __('Identicon','ultimate-member'),
- 'monsterid' => __('Monsterid','ultimate-member'),
- 'wavatar' => __('Wavatar','ultimate-member'),
- 'retro' => __('Retro','ultimate-member'),
- 'blank' => __('Blank ( a transparent PNG image )','ultimate-member'),
- ),
- 'conditional' => array( 'use_gravatars', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'use_um_gravatar_default_image',
- 'type' => 'checkbox',
- 'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar','ultimate-member' ),
- 'tooltip' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)','ultimate-member'),
- 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
- ),
- array(
- 'id' => 'reset_require_strongpass',
- 'type' => 'checkbox',
- 'label' => __( 'Require a strong password? (when user resets password only)','ultimate-member' ),
- 'tooltip' => __('Enable or disable a strong password rules on password reset and change procedure','ultimate-member'),
- )
- )
- ),
- 'account' => array(
- 'title' => __( 'Account', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'account_tab_password',
- 'type' => 'checkbox',
- 'label' => __( 'Password Account Tab','ultimate-member' ),
- 'tooltip' => 'Enable/disable the Password account tab in account page',
- ),
- array(
- 'id' => 'account_tab_privacy',
- 'type' => 'checkbox',
- 'label' => __( 'Privacy Account Tab','ultimate-member' ),
- 'tooltip' => __('Enable/disable the Privacy account tab in account page','ultimate-member'),
- ),
- array(
- 'id' => 'account_tab_notifications',
- 'type' => 'checkbox',
- 'label' => __( 'Notifications Account Tab','ultimate-member' ),
- 'tooltip' => __('Enable/disable the Notifications account tab in account page','ultimate-member'),
- ),
- array(
- 'id' => 'account_tab_delete',
- 'type' => 'checkbox',
- 'label' => __( 'Delete Account Tab','ultimate-member' ),
- 'tooltip' => __('Enable/disable the Delete account tab in account page','ultimate-member'),
- ),
- array(
- 'id' => 'delete_account_text',
- 'type' => 'textarea', // bug with wp 4.4? should be editor
- 'label' => __( 'Account Deletion Custom Text','ultimate-member' ),
- 'tooltip' => __('This is custom text that will be displayed to users before they delete their accounts from your site','ultimate-member'),
- 'args' => array(
- 'textarea_rows' => 6
- ),
- ),
- array(
- 'id' => 'account_name',
- 'type' => 'checkbox',
- 'label' => __( 'Add a First & Last Name fields','ultimate-member' ),
- 'tooltip' => __('Whether to enable these fields on the user account page by default or hide them.','ultimate-member'),
- ),
- array(
- 'id' => 'account_name_disable',
- 'type' => 'checkbox',
- 'label' => __( 'Disable First & Last Name fields','ultimate-member' ),
- 'tooltip' => __('Whether to allow users changing their first and last name in account page.','ultimate-member'),
- 'conditional' => array( 'account_name', '=', '1' ),
- ),
- array(
- 'id' => 'account_name_require',
- 'type' => 'checkbox',
- 'label' => __( 'Require First & Last Name','ultimate-member' ),
- 'tooltip' => __('Require first and last name?','ultimate-member'),
- 'conditional' => array( 'account_name', '=', '1' ),
- ),
- array(
- 'id' => 'account_email',
- 'type' => 'checkbox',
- 'label' => __( 'Allow users to change e-mail','ultimate-member' ),
- 'tooltip' => __('Whether to allow users changing their email in account page.','ultimate-member'),
- ),
- array(
- 'id' => 'account_hide_in_directory',
- 'type' => 'checkbox',
- 'label' => __( 'Allow users to hide their profiles from directory','ultimate-member' ),
- 'tooltip' => __('Whether to allow users changing their profile visibility from member directory in account page.','ultimate-member'),
- ),
- array(
- 'id' => 'account_require_strongpass',
- 'type' => 'checkbox',
- 'label' => __( 'Require a strong password?','ultimate-member' ),
- 'tooltip' => __('Enable or disable a strong password rules on account page / change password tab','ultimate-member'),
- )
- )
- ),
- 'uploads' => array(
- 'title' => __( 'Uploads', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'profile_photo_max_size',
- 'type' => 'text',
- 'size' => 'small',
- 'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ),
- 'tooltip' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ),
- ),
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_settings_structure
+ * @description Extend UM Settings
+ * @input_vars
+ * [{"var":"$settings","type":"array","desc":"UM Settings"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_settings_structure', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $this->settings_structure = apply_filters( 'um_settings_structure', array(
+ '' => array(
+ 'title' => __( 'General', 'ultimate-member' ),
+ 'sections' => array(
+ '' => array(
+ 'title' => __( 'Pages', 'ultimate-member' ),
+ 'fields' => $general_pages_fields
+ ),
+ 'users' => array(
+ 'title' => __( 'Users', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'permalink_base',
+ 'type' => 'select',
+ 'size' => 'small',
+ 'label' => __( 'Profile Permalink Base','ultimate-member' ),
+ 'tooltip' => __( 'Here you can control the permalink structure of the user profile URL globally e.g. ' . trailingslashit( um_get_core_page('user') ) . '
username /','ultimate-member' ),
+ 'options' => array(
+ 'user_login' => __('Username','ultimate-member'),
+ 'name' => __('First and Last Name with \'.\'','ultimate-member'),
+ 'name_dash' => __('First and Last Name with \'-\'','ultimate-member'),
+ 'name_plus' => __('First and Last Name with \'+\'','ultimate-member'),
+ 'user_id' => __('User ID','ultimate-member'),
+ ),
+ 'placeholder' => __('Select...','ultimate-member'),
+ ),
+ array(
+ 'id' => 'display_name',
+ 'type' => 'select',
+ 'size' => 'medium',
+ 'label' => __( 'User Display Name','ultimate-member' ),
+ 'tooltip' => __( 'This is the name that will be displayed for users on the front end of your site. Default setting uses first/last name as display name if it exists','ultimate-member' ),
+ 'options' => array(
+ 'default' => __('Default WP Display Name','ultimate-member'),
+ 'nickname' => __('Nickname','ultimate-member'),
+ 'username' => __('Username','ultimate-member'),
+ 'full_name' => __('First name & last name','ultimate-member'),
+ 'sur_name' => __('Last name & first name','ultimate-member'),
+ 'initial_name' => __('First name & first initial of last name','ultimate-member'),
+ 'initial_name_f' => __('First initial of first name & last name','ultimate-member'),
+ 'first_name' => __('First name only','ultimate-member'),
+ 'field' => __('Custom field(s)','ultimate-member'),
+ ),
+ 'placeholder' => __('Select...'),
+ ),
+ array(
+ 'id' => 'display_name_field',
+ 'type' => 'text',
+ 'label' => __( 'Display Name Custom Field(s)','ultimate-member' ),
+ 'tooltip' => __('Specify the custom field meta key or custom fields seperated by comma that you want to use to display users name on the frontend of your site','ultimate-member'),
+ 'conditional' => array( 'display_name', '=', 'field' ),
+ ),
+ array(
+ 'id' => 'author_redirect',
+ 'type' => 'checkbox',
+ 'label' => __( 'Automatically redirect author page to their profile?','ultimate-member'),
+ 'tooltip' => __('If enabled, author pages will automatically redirect to the user\'s profile page','ultimate-member'),
+ ),
+ array(
+ 'id' => 'members_page',
+ 'type' => 'checkbox',
+ 'label' => __( 'Enable Members Directory','ultimate-member' ),
+ 'tooltip' => __('Control whether to enable or disable member directories on this site','ultimate-member'),
+ ),
+ array(
+ 'id' => 'use_gravatars',
+ 'type' => 'checkbox',
+ 'label' => __( 'Use Gravatars?','ultimate-member' ),
+ 'tooltip' => __('Do you want to use gravatars instead of the default plugin profile photo (If the user did not upload a custom profile photo / avatar)','ultimate-member'),
+ ),
+ array(
+ 'id' => 'use_um_gravatar_default_builtin_image',
+ 'type' => 'select',
+ 'label' => __( 'Use Gravatar builtin image','ultimate-member' ),
+ 'tooltip' => __( 'Gravatar has a number of built in options which you can also use as defaults','ultimate-member' ),
+ 'options' => array(
+ 'default' => __('Default','ultimate-member'),
+ '404' => __('404 ( File Not Found response )','ultimate-member'),
+ 'mm' => __('Mystery Man','ultimate-member'),
+ 'identicon' => __('Identicon','ultimate-member'),
+ 'monsterid' => __('Monsterid','ultimate-member'),
+ 'wavatar' => __('Wavatar','ultimate-member'),
+ 'retro' => __('Retro','ultimate-member'),
+ 'blank' => __('Blank ( a transparent PNG image )','ultimate-member'),
+ ),
+ 'conditional' => array( 'use_gravatars', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'use_um_gravatar_default_image',
+ 'type' => 'checkbox',
+ 'label' => __( 'Use Default plugin avatar as Gravatar\'s Default avatar','ultimate-member' ),
+ 'tooltip' => __('Do you want to use the plugin default avatar instead of the gravatar default photo (If the user did not upload a custom profile photo / avatar)','ultimate-member'),
+ 'conditional' => array( 'use_um_gravatar_default_builtin_image', '=', 'default' ),
+ ),
+ array(
+ 'id' => 'reset_require_strongpass',
+ 'type' => 'checkbox',
+ 'label' => __( 'Require a strong password? (when user resets password only)','ultimate-member' ),
+ 'tooltip' => __('Enable or disable a strong password rules on password reset and change procedure','ultimate-member'),
+ )
+ )
+ ),
+ 'account' => array(
+ 'title' => __( 'Account', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'account_tab_password',
+ 'type' => 'checkbox',
+ 'label' => __( 'Password Account Tab','ultimate-member' ),
+ 'tooltip' => 'Enable/disable the Password account tab in account page',
+ ),
+ array(
+ 'id' => 'account_tab_privacy',
+ 'type' => 'checkbox',
+ 'label' => __( 'Privacy Account Tab','ultimate-member' ),
+ 'tooltip' => __('Enable/disable the Privacy account tab in account page','ultimate-member'),
+ ),
+ array(
+ 'id' => 'account_tab_notifications',
+ 'type' => 'checkbox',
+ 'label' => __( 'Notifications Account Tab','ultimate-member' ),
+ 'tooltip' => __('Enable/disable the Notifications account tab in account page','ultimate-member'),
+ ),
+ array(
+ 'id' => 'account_tab_delete',
+ 'type' => 'checkbox',
+ 'label' => __( 'Delete Account Tab','ultimate-member' ),
+ 'tooltip' => __('Enable/disable the Delete account tab in account page','ultimate-member'),
+ ),
+ array(
+ 'id' => 'delete_account_text',
+ 'type' => 'textarea', // bug with wp 4.4? should be editor
+ 'label' => __( 'Account Deletion Custom Text','ultimate-member' ),
+ 'tooltip' => __('This is custom text that will be displayed to users before they delete their accounts from your site','ultimate-member'),
+ 'args' => array(
+ 'textarea_rows' => 6
+ ),
+ ),
+ array(
+ 'id' => 'account_name',
+ 'type' => 'checkbox',
+ 'label' => __( 'Add a First & Last Name fields','ultimate-member' ),
+ 'tooltip' => __('Whether to enable these fields on the user account page by default or hide them.','ultimate-member'),
+ ),
+ array(
+ 'id' => 'account_name_disable',
+ 'type' => 'checkbox',
+ 'label' => __( 'Disable First & Last Name fields','ultimate-member' ),
+ 'tooltip' => __('Whether to allow users changing their first and last name in account page.','ultimate-member'),
+ 'conditional' => array( 'account_name', '=', '1' ),
+ ),
+ array(
+ 'id' => 'account_name_require',
+ 'type' => 'checkbox',
+ 'label' => __( 'Require First & Last Name','ultimate-member' ),
+ 'tooltip' => __('Require first and last name?','ultimate-member'),
+ 'conditional' => array( 'account_name', '=', '1' ),
+ ),
+ array(
+ 'id' => 'account_email',
+ 'type' => 'checkbox',
+ 'label' => __( 'Allow users to change e-mail','ultimate-member' ),
+ 'tooltip' => __('Whether to allow users changing their email in account page.','ultimate-member'),
+ ),
+ array(
+ 'id' => 'account_hide_in_directory',
+ 'type' => 'checkbox',
+ 'label' => __( 'Allow users to hide their profiles from directory','ultimate-member' ),
+ 'tooltip' => __('Whether to allow users changing their profile visibility from member directory in account page.','ultimate-member'),
+ ),
+ array(
+ 'id' => 'account_require_strongpass',
+ 'type' => 'checkbox',
+ 'label' => __( 'Require a strong password?','ultimate-member' ),
+ 'tooltip' => __('Enable or disable a strong password rules on account page / change password tab','ultimate-member'),
+ )
+ )
+ ),
+ 'uploads' => array(
+ 'title' => __( 'Uploads', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'profile_photo_max_size',
+ 'type' => 'text',
+ 'size' => 'small',
+ 'label' => __( 'Profile Photo Maximum File Size (bytes)', 'ultimate-member' ),
+ 'tooltip' => __( 'Sets a maximum size for the uploaded photo', 'ultimate-member' ),
+ ),
- array(
- 'id' => 'cover_photo_max_size',
- 'type' => 'text',
- 'size' => 'small',
- 'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ),
- 'tooltip' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ),
- ),
- array(
- 'id' => 'photo_thumb_sizes',
- 'type' => 'multi_text',
- 'size' => 'small',
- 'label' => __( 'Profile Photo Thumbnail Sizes (px)','ultimate-member' ),
- 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.','ultimate-member' ),
- 'validate' => 'numeric',
- 'add_text' => __('Add New Size','ultimate-member'),
- 'show_default_number' => 1,
- ),
- array(
- 'id' => 'cover_thumb_sizes',
- 'type' => 'multi_text',
- 'size' => 'small',
- 'label' => __( 'Cover Photo Thumbnail Sizes (px)','ultimate-member' ),
- 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.','ultimate-member' ),
- 'validate' => 'numeric',
- 'add_text' => __('Add New Size','ultimate-member'),
- 'show_default_number' => 1,
- ),
+ array(
+ 'id' => 'cover_photo_max_size',
+ 'type' => 'text',
+ 'size' => 'small',
+ 'label' => __( 'Cover Photo Maximum File Size (bytes)', 'ultimate-member' ),
+ 'tooltip' => __( 'Sets a maximum size for the uploaded cover', 'ultimate-member' ),
+ ),
+ array(
+ 'id' => 'photo_thumb_sizes',
+ 'type' => 'multi_text',
+ 'size' => 'small',
+ 'label' => __( 'Profile Photo Thumbnail Sizes (px)','ultimate-member' ),
+ 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each profile photo upload.','ultimate-member' ),
+ 'validate' => 'numeric',
+ 'add_text' => __('Add New Size','ultimate-member'),
+ 'show_default_number' => 1,
+ ),
+ array(
+ 'id' => 'cover_thumb_sizes',
+ 'type' => 'multi_text',
+ 'size' => 'small',
+ 'label' => __( 'Cover Photo Thumbnail Sizes (px)','ultimate-member' ),
+ 'tooltip' => __( 'Here you can define which thumbnail sizes will be created for each cover photo upload.','ultimate-member' ),
+ 'validate' => 'numeric',
+ 'add_text' => __('Add New Size','ultimate-member'),
+ 'show_default_number' => 1,
+ ),
- array(
- 'id' => 'image_compression',
- 'type' => 'text',
- 'size' => 'small',
- 'label' => __( 'Image Quality','ultimate-member'),
- 'tooltip' => __( 'Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimate-member' ),
- ),
+ array(
+ 'id' => 'image_compression',
+ 'type' => 'text',
+ 'size' => 'small',
+ 'label' => __( 'Image Quality','ultimate-member'),
+ 'tooltip' => __( 'Quality is used to determine quality of image uploads, and ranges from 0 (worst quality, smaller file) to 100 (best quality, biggest file). The default range is 60.', 'ultimate-member' ),
+ ),
- array(
- 'id' => 'image_max_width',
- 'type' => 'text',
- 'size' => 'small',
- 'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ),
- 'tooltip' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ),
- ),
+ array(
+ 'id' => 'image_max_width',
+ 'type' => 'text',
+ 'size' => 'small',
+ 'label' => __( 'Image Upload Maximum Width (px)', 'ultimate-member' ),
+ 'tooltip' => __( 'Any image upload above this width will be resized to this limit automatically.', 'ultimate-member' ),
+ ),
- array(
- 'id' => 'cover_min_width',
- 'type' => 'text',
- 'size' => 'small',
- 'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ),
- 'tooltip' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ),
- ),
- )
- )
- )
- ),
- 'access' => array(
- 'title' => __( 'Access', 'ultimate-member' ),
- 'sections' => array(
- '' => array(
- 'title' => __( 'Restriction Content', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'accessible',
- 'type' => 'select',
- 'label' => __( 'Global Site Access','ultimate-member' ),
- 'tooltip' => __('Globally control the access of your site, you can have seperate restrict options per post/page by editing the desired item.','ultimate-member'),
- 'options' => array(
- 0 => 'Site accessible to Everyone',
- 2 => 'Site accessible to Logged In Users'
- ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'access_redirect',
- 'type' => 'text',
- 'label' => __( 'Custom Redirect URL','ultimate-member' ),
- 'tooltip' => __('A logged out user will be redirected to this url If he is not permitted to access the site','ultimate-member'),
- 'conditional' => array( 'accessible', '=', 2 ),
- ),
- array(
- 'id' => 'access_exclude_uris',
- 'type' => 'multi_text',
- 'label' => __( 'Exclude the following URLs','ultimate-member' ),
- 'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone','ultimate-member' ),
- 'add_text' => __('Add New URL','ultimate-member'),
- 'conditional' => array( 'accessible', '=', 2 ),
- 'show_default_number' => 1,
- ),
- array(
- 'id' => 'home_page_accessible',
- 'type' => 'checkbox',
- 'label' => __( 'Allow Homepage to be accessible','ultimate-member' ),
- 'conditional' => array( 'accessible', '=', 2 ),
- ),
- array(
- 'id' => 'category_page_accessible',
- 'type' => 'checkbox',
- 'label' => __( 'Allow Category pages to be accessible','ultimate-member' ),
- 'conditional' => array( 'accessible', '=', 2 ),
- ),
- array(
- 'id' => 'restricted_access_message',
- 'type' => 'wp_editor',
- 'label' => __( 'Restricted Access Message','ultimate-member' ),
- 'tooltip' => __( 'This is the message shown to users that do not have permission to view the content','ultimate-member' ),
- ),
- array(
- 'id' => 'restricted_access_post_metabox',
- 'type' => 'hidden',
- 'value' => '',
- ),
- array(
- 'id' => 'restricted_access_taxonomy_metabox',
- 'type' => 'hidden',
- 'value' => '',
- ),
- array(
- 'id' => 'restricted_access_post_metabox',
- 'type' => 'multi_checkbox',
- 'label' => __( 'Restricted Access to Posts','ultimate-member' ),
- 'tooltip' => __( 'Restriction content of the current Posts','ultimate-member' ),
- 'options' => $all_post_types,
- 'columns' => 3,
- 'value' => $restricted_access_post_metabox_value,
- 'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ),
- ),
- array(
- 'id' => 'restricted_access_taxonomy_metabox',
- 'type' => 'multi_checkbox',
- 'label' => __( 'Restricted Access to Taxonomies','ultimate-member' ),
- 'tooltip' => __( 'Restriction content of the current Taxonomies','ultimate-member' ),
- 'options' => $all_taxonomies,
- 'columns' => 3,
- 'value' => $restricted_access_taxonomy_metabox_value,
- 'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ),
- ),
- )
- ),
- 'other' => array(
- 'title' => __( 'Other', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'enable_reset_password_limit',
- 'type' => 'checkbox',
- 'label' => __( 'Enable the Reset Password Limit?','ultimate-member' ),
- ),
- array(
- 'id' => 'reset_password_limit_number',
- 'type' => 'text',
- 'label' => __( 'Reset Password Limit','ultimate-member' ),
- 'tooltip' => __('Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.','ultimate-member'),
- 'validate' => 'numeric',
- 'conditional' => array('enable_reset_password_limit','=',1),
- 'size' => 'um-small-field',
- ),
- array(
- 'id' => 'blocked_emails',
- 'type' => 'textarea',
- 'label' => __( 'Blocked Email Addresses','ultimate-member' ),
- 'tooltip' => __('This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com','ultimate-member'),
- ),
- array(
- 'id' => 'blocked_words',
- 'type' => 'textarea',
- 'label' => __( 'Blacklist Words','ultimate-member' ),
- 'tooltip' => __('This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username','ultimate-member'),
- )
- )
- ),
- )
- ),
- 'email' => array(
- 'title' => __( 'Email', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'admin_email',
- 'type' => 'text',
- 'label' => __( 'Admin E-mail Address', 'ultimate-member' ),
- 'tooltip' => __( 'e.g. admin@companyname.com','ultimate-member' ),
- ),
- array(
- 'id' => 'mail_from',
- 'type' => 'text',
- 'label' => __( 'Mail appears from','ultimate-member' ),
- 'tooltip' => __( 'e.g. Site Name','ultimate-member' ),
- ),
- array(
- 'id' => 'mail_from_addr',
- 'type' => 'text',
- 'label' => __( 'Mail appears from address','ultimate-member' ),
- 'tooltip' => __( 'e.g. admin@companyname.com','ultimate-member' ),
- ),
- array(
- 'id' => 'email_html',
- 'type' => 'checkbox',
- 'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
- 'tooltip' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in
templates/email folder.','ultimate-member'),
- )
- )
- ),
- 'appearance' => array(
- 'title' => __( 'Appearance', 'ultimate-member' ),
- 'sections' => array(
- '' => array(
- 'title' => __( 'Profile', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'profile_template',
- 'type' => 'select',
- 'label' => __( 'Profile Default Template','ultimate-member' ),
- 'tooltip' => __( 'This will be the default template to output profile','ultimate-member' ),
- 'default' => um_get_metadefault('profile_template'),
- 'options' => UM()->shortcodes()->get_templates( 'profile' ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_max_width',
- 'type' => 'text',
- 'label' => __( 'Profile Maximum Width','ultimate-member' ),
- 'default' => um_get_metadefault('profile_max_width'),
- 'tooltip' => 'The maximum width this shortcode can take from the page width',
- 'size' => 'small'
- ),
+ array(
+ 'id' => 'cover_min_width',
+ 'type' => 'text',
+ 'size' => 'small',
+ 'label' => __( 'Cover Photo Minimum Width (px)', 'ultimate-member' ),
+ 'tooltip' => __( 'This will be the minimum width for cover photo uploads', 'ultimate-member' ),
+ ),
+ )
+ )
+ )
+ ),
+ 'access' => array(
+ 'title' => __( 'Access', 'ultimate-member' ),
+ 'sections' => array(
+ '' => array(
+ 'title' => __( 'Restriction Content', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'accessible',
+ 'type' => 'select',
+ 'label' => __( 'Global Site Access','ultimate-member' ),
+ 'tooltip' => __('Globally control the access of your site, you can have seperate restrict options per post/page by editing the desired item.','ultimate-member'),
+ 'options' => array(
+ 0 => 'Site accessible to Everyone',
+ 2 => 'Site accessible to Logged In Users'
+ ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'access_redirect',
+ 'type' => 'text',
+ 'label' => __( 'Custom Redirect URL','ultimate-member' ),
+ 'tooltip' => __('A logged out user will be redirected to this url If he is not permitted to access the site','ultimate-member'),
+ 'conditional' => array( 'accessible', '=', 2 ),
+ ),
+ array(
+ 'id' => 'access_exclude_uris',
+ 'type' => 'multi_text',
+ 'label' => __( 'Exclude the following URLs','ultimate-member' ),
+ 'tooltip' => __( 'Here you can exclude URLs beside the redirect URI to be accessible to everyone','ultimate-member' ),
+ 'add_text' => __('Add New URL','ultimate-member'),
+ 'conditional' => array( 'accessible', '=', 2 ),
+ 'show_default_number' => 1,
+ ),
+ array(
+ 'id' => 'home_page_accessible',
+ 'type' => 'checkbox',
+ 'label' => __( 'Allow Homepage to be accessible','ultimate-member' ),
+ 'conditional' => array( 'accessible', '=', 2 ),
+ ),
+ array(
+ 'id' => 'category_page_accessible',
+ 'type' => 'checkbox',
+ 'label' => __( 'Allow Category pages to be accessible','ultimate-member' ),
+ 'conditional' => array( 'accessible', '=', 2 ),
+ ),
+ array(
+ 'id' => 'restricted_access_message',
+ 'type' => 'wp_editor',
+ 'label' => __( 'Restricted Access Message','ultimate-member' ),
+ 'tooltip' => __( 'This is the message shown to users that do not have permission to view the content','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'restricted_access_post_metabox',
+ 'type' => 'hidden',
+ 'value' => '',
+ ),
+ array(
+ 'id' => 'restricted_access_taxonomy_metabox',
+ 'type' => 'hidden',
+ 'value' => '',
+ ),
+ array(
+ 'id' => 'restricted_access_post_metabox',
+ 'type' => 'multi_checkbox',
+ 'label' => __( 'Restricted Access to Posts','ultimate-member' ),
+ 'tooltip' => __( 'Restriction content of the current Posts','ultimate-member' ),
+ 'options' => $all_post_types,
+ 'columns' => 3,
+ 'value' => $restricted_access_post_metabox_value,
+ 'default' => UM()->options()->get_default( 'restricted_access_post_metabox' ),
+ ),
+ array(
+ 'id' => 'restricted_access_taxonomy_metabox',
+ 'type' => 'multi_checkbox',
+ 'label' => __( 'Restricted Access to Taxonomies','ultimate-member' ),
+ 'tooltip' => __( 'Restriction content of the current Taxonomies','ultimate-member' ),
+ 'options' => $all_taxonomies,
+ 'columns' => 3,
+ 'value' => $restricted_access_taxonomy_metabox_value,
+ 'default' => UM()->options()->get_default( 'restricted_access_taxonomy_metabox' ),
+ ),
+ )
+ ),
+ 'other' => array(
+ 'title' => __( 'Other', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'enable_reset_password_limit',
+ 'type' => 'checkbox',
+ 'label' => __( 'Enable the Reset Password Limit?','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'reset_password_limit_number',
+ 'type' => 'text',
+ 'label' => __( 'Reset Password Limit','ultimate-member' ),
+ 'tooltip' => __('Set the maximum reset password limit. If reached the maximum limit, user will be locked from using this.','ultimate-member'),
+ 'validate' => 'numeric',
+ 'conditional' => array('enable_reset_password_limit','=',1),
+ 'size' => 'um-small-field',
+ ),
+ array(
+ 'id' => 'blocked_emails',
+ 'type' => 'textarea',
+ 'label' => __( 'Blocked Email Addresses','ultimate-member' ),
+ 'tooltip' => __('This will block the specified e-mail addresses from being able to sign up or sign in to your site. To block an entire domain, use something like *@domain.com','ultimate-member'),
+ ),
+ array(
+ 'id' => 'blocked_words',
+ 'type' => 'textarea',
+ 'label' => __( 'Blacklist Words','ultimate-member' ),
+ 'tooltip' => __('This option lets you specify blacklist of words to prevent anyone from signing up with such a word as their username','ultimate-member'),
+ )
+ )
+ ),
+ )
+ ),
+ 'email' => array(
+ 'title' => __( 'Email', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'admin_email',
+ 'type' => 'text',
+ 'label' => __( 'Admin E-mail Address', 'ultimate-member' ),
+ 'tooltip' => __( 'e.g. admin@companyname.com','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'mail_from',
+ 'type' => 'text',
+ 'label' => __( 'Mail appears from','ultimate-member' ),
+ 'tooltip' => __( 'e.g. Site Name','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'mail_from_addr',
+ 'type' => 'text',
+ 'label' => __( 'Mail appears from address','ultimate-member' ),
+ 'tooltip' => __( 'e.g. admin@companyname.com','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'email_html',
+ 'type' => 'checkbox',
+ 'label' => __( 'Use HTML for E-mails?','ultimate-member' ),
+ 'tooltip' => __('If you enable HTML for e-mails, you can customize the HTML e-mail templates found in
templates/email folder.','ultimate-member'),
+ )
+ )
+ ),
+ 'appearance' => array(
+ 'title' => __( 'Appearance', 'ultimate-member' ),
+ 'sections' => array(
+ '' => array(
+ 'title' => __( 'Profile', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'profile_template',
+ 'type' => 'select',
+ 'label' => __( 'Profile Default Template','ultimate-member' ),
+ 'tooltip' => __( 'This will be the default template to output profile','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_template'),
+ 'options' => UM()->shortcodes()->get_templates( 'profile' ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_max_width',
+ 'type' => 'text',
+ 'label' => __( 'Profile Maximum Width','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_max_width'),
+ 'tooltip' => 'The maximum width this shortcode can take from the page width',
+ 'size' => 'small'
+ ),
- array(
- 'id' => 'profile_area_max_width',
- 'type' => 'text',
- 'label' => __( 'Profile Area Maximum Width','ultimate-member' ),
- 'default' => um_get_metadefault('profile_area_max_width'),
- 'tooltip' => __('The maximum width of the profile area inside profile (below profile header)','ultimate-member'),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_icons',
- 'type' => 'select',
- 'label' => __( 'Profile Field Icons' ),
- 'tooltip' => __( 'This is applicable for edit mode only','ultimate-member' ),
- 'default' => um_get_metadefault('profile_icons'),
- 'options' => array(
- 'field' => __('Show inside text field','ultimate-member'),
- 'label' => __('Show with label','ultimate-member'),
- 'off' => __('Turn off','ultimate-member'),
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_primary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Profile Primary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('profile_primary_btn_word'),
- 'tooltip' => __('The text that is used for updating profile button','ultimate-member'),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'profile_secondary_btn',
- 'type' => 'checkbox',
- 'label' => __( 'Profile Secondary Button','ultimate-member' ),
- 'default' => um_get_metadefault('profile_secondary_btn'),
- 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
- ),
- array(
- 'id' => 'profile_secondary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Profile Secondary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('profile_secondary_btn_word'),
- 'tooltip' => __('The text that is used for cancelling update profile button','ultimate-member'),
- 'conditional' => array( 'profile_secondary_btn', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'default_avatar',
- 'type' => 'media',
- 'label' => __('Default Profile Photo', 'ultimate-member'),
- 'tooltip' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member'),
- 'upload_frame_title'=> __('Select Default Profile Photo', 'ultimate-member'),
- 'default' => array(
- 'url' => um_url . 'assets/img/default_avatar.jpg',
- ),
- ),
- array(
- 'id' => 'default_cover',
- 'type' => 'media',
- 'url' => true,
- 'preview' => false,
- 'label' => __('Default Cover Photo', 'ultimate-member'),
- 'tooltip' => __('You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member'),
- 'upload_frame_title'=> __('Select Default Cover Photo', 'ultimate-member'),
- ),
- array(
- 'id' => 'profile_photosize',
- 'type' => 'text',
- 'label' => __( 'Profile Photo Size','ultimate-member' ),
- 'default' => um_get_metadefault('profile_photosize'),
- 'tooltip' => __('The global default of profile photo size. This can be overridden by individual form settings','ultimate-member'),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_cover_enabled',
- 'type' => 'checkbox',
- 'label' => __( 'Profile Cover Photos','ultimate-member' ),
- 'default' => 1,
- 'tooltip' => __('Switch on/off the profile cover photos','ultimate-member'),
- ),
- array(
- 'id' => 'profile_cover_ratio',
- 'type' => 'select',
- 'label' => __( 'Profile Cover Ratio','ultimate-member' ),
- 'tooltip' => __( 'Choose global ratio for cover photos of profiles','ultimate-member' ),
- 'default' => um_get_metadefault('profile_cover_ratio'),
- 'options' => array(
- '1.6:1' => '1.6:1',
- '2.7:1' => '2.7:1',
- '2.2:1' => '2.2:1',
- '3.2:1' => '3.2:1',
- ),
- 'conditional' => array( 'profile_cover_enabled', '=', 1 ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_show_metaicon',
- 'type' => 'checkbox',
- 'label' => __( 'Profile Header Meta Text Icon','ultimate-member' ),
- 'default' => 0,
- 'tooltip' => __('Display field icons for related user meta fields in header or not','ultimate-member'),
- ),
- array(
- 'id' => 'profile_show_name',
- 'type' => 'checkbox',
- 'label' => __( 'Show display name in profile header','ultimate-member' ),
- 'default' => um_get_metadefault('profile_show_name'),
- 'tooltip' => __('Switch on/off the user name on profile header','ultimate-member'),
- ),
- array(
- 'id' => 'profile_show_social_links',
- 'type' => 'checkbox',
- 'label' => __( 'Show social links in profile header','ultimate-member' ),
- 'default' => um_get_metadefault('profile_show_social_links'),
- 'tooltip' => __('Switch on/off the social links on profile header','ultimate-member'),
- ),
- array(
- 'id' => 'profile_show_bio',
- 'type' => 'checkbox',
- 'label' => __( 'Show user description in header','ultimate-member' ),
- 'default' => um_get_metadefault('profile_show_bio'),
- 'tooltip' => __('Switch on/off the user description on profile header','ultimate-member'),
- ),
- array(
- 'id' => 'profile_show_html_bio',
- 'type' => 'checkbox',
- 'label' => __( 'Enable html support for user description','ultimate-member' ),
- 'default' => um_get_metadefault('profile_show_html_bio'),
- 'tooltip' => __('Switch on/off to enable/disable support for html tags on user description.','ultimate-member'),
- ),
- array(
- 'id' => 'profile_bio_maxchars',
- 'type' => 'text',
- 'label' => __( 'User description maximum chars','ultimate-member' ),
- 'default' => um_get_metadefault('profile_bio_maxchars'),
- 'tooltip' => __('Maximum number of characters to allow in user description field in header.','ultimate-member'),
- 'conditional' => array( 'profile_show_bio', '=', 1 ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_header_menu',
- 'type' => 'select',
- 'label' => __( 'Profile Header Menu Position','ultimate-member' ),
- 'default' => um_get_metadefault('profile_header_menu'),
- 'tooltip' => __('For incompatible themes, please make the menu open from left instead of bottom by default.','ultimate-member'),
- 'options' => array(
- 'bc' => 'Bottom of Icon',
- 'lc' => 'Left of Icon',
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'profile_empty_text',
- 'type' => 'checkbox',
- 'label' => __( 'Show a custom message if profile is empty','ultimate-member' ),
- 'default' => um_get_metadefault('profile_empty_text'),
- 'tooltip' => __('Switch on/off the custom message that appears when the profile is empty','ultimate-member'),
- ),
- array(
- 'id' => 'profile_empty_text_emo',
- 'type' => 'checkbox',
- 'label' => __( 'Show the emoticon','ultimate-member' ),
- 'default' => um_get_metadefault('profile_empty_text_emo'),
- 'tooltip' => __('Switch on/off the emoticon (sad face) that appears above the message','ultimate-member'),
- 'conditional' => array( 'profile_empty_text', '=', 1 ),
- )
- )
- ),
- 'profile_menu' => array(
- 'title' => __( 'Profile Menu', 'ultimate-member' ),
- 'fields' => $appearances_profile_menu_fields
- ),
- 'registration_form' => array(
- 'title' => __( 'Registration Form', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'register_template',
- 'type' => 'select',
- 'label' => __( 'Registration Default Template','ultimate-member' ),
- 'tooltip' => __( 'This will be the default template to output registration' ),
- 'default' => um_get_metadefault('register_template'),
- 'options' => UM()->shortcodes()->get_templates( 'register' ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'register_max_width',
- 'type' => 'text',
- 'label' => __( 'Registration Maximum Width','ultimate-member' ),
- 'default' => um_get_metadefault('register_max_width'),
- 'tooltip' => __('The maximum width this shortcode can take from the page width','ultimate-member'),
- 'size' => 'small'
- ),
- array(
- 'id' => 'register_align',
- 'type' => 'select',
- 'label' => __( 'Registration Shortcode Alignment','ultimate-member' ),
- 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here','ultimate-member' ),
- 'default' => um_get_metadefault('register_align'),
- 'options' => array(
- 'center' => __('Centered'),
- 'left' => __('Left aligned'),
- 'right' => __('Right aligned'),
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'register_icons',
- 'type' => 'select',
- 'label' => __( 'Registration Field Icons','ultimate-member' ),
- 'tooltip' => __( 'This controls the display of field icons in the registration form','ultimate-member' ),
- 'default' => um_get_metadefault('register_icons'),
- 'options' => array(
- 'field' => __('Show inside text field'),
- 'label' => __('Show with label'),
- 'off' => __('Turn off'),
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'register_primary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Registration Primary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('register_primary_btn_word'),
- 'tooltip' => __('The text that is used for primary button text','ultimate-member'),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'register_secondary_btn',
- 'type' => 'checkbox',
- 'label' => __( 'Registration Secondary Button','ultimate-member' ),
- 'default' => 1,
- 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
- ),
- array(
- 'id' => 'register_secondary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Registration Secondary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('register_secondary_btn_word'),
- 'tooltip' => __('The text that is used for the secondary button text','ultimate-member'),
- 'conditional' => array( 'register_secondary_btn', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'register_secondary_btn_url',
- 'type' => 'text',
- 'label' => __( 'Registration Secondary Button URL','ultimate-member' ),
- 'default' => um_get_metadefault('register_secondary_btn_url'),
- 'tooltip' => __('You can replace default link for this button by entering custom URL','ultimate-member'),
- 'conditional' => array( 'register_secondary_btn', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'register_role',
- 'type' => 'select',
- 'label' => __( 'Registration Default Role','ultimate-member' ),
- 'tooltip' => __( 'This will be the default role assigned to users registering thru registration form','ultimate-member' ),
- 'default' => um_get_metadefault('register_role'),
- 'options' => UM()->roles()->get_roles( $add_default = 'Default' ),
- 'size' => 'small'
- )
- )
- ),
- 'login_form' => array(
- 'title' => __( 'Login Form', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'login_template',
- 'type' => 'select',
- 'label' => __( 'Login Default Template','ultimate-member' ),
- 'tooltip' => __( 'This will be the default template to output login','ultimate-member' ),
- 'default' => um_get_metadefault('login_template'),
- 'options' => UM()->shortcodes()->get_templates( 'login' ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'login_max_width',
- 'type' => 'text',
- 'label' => __( 'Login Maximum Width','ultimate-member' ),
- 'default' => um_get_metadefault('login_max_width'),
- 'tooltip' => __('The maximum width this shortcode can take from the page width','ultimate-member'),
- 'size' => 'small'
- ),
- array(
- 'id' => 'login_align',
- 'type' => 'select',
- 'label' => __( 'Login Shortcode Alignment','ultimate-member' ),
- 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here','ultimate-member' ),
- 'default' => um_get_metadefault('login_align'),
- 'options' => array(
- 'center' => __('Centered','ultimate-member'),
- 'left' => __('Left aligned','ultimate-member'),
- 'right' => __('Right aligned','ultimate-member'),
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'login_icons',
- 'type' => 'select',
- 'label' => __( 'Login Field Icons','ultimate-member' ),
- 'tooltip' => __( 'This controls the display of field icons in the login form','ultimate-member' ),
- 'default' => um_get_metadefault('login_icons'),
- 'options' => array(
- 'field' => __('Show inside text field','ultimate-member'),
- 'label' => __('Show with label','ultimate-member'),
- 'off' => __('Turn off','ultimate-member'),
- ),
- 'size' => 'small'
- ),
- array(
- 'id' => 'login_primary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Login Primary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('login_primary_btn_word'),
- 'tooltip' => __('The text that is used for primary button text','ultimate-member'),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'login_secondary_btn',
- 'type' => 'checkbox',
- 'label' => __( 'Login Secondary Button','ultimate-member' ),
- 'default' => 1,
- 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
- ),
- array(
- 'id' => 'login_secondary_btn_word',
- 'type' => 'text',
- 'label' => __( 'Login Secondary Button Text','ultimate-member' ),
- 'default' => um_get_metadefault('login_secondary_btn_word'),
- 'tooltip' => __('The text that is used for the secondary button text','ultimate-member'),
- 'conditional' => array( 'login_secondary_btn', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'login_secondary_btn_url',
- 'type' => 'text',
- 'label' => __( 'Login Secondary Button URL','ultimate-member' ),
- 'default' => um_get_metadefault('login_secondary_btn_url'),
- 'tooltip' => __('You can replace default link for this button by entering custom URL','ultimate-member'),
- 'conditional' => array( 'login_secondary_btn', '=', 1 ),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'login_forgot_pass_link',
- 'type' => 'checkbox',
- 'label' => __( 'Login Forgot Password Link','ultimate-member' ),
- 'default' => 1,
- 'tooltip' => __('Switch on/off the forgot password link in login form','ultimate-member'),
- ),
- array(
- 'id' => 'login_show_rememberme',
- 'type' => 'checkbox',
- 'label' => __( 'Show "Remember Me"','ultimate-member' ),
- 'default' => 1,
- 'tooltip' => __('Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.','ultimate-member'),
- )
- )
- )
- )
- ),
- 'extensions' => array(
- 'title' => __( 'Extensions', 'ultimate-member' )
- ),
- 'licenses' => array(
- 'title' => __( 'Licenses', 'ultimate-member' ),
- ),
- 'misc' => array(
- 'title' => __( 'Misc', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'id' => 'form_asterisk',
- 'type' => 'checkbox',
- 'label' => __( 'Show an asterisk for required fields','ultimate-member' ),
- ),
- array(
- 'id' => 'profile_title',
- 'type' => 'text',
- 'label' => __('User Profile Title','ultimate-member'),
- 'tooltip' => __('This is the title that is displayed on a specific user profile','ultimate-member'),
- 'size' => 'medium'
- ),
- array(
- 'id' => 'profile_desc',
- 'type' => 'textarea',
- 'label' => __( 'User Profile Dynamic Meta Description','ultimate-member' ),
- 'tooltip' => __('This will be used in the meta description that is available for search-engines.','ultimate-member'),
- 'args' => array(
- 'textarea_rows' => 6
- )
- ),
- array(
- 'id' => 'menu_item_workaround',
- 'type' => 'checkbox',
- 'label' => __( 'WP Menu Item Custom Fields Workaround','ultimate-member' ),
- 'tooltip' => __( 'Turn on this option if you don\'t see WP Menu Item Restriction options','ultimate-member' ),
- ),
- array(
- 'id' => 'um_allow_tracking',
- 'type' => 'checkbox',
- 'label' => __( 'Allow Tracking','ultimate-member' ),
- ),
- array(
- 'id' => 'uninstall_on_delete',
- 'type' => 'checkbox',
- 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ),
- 'tooltip' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ),
- )
- )
- ),
- 'install_info' => array(
- 'title' => __( 'Install Info', 'ultimate-member' ),
- 'fields' => array(
- array(
- 'type' => 'install_info',
- ),
- )
- ),
- ) );
+ array(
+ 'id' => 'profile_area_max_width',
+ 'type' => 'text',
+ 'label' => __( 'Profile Area Maximum Width','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_area_max_width'),
+ 'tooltip' => __('The maximum width of the profile area inside profile (below profile header)','ultimate-member'),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_icons',
+ 'type' => 'select',
+ 'label' => __( 'Profile Field Icons' ),
+ 'tooltip' => __( 'This is applicable for edit mode only','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_icons'),
+ 'options' => array(
+ 'field' => __('Show inside text field','ultimate-member'),
+ 'label' => __('Show with label','ultimate-member'),
+ 'off' => __('Turn off','ultimate-member'),
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_primary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Profile Primary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_primary_btn_word'),
+ 'tooltip' => __('The text that is used for updating profile button','ultimate-member'),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'profile_secondary_btn',
+ 'type' => 'checkbox',
+ 'label' => __( 'Profile Secondary Button','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_secondary_btn'),
+ 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_secondary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Profile Secondary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_secondary_btn_word'),
+ 'tooltip' => __('The text that is used for cancelling update profile button','ultimate-member'),
+ 'conditional' => array( 'profile_secondary_btn', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'default_avatar',
+ 'type' => 'media',
+ 'label' => __('Default Profile Photo', 'ultimate-member'),
+ 'tooltip' => __('You can change the default profile picture globally here. Please make sure that the photo is 300x300px.', 'ultimate-member'),
+ 'upload_frame_title'=> __('Select Default Profile Photo', 'ultimate-member'),
+ 'default' => array(
+ 'url' => um_url . 'assets/img/default_avatar.jpg',
+ ),
+ ),
+ array(
+ 'id' => 'default_cover',
+ 'type' => 'media',
+ 'url' => true,
+ 'preview' => false,
+ 'label' => __('Default Cover Photo', 'ultimate-member'),
+ 'tooltip' => __('You can change the default cover photo globally here. Please make sure that the default cover is large enough and respects the ratio you are using for cover photos.', 'ultimate-member'),
+ 'upload_frame_title'=> __('Select Default Cover Photo', 'ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_photosize',
+ 'type' => 'text',
+ 'label' => __( 'Profile Photo Size','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_photosize'),
+ 'tooltip' => __('The global default of profile photo size. This can be overridden by individual form settings','ultimate-member'),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_cover_enabled',
+ 'type' => 'checkbox',
+ 'label' => __( 'Profile Cover Photos','ultimate-member' ),
+ 'default' => 1,
+ 'tooltip' => __('Switch on/off the profile cover photos','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_cover_ratio',
+ 'type' => 'select',
+ 'label' => __( 'Profile Cover Ratio','ultimate-member' ),
+ 'tooltip' => __( 'Choose global ratio for cover photos of profiles','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_cover_ratio'),
+ 'options' => array(
+ '1.6:1' => '1.6:1',
+ '2.7:1' => '2.7:1',
+ '2.2:1' => '2.2:1',
+ '3.2:1' => '3.2:1',
+ ),
+ 'conditional' => array( 'profile_cover_enabled', '=', 1 ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_show_metaicon',
+ 'type' => 'checkbox',
+ 'label' => __( 'Profile Header Meta Text Icon','ultimate-member' ),
+ 'default' => 0,
+ 'tooltip' => __('Display field icons for related user meta fields in header or not','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_show_name',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show display name in profile header','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_show_name'),
+ 'tooltip' => __('Switch on/off the user name on profile header','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_show_social_links',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show social links in profile header','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_show_social_links'),
+ 'tooltip' => __('Switch on/off the social links on profile header','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_show_bio',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show user description in header','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_show_bio'),
+ 'tooltip' => __('Switch on/off the user description on profile header','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_show_html_bio',
+ 'type' => 'checkbox',
+ 'label' => __( 'Enable html support for user description','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_show_html_bio'),
+ 'tooltip' => __('Switch on/off to enable/disable support for html tags on user description.','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_bio_maxchars',
+ 'type' => 'text',
+ 'label' => __( 'User description maximum chars','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_bio_maxchars'),
+ 'tooltip' => __('Maximum number of characters to allow in user description field in header.','ultimate-member'),
+ 'conditional' => array( 'profile_show_bio', '=', 1 ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_header_menu',
+ 'type' => 'select',
+ 'label' => __( 'Profile Header Menu Position','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_header_menu'),
+ 'tooltip' => __('For incompatible themes, please make the menu open from left instead of bottom by default.','ultimate-member'),
+ 'options' => array(
+ 'bc' => 'Bottom of Icon',
+ 'lc' => 'Left of Icon',
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'profile_empty_text',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show a custom message if profile is empty','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_empty_text'),
+ 'tooltip' => __('Switch on/off the custom message that appears when the profile is empty','ultimate-member'),
+ ),
+ array(
+ 'id' => 'profile_empty_text_emo',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show the emoticon','ultimate-member' ),
+ 'default' => um_get_metadefault('profile_empty_text_emo'),
+ 'tooltip' => __('Switch on/off the emoticon (sad face) that appears above the message','ultimate-member'),
+ 'conditional' => array( 'profile_empty_text', '=', 1 ),
+ )
+ )
+ ),
+ 'profile_menu' => array(
+ 'title' => __( 'Profile Menu', 'ultimate-member' ),
+ 'fields' => $appearances_profile_menu_fields
+ ),
+ 'registration_form' => array(
+ 'title' => __( 'Registration Form', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'register_template',
+ 'type' => 'select',
+ 'label' => __( 'Registration Default Template','ultimate-member' ),
+ 'tooltip' => __( 'This will be the default template to output registration' ),
+ 'default' => um_get_metadefault('register_template'),
+ 'options' => UM()->shortcodes()->get_templates( 'register' ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'register_max_width',
+ 'type' => 'text',
+ 'label' => __( 'Registration Maximum Width','ultimate-member' ),
+ 'default' => um_get_metadefault('register_max_width'),
+ 'tooltip' => __('The maximum width this shortcode can take from the page width','ultimate-member'),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'register_align',
+ 'type' => 'select',
+ 'label' => __( 'Registration Shortcode Alignment','ultimate-member' ),
+ 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here','ultimate-member' ),
+ 'default' => um_get_metadefault('register_align'),
+ 'options' => array(
+ 'center' => __('Centered'),
+ 'left' => __('Left aligned'),
+ 'right' => __('Right aligned'),
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'register_icons',
+ 'type' => 'select',
+ 'label' => __( 'Registration Field Icons','ultimate-member' ),
+ 'tooltip' => __( 'This controls the display of field icons in the registration form','ultimate-member' ),
+ 'default' => um_get_metadefault('register_icons'),
+ 'options' => array(
+ 'field' => __('Show inside text field'),
+ 'label' => __('Show with label'),
+ 'off' => __('Turn off'),
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'register_primary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Registration Primary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('register_primary_btn_word'),
+ 'tooltip' => __('The text that is used for primary button text','ultimate-member'),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'register_secondary_btn',
+ 'type' => 'checkbox',
+ 'label' => __( 'Registration Secondary Button','ultimate-member' ),
+ 'default' => 1,
+ 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
+ ),
+ array(
+ 'id' => 'register_secondary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Registration Secondary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('register_secondary_btn_word'),
+ 'tooltip' => __('The text that is used for the secondary button text','ultimate-member'),
+ 'conditional' => array( 'register_secondary_btn', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'register_secondary_btn_url',
+ 'type' => 'text',
+ 'label' => __( 'Registration Secondary Button URL','ultimate-member' ),
+ 'default' => um_get_metadefault('register_secondary_btn_url'),
+ 'tooltip' => __('You can replace default link for this button by entering custom URL','ultimate-member'),
+ 'conditional' => array( 'register_secondary_btn', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'register_role',
+ 'type' => 'select',
+ 'label' => __( 'Registration Default Role','ultimate-member' ),
+ 'tooltip' => __( 'This will be the default role assigned to users registering thru registration form','ultimate-member' ),
+ 'default' => um_get_metadefault('register_role'),
+ 'options' => UM()->roles()->get_roles( $add_default = 'Default' ),
+ 'size' => 'small'
+ )
+ )
+ ),
+ 'login_form' => array(
+ 'title' => __( 'Login Form', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'login_template',
+ 'type' => 'select',
+ 'label' => __( 'Login Default Template','ultimate-member' ),
+ 'tooltip' => __( 'This will be the default template to output login','ultimate-member' ),
+ 'default' => um_get_metadefault('login_template'),
+ 'options' => UM()->shortcodes()->get_templates( 'login' ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'login_max_width',
+ 'type' => 'text',
+ 'label' => __( 'Login Maximum Width','ultimate-member' ),
+ 'default' => um_get_metadefault('login_max_width'),
+ 'tooltip' => __('The maximum width this shortcode can take from the page width','ultimate-member'),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'login_align',
+ 'type' => 'select',
+ 'label' => __( 'Login Shortcode Alignment','ultimate-member' ),
+ 'tooltip' => __( 'The shortcode is centered by default unless you specify otherwise here','ultimate-member' ),
+ 'default' => um_get_metadefault('login_align'),
+ 'options' => array(
+ 'center' => __('Centered','ultimate-member'),
+ 'left' => __('Left aligned','ultimate-member'),
+ 'right' => __('Right aligned','ultimate-member'),
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'login_icons',
+ 'type' => 'select',
+ 'label' => __( 'Login Field Icons','ultimate-member' ),
+ 'tooltip' => __( 'This controls the display of field icons in the login form','ultimate-member' ),
+ 'default' => um_get_metadefault('login_icons'),
+ 'options' => array(
+ 'field' => __('Show inside text field','ultimate-member'),
+ 'label' => __('Show with label','ultimate-member'),
+ 'off' => __('Turn off','ultimate-member'),
+ ),
+ 'size' => 'small'
+ ),
+ array(
+ 'id' => 'login_primary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Login Primary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('login_primary_btn_word'),
+ 'tooltip' => __('The text that is used for primary button text','ultimate-member'),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'login_secondary_btn',
+ 'type' => 'checkbox',
+ 'label' => __( 'Login Secondary Button','ultimate-member' ),
+ 'default' => 1,
+ 'tooltip' => __('Switch on/off the secondary button display in the form','ultimate-member'),
+ ),
+ array(
+ 'id' => 'login_secondary_btn_word',
+ 'type' => 'text',
+ 'label' => __( 'Login Secondary Button Text','ultimate-member' ),
+ 'default' => um_get_metadefault('login_secondary_btn_word'),
+ 'tooltip' => __('The text that is used for the secondary button text','ultimate-member'),
+ 'conditional' => array( 'login_secondary_btn', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'login_secondary_btn_url',
+ 'type' => 'text',
+ 'label' => __( 'Login Secondary Button URL','ultimate-member' ),
+ 'default' => um_get_metadefault('login_secondary_btn_url'),
+ 'tooltip' => __('You can replace default link for this button by entering custom URL','ultimate-member'),
+ 'conditional' => array( 'login_secondary_btn', '=', 1 ),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'login_forgot_pass_link',
+ 'type' => 'checkbox',
+ 'label' => __( 'Login Forgot Password Link','ultimate-member' ),
+ 'default' => 1,
+ 'tooltip' => __('Switch on/off the forgot password link in login form','ultimate-member'),
+ ),
+ array(
+ 'id' => 'login_show_rememberme',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show "Remember Me"','ultimate-member' ),
+ 'default' => 1,
+ 'tooltip' => __('Allow users to choose If they want to stay signed in even after closing the browser. If you do not show this option, the default will be to not remember login session.','ultimate-member'),
+ )
+ )
+ )
+ )
+ ),
+ 'extensions' => array(
+ 'title' => __( 'Extensions', 'ultimate-member' )
+ ),
+ 'licenses' => array(
+ 'title' => __( 'Licenses', 'ultimate-member' ),
+ ),
+ 'misc' => array(
+ 'title' => __( 'Misc', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'id' => 'form_asterisk',
+ 'type' => 'checkbox',
+ 'label' => __( 'Show an asterisk for required fields','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'profile_title',
+ 'type' => 'text',
+ 'label' => __('User Profile Title','ultimate-member'),
+ 'tooltip' => __('This is the title that is displayed on a specific user profile','ultimate-member'),
+ 'size' => 'medium'
+ ),
+ array(
+ 'id' => 'profile_desc',
+ 'type' => 'textarea',
+ 'label' => __( 'User Profile Dynamic Meta Description','ultimate-member' ),
+ 'tooltip' => __('This will be used in the meta description that is available for search-engines.','ultimate-member'),
+ 'args' => array(
+ 'textarea_rows' => 6
+ )
+ ),
+ array(
+ 'id' => 'menu_item_workaround',
+ 'type' => 'checkbox',
+ 'label' => __( 'WP Menu Item Custom Fields Workaround','ultimate-member' ),
+ 'tooltip' => __( 'Turn on this option if you don\'t see WP Menu Item Restriction options','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'um_allow_tracking',
+ 'type' => 'checkbox',
+ 'label' => __( 'Allow Tracking','ultimate-member' ),
+ ),
+ array(
+ 'id' => 'uninstall_on_delete',
+ 'type' => 'checkbox',
+ 'label' => __( 'Remove Data on Uninstall?', 'ultimate-member' ),
+ 'tooltip' => __( 'Check this box if you would like Ultimate Member to completely remove all of its data when the plugin/extensions are deleted.', 'ultimate-member' ),
+ )
+ )
+ ),
+ 'install_info' => array(
+ 'title' => __( 'Install Info', 'ultimate-member' ),
+ 'fields' => array(
+ array(
+ 'type' => 'install_info',
+ ),
+ )
+ ),
+ ) );
- }
+ }
- function sorting_licenses_options( $settings ) {
- //sorting licenses
- if ( empty( $settings['licenses']['fields'] ) )
- return $settings;
- $licenses = $settings['licenses']['fields'];
- @uasort( $licenses, create_function( '$a,$b', 'return strnatcasecmp($a["label"],$b["label"]);' ) );
- $settings['licenses']['fields'] = $licenses;
+ /**
+ * @param $settings
+ *
+ * @return mixed
+ */
+ function sorting_licenses_options( $settings ) {
+ //sorting licenses
+ if ( empty( $settings['licenses']['fields'] ) )
+ return $settings;
+ $licenses = $settings['licenses']['fields'];
+ @uasort( $licenses, create_function( '$a,$b', 'return strnatcasecmp($a["label"],$b["label"]);' ) );
+ $settings['licenses']['fields'] = $licenses;
- //sorting extensions
- if ( empty( $settings['extensions']['sections'] ) )
- return $settings;
+ //sorting extensions
+ if ( empty( $settings['extensions']['sections'] ) )
+ return $settings;
- $extensions = $settings['extensions']['sections'];
- @uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
+ $extensions = $settings['extensions']['sections'];
+ @uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
- $keys = array_keys( $extensions );
- if ( $keys[0] != "" ) {
- $new_key = strtolower( str_replace( " ", "_", $extensions[""]['title'] ) );
- $temp = $extensions[""];
- $extensions[$new_key] = $temp;
- $extensions[""] = $extensions[$keys[0]];
- unset( $extensions[$keys[0]] );
- @uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
- }
+ $keys = array_keys( $extensions );
+ if ( $keys[0] != "" ) {
+ $new_key = strtolower( str_replace( " ", "_", $extensions[""]['title'] ) );
+ $temp = $extensions[""];
+ $extensions[$new_key] = $temp;
+ $extensions[""] = $extensions[$keys[0]];
+ unset( $extensions[$keys[0]] );
+ @uasort( $extensions, create_function( '$a,$b', 'return strnatcasecmp($a["title"],$b["title"]);' ) );
+ }
- $settings['extensions']['sections'] = $extensions;
+ $settings['extensions']['sections'] = $extensions;
- return $settings;
- }
+ return $settings;
+ }
- function get_section_fields( $tab, $section ) {
+ /**
+ * @param $tab
+ * @param $section
+ *
+ * @return array
+ */
+ function get_section_fields( $tab, $section ) {
- if ( empty( $this->settings_structure[$tab] ) )
- return array();
+ if ( empty( $this->settings_structure[$tab] ) )
+ return array();
- if ( ! empty( $this->settings_structure[$tab]['sections'][$section]['fields'] ) ) {
- return $this->settings_structure[$tab]['sections'][$section]['fields'];
- } elseif ( ! empty( $this->settings_structure[$tab]['fields'] ) ) {
- return $this->settings_structure[$tab]['fields'];
- }
+ if ( ! empty( $this->settings_structure[$tab]['sections'][$section]['fields'] ) ) {
+ return $this->settings_structure[$tab]['sections'][$section]['fields'];
+ } elseif ( ! empty( $this->settings_structure[$tab]['fields'] ) ) {
+ return $this->settings_structure[$tab]['fields'];
+ }
- return array();
- }
+ return array();
+ }
- /***
- *** @setup admin menu
- ***/
- function primary_admin_menu() {
+ /**
+ * Setup admin menu
+ */
+ function primary_admin_menu() {
add_submenu_page( 'ultimatemember', __( 'Settings', 'ultimate-member' ), __( 'Settings', 'ultimate-member' ), 'manage_options', 'um_options', array( &$this, 'settings_page' ) );
}
- function settings_page() {
- $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
- $current_subtab = empty( $_GET['section'] ) ? '' : urldecode( $_GET['section'] );
+ /**
+ * Settings page callback
+ */
+ function settings_page() {
+ $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
+ $current_subtab = empty( $_GET['section'] ) ? '' : urldecode( $_GET['section'] );
- $settings_struct = $this->settings_structure[$current_tab];
+ $settings_struct = $this->settings_structure[$current_tab];
- //remove not option hidden fields
- if ( ! empty( $settings_struct['fields'] ) ) {
- foreach ( $settings_struct['fields'] as $field_key=>$field_options ) {
+ //remove not option hidden fields
+ if ( ! empty( $settings_struct['fields'] ) ) {
+ foreach ( $settings_struct['fields'] as $field_key=>$field_options ) {
- if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false )
- unset( $settings_struct['fields'][$field_key] );
+ if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false )
+ unset( $settings_struct['fields'][$field_key] );
- }
- }
+ }
+ }
- if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) )
- um_js_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) );
+ if ( empty( $settings_struct['fields'] ) && empty( $settings_struct['sections'] ) )
+ um_js_redirect( add_query_arg( array( 'page' => 'um_options' ), admin_url( 'admin.php' ) ) );
- if ( ! empty( $settings_struct['sections'] ) ) {
- if ( empty( $settings_struct['sections'][$current_subtab] ) )
- um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) );
- }
+ if ( ! empty( $settings_struct['sections'] ) ) {
+ if ( empty( $settings_struct['sections'][$current_subtab] ) )
+ um_js_redirect( add_query_arg( array( 'page' => 'um_options', 'tab' => $current_tab ), admin_url( 'admin.php' ) ) );
+ }
- echo '
' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . ' ';
+ echo '
' . __( 'Ultimate Member - Settings', 'ultimate-member' ) . ' ';
- echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
+ echo $this->generate_tabs_menu() . $this->generate_subtabs_menu( $current_tab );
- /**
- * UM hook
- *
- * @type action
- * @title um_settings_page_before_{$current_tab}_{$current_subtab}_content
- * @description Show some content before settings page content
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'function_name', 10 );
- * @example
- *
- */
- do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_settings_page_before_{$current_tab}_{$current_subtab}_content
+ * @description Show some content before settings page content
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_settings_page_before_{$current_tab}_{$current_subtab}_content', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( "um_settings_page_before_" . $current_tab . "_" . $current_subtab . "_content" );
- if ( 'licenses' == $current_tab || 'install_info' == $current_tab ) {
+ if ( 'licenses' == $current_tab || 'install_info' == $current_tab ) {
- /**
- * UM hook
- *
- * @type action
- * @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
- * @description Show some content before section content at settings page
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
- * @example
- *
- */
- do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_settings_page_{$current_tab}_{$current_subtab}_before_section
+ * @description Show some content before section content at settings page
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_settings_page_{$current_tab}_{$current_subtab}_before_section', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( "um_settings_page_" . $current_tab . "_" . $current_subtab . "_before_section" );
- $section_fields = $this->get_section_fields( $current_tab, $current_subtab );
+ $section_fields = $this->get_section_fields( $current_tab, $current_subtab );
- /**
- * UM hook
- *
- * @type filter
- * @title um_settings_section_{$current_tab}_{$current_subtab}_content
- * @description Render settings section
- * @input_vars
- * [{"var":"$content","type":"string","desc":"Section content"},
- * {"var":"$section_fields","type":"array","desc":"Section Fields"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
- * @example
- *
- */
- echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
- $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
- $section_fields
- );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_settings_section_{$current_tab}_{$current_subtab}_content
+ * @description Render settings section
+ * @input_vars
+ * [{"var":"$content","type":"string","desc":"Section content"},
+ * {"var":"$section_fields","type":"array","desc":"Section Fields"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_settings_section_{$current_tab}_{$current_subtab}_content', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ echo apply_filters( 'um_settings_section_' . $current_tab . '_' . $current_subtab . '_content',
+ $this->render_settings_section( $section_fields, $current_tab, $current_subtab ),
+ $section_fields
+ );
- } else { ?>
+ } else { ?>
-
-
+
+
+
+
- ';*/
- }
+ /*echo '
';*/
+ }
- /**
- * Generate pages tabs
- *
- * @param string $page
- * @return string
- */
- function generate_tabs_menu( $page = 'settings' ) {
+ /**
+ * Generate pages tabs
+ *
+ * @param string $page
+ * @return string
+ */
+ function generate_tabs_menu( $page = 'settings' ) {
- $tabs = '
';
+ $tabs = '';
- switch( $page ) {
- case 'settings':
- $menu_tabs = array();
- foreach ( $this->settings_structure as $slug => $tab ) {
- if ( ! empty( $tab['fields'] ) ) {
- foreach ( $tab['fields'] as $field_key=>$field_options ) {
- if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
- unset( $tab['fields'][$field_key] );
- }
- }
- }
+ switch( $page ) {
+ case 'settings':
+ $menu_tabs = array();
+ foreach ( $this->settings_structure as $slug => $tab ) {
+ if ( ! empty( $tab['fields'] ) ) {
+ foreach ( $tab['fields'] as $field_key=>$field_options ) {
+ if ( isset( $field_options['is_option'] ) && $field_options['is_option'] === false ) {
+ unset( $tab['fields'][$field_key] );
+ }
+ }
+ }
- if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) )
- $menu_tabs[$slug] = $tab['title'];
- }
+ if ( ! empty( $tab['fields'] ) || ! empty( $tab['sections'] ) )
+ $menu_tabs[$slug] = $tab['title'];
+ }
- $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
- foreach ( $menu_tabs as $name=>$label ) {
- $active = ( $current_tab == $name ) ? 'nav-tab-active' : '';
- $tabs .= '' .
- $label .
- ' ';
- }
+ $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
+ foreach ( $menu_tabs as $name=>$label ) {
+ $active = ( $current_tab == $name ) ? 'nav-tab-active' : '';
+ $tabs .= '' .
+ $label .
+ ' ';
+ }
- break;
- default:
- /**
- * UM hook
- *
- * @type filter
- * @title um_generate_tabs_menu_{$page}
- * @description Generate tabs menu
- * @input_vars
- * [{"var":"$tabs","type":"array","desc":"UM menu tabs"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_generate_tabs_menu_{$page}', 'function_name', 10, 1 );
- * @example
- *
- */
- $tabs = apply_filters( 'um_generate_tabs_menu_' . $page, $tabs );
- break;
- }
+ break;
+ default:
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_generate_tabs_menu_{$page}
+ * @description Generate tabs menu
+ * @input_vars
+ * [{"var":"$tabs","type":"array","desc":"UM menu tabs"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_generate_tabs_menu_{$page}', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $tabs = apply_filters( 'um_generate_tabs_menu_' . $page, $tabs );
+ break;
+ }
- return $tabs . ' ';
- }
+ return $tabs . ' ';
+ }
+ /**
+ * @param string $tab
+ *
+ * @return string
+ */
+ function generate_subtabs_menu( $tab = '' ) {
+ if ( empty( $this->settings_structure[$tab]['sections'] ) )
+ return '';
- function generate_subtabs_menu( $tab = '' ) {
- if ( empty( $this->settings_structure[$tab]['sections'] ) )
- return '';
+ $menu_subtabs = array();
+ foreach ( $this->settings_structure[$tab]['sections'] as $slug => $subtab ) {
+ $menu_subtabs[$slug] = $subtab['title'];
+ }
- $menu_subtabs = array();
- foreach ( $this->settings_structure[$tab]['sections'] as $slug => $subtab ) {
- $menu_subtabs[$slug] = $subtab['title'];
- }
+ $subtabs = '
';
- $subtabs = '';
+ $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
+ $current_subtab = empty( $_GET['section'] ) ? '' : urldecode( $_GET['section'] );
+ foreach ( $menu_subtabs as $name => $label ) {
+ $active = ( $current_subtab == $name ) ? 'current' : '';
+ $subtabs .= ''
+ . $label .
+ ' | ';
+ }
- $current_tab = empty( $_GET['tab'] ) ? '' : urldecode( $_GET['tab'] );
- $current_subtab = empty( $_GET['section'] ) ? '' : urldecode( $_GET['section'] );
- foreach ( $menu_subtabs as $name => $label ) {
- $active = ( $current_subtab == $name ) ? 'current' : '';
- $subtabs .= ''
- . $label .
- ' | ';
- }
-
- return substr( $subtabs, 0, -3 ) . ' ';
- }
+ return substr( $subtabs, 0, -3 ) . ' ';
+ }
- /**
- * Handler for settings forms
- * when "Save Settings" button click
- *
- */
- function save_settings_handler() {
- if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
- /**
- * UM hook
- *
- * @type action
- * @title um_settings_before_save
- * @description Before settings save action
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_settings_before_save', 'function_name', 10 );
- * @example
- *
- */
- do_action( "um_settings_before_save" );
+ /**
+ * Handler for settings forms
+ * when "Save Settings" button click
+ *
+ */
+ function save_settings_handler() {
+ if ( isset( $_POST['um-settings-action'] ) && 'save' == $_POST['um-settings-action'] && ! empty( $_POST['um_options'] ) ) {
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_settings_before_save
+ * @description Before settings save action
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_settings_before_save', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( "um_settings_before_save" );
- /**
- * UM hook
- *
- * @type filter
- * @title um_change_settings_before_save
- * @description Change settings before save
- * @input_vars
- * [{"var":"$settings","type":"array","desc":"UM Settings on save"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_change_settings_before_save', 'function_name', 10, 1 );
- * @example
- *
- */
- $settings = apply_filters( 'um_change_settings_before_save', $_POST['um_options'] );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_change_settings_before_save
+ * @description Change settings before save
+ * @input_vars
+ * [{"var":"$settings","type":"array","desc":"UM Settings on save"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_change_settings_before_save', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $settings = apply_filters( 'um_change_settings_before_save', $_POST['um_options'] );
- foreach ( $settings as $key => $value ) {
- UM()->options()->update( $key, $value );
- }
+ foreach ( $settings as $key => $value ) {
+ UM()->options()->update( $key, $value );
+ }
- /**
- * UM hook
- *
- * @type action
- * @title um_settings_save
- * @description After settings save action
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_settings_save', 'function_name', 10 );
- * @example
- *
- */
- do_action( "um_settings_save" );
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_settings_save
+ * @description After settings save action
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_settings_save', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( "um_settings_save" );
- //redirect after save settings
- $arg = array(
- 'page' => 'um_options',
- );
+ //redirect after save settings
+ $arg = array(
+ 'page' => 'um_options',
+ );
- if ( ! empty( $_GET['tab'] ) )
- $arg['tab'] = $_GET['tab'];
+ if ( ! empty( $_GET['tab'] ) )
+ $arg['tab'] = $_GET['tab'];
- if ( ! empty( $_GET['section'] ) )
- $arg['section'] = $_GET['section'];
+ if ( ! empty( $_GET['section'] ) )
+ $arg['section'] = $_GET['section'];
- um_js_redirect( add_query_arg( $arg, admin_url( 'admin.php' ) ) );
- }
- }
+ um_js_redirect( add_query_arg( $arg, admin_url( 'admin.php' ) ) );
+ }
+ }
- /**
- * Remove empty values from multi text fields
- *
- * @param $settings
- * @return array
- */
- function remove_empty_values( $settings ) {
- $tab = '';
- if ( ! empty( $_GET['tab'] ) )
- $tab = $_GET['tab'];
+ /**
+ * Remove empty values from multi text fields
+ *
+ * @param $settings
+ * @return array
+ */
+ function remove_empty_values( $settings ) {
+ $tab = '';
+ if ( ! empty( $_GET['tab'] ) )
+ $tab = $_GET['tab'];
- $section = '';
- if ( ! empty( $_GET['section'] ) )
- $section = $_GET['section'];
+ $section = '';
+ if ( ! empty( $_GET['section'] ) )
+ $section = $_GET['section'];
- if ( isset( $this->settings_structure[$tab]['sections'][$section]['fields'] ) )
- $fields = $this->settings_structure[$tab]['sections'][$section]['fields'];
- else
- $fields = $this->settings_structure[$tab]['fields'];
+ if ( isset( $this->settings_structure[$tab]['sections'][$section]['fields'] ) )
+ $fields = $this->settings_structure[$tab]['sections'][$section]['fields'];
+ else
+ $fields = $this->settings_structure[$tab]['fields'];
- if ( empty( $fields ) )
- return $settings;
+ if ( empty( $fields ) )
+ return $settings;
- $filtered_settings = array();
- foreach ( $settings as $key=>$value ) {
+ $filtered_settings = array();
+ foreach ( $settings as $key=>$value ) {
- $filtered_settings[$key] = $value;
+ $filtered_settings[$key] = $value;
- foreach( $fields as $field ) {
- if ( $field['id'] == $key && isset( $field['type'] ) && $field['type'] == 'multi_text' ) {
- $filtered_settings[$key] = array_filter( $settings[$key] );
- }
- }
- }
+ foreach( $fields as $field ) {
+ if ( $field['id'] == $key && isset( $field['type'] ) && $field['type'] == 'multi_text' ) {
+ $filtered_settings[$key] = array_filter( $settings[$key] );
+ }
+ }
+ }
- return $filtered_settings;
- }
+ return $filtered_settings;
+ }
- function check_permalinks_changes() {
- if ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
- if ( UM()->options()->get( 'permalink_base' ) != $_POST['um_options']['permalink_base'] ) {
- $this->need_change_permalinks = true;
- }
- }
- }
+ /**
+ *
+ */
+ function check_permalinks_changes() {
+ if ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
+ if ( UM()->options()->get( 'permalink_base' ) != $_POST['um_options']['permalink_base'] ) {
+ $this->need_change_permalinks = true;
+ }
+ }
+ }
- function on_settings_save() {
- if ( ! empty( $_POST['um_options'] ) ) {
- if ( ! empty( $_POST['um_options']['pages_settings'] ) ) {
- $post_ids = new \WP_Query( array(
- 'post_type' => 'page',
- 'meta_query' => array(
- array(
- 'key' => '_um_core',
- 'compare' => 'EXISTS'
- )
- ),
- 'posts_per_page' => -1,
- 'fields' => 'ids'
- ) );
+ /**
+ *
+ */
+ function on_settings_save() {
+ if ( ! empty( $_POST['um_options'] ) ) {
+ if ( ! empty( $_POST['um_options']['pages_settings'] ) ) {
+ $post_ids = new \WP_Query( array(
+ 'post_type' => 'page',
+ 'meta_query' => array(
+ array(
+ 'key' => '_um_core',
+ 'compare' => 'EXISTS'
+ )
+ ),
+ 'posts_per_page' => -1,
+ 'fields' => 'ids'
+ ) );
- $post_ids = $post_ids->get_posts();
+ $post_ids = $post_ids->get_posts();
- if ( ! empty( $post_ids ) ) {
- foreach ( $post_ids as $post_id ) {
- delete_post_meta( $post_id, '_um_core' );
- }
- }
+ if ( ! empty( $post_ids ) ) {
+ foreach ( $post_ids as $post_id ) {
+ delete_post_meta( $post_id, '_um_core' );
+ }
+ }
- foreach ( $_POST['um_options'] as $option_slug => $post_id ) {
- $slug = str_replace( 'core_', '', $option_slug );
- update_post_meta( $post_id, '_um_core', $slug );
- }
- } elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
- if ( ! empty( $this->need_change_permalinks ) ) {
- $users = get_users( array(
+ foreach ( $_POST['um_options'] as $option_slug => $post_id ) {
+ $slug = str_replace( 'core_', '', $option_slug );
+ update_post_meta( $post_id, '_um_core', $slug );
+ }
+ } elseif ( ! empty( $_POST['um_options']['permalink_base'] ) ) {
+ if ( ! empty( $this->need_change_permalinks ) ) {
+ $users = get_users( array(
'fields' => 'ids',
- ) );
- if ( ! empty( $users ) ) {
- foreach ( $users as $user_id ) {
- UM()->user()->generate_profile_slug( $user_id );
- }
- }
- }
- }
- }
- }
+ ) );
+ if ( ! empty( $users ) ) {
+ foreach ( $users as $user_id ) {
+ UM()->user()->generate_profile_slug( $user_id );
+ }
+ }
+ }
+ }
+ }
+ }
- function before_licenses_save() {
- if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) )
- return;
+ /**
+ *
+ */
+ function before_licenses_save() {
+ if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) )
+ return;
- foreach ( $_POST['um_options'] as $key => $value ) {
- $this->previous_licenses[$key] = UM()->options()->get( $key );
- }
- }
+ foreach ( $_POST['um_options'] as $key => $value ) {
+ $this->previous_licenses[$key] = UM()->options()->get( $key );
+ }
+ }
- function licenses_save() {
- if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) )
- return;
+ /**
+ *
+ */
+ function licenses_save() {
+ if ( empty( $_POST['um_options'] ) || empty( $_POST['licenses_settings'] ) )
+ return;
- foreach ( $_POST['um_options'] as $key => $value ) {
- $edd_action = '';
- $license_key = '';
- if ( empty( $this->previous_licenses[$key] ) && ! empty( $value ) || ( ! empty( $this->previous_licenses[$key] ) && ! empty( $value ) && $this->previous_licenses[$key] != $value ) ) {
- $edd_action = 'activate_license';
- $license_key = $value;
- } elseif ( ! empty( $this->previous_licenses[$key] ) && empty( $value ) ) {
- $edd_action = 'deactivate_license';
- $license_key = $this->previous_licenses[$key];
- } elseif ( ! empty( $this->previous_licenses[$key] ) && ! empty( $value ) ) {
- $edd_action = 'check_license';
- $license_key = $value;
- }
+ foreach ( $_POST['um_options'] as $key => $value ) {
+ $edd_action = '';
+ $license_key = '';
+ if ( empty( $this->previous_licenses[$key] ) && ! empty( $value ) || ( ! empty( $this->previous_licenses[$key] ) && ! empty( $value ) && $this->previous_licenses[$key] != $value ) ) {
+ $edd_action = 'activate_license';
+ $license_key = $value;
+ } elseif ( ! empty( $this->previous_licenses[$key] ) && empty( $value ) ) {
+ $edd_action = 'deactivate_license';
+ $license_key = $this->previous_licenses[$key];
+ } elseif ( ! empty( $this->previous_licenses[$key] ) && ! empty( $value ) ) {
+ $edd_action = 'check_license';
+ $license_key = $value;
+ }
- if ( empty( $edd_action ) )
- continue;
+ if ( empty( $edd_action ) )
+ continue;
- $item_name = false;
- $version = false;
- $author = false;
- foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
- if ( $field_data['id'] == $key ) {
- $item_name = ! empty( $field_data['item_name'] ) ? $field_data['item_name'] : false;
- $version = ! empty( $field_data['version'] ) ? $field_data['version'] : false;
- $author = ! empty( $field_data['author'] ) ? $field_data['author'] : false;
- }
- }
+ $item_name = false;
+ $version = false;
+ $author = false;
+ foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
+ if ( $field_data['id'] == $key ) {
+ $item_name = ! empty( $field_data['item_name'] ) ? $field_data['item_name'] : false;
+ $version = ! empty( $field_data['version'] ) ? $field_data['version'] : false;
+ $author = ! empty( $field_data['author'] ) ? $field_data['author'] : false;
+ }
+ }
- $api_params = array(
- 'edd_action' => $edd_action,
- 'license' => $license_key,
- 'item_name' => $item_name,
- 'version' => $version,
- 'author' => $author,
- 'url' => home_url(),
- );
+ $api_params = array(
+ 'edd_action' => $edd_action,
+ 'license' => $license_key,
+ 'item_name' => $item_name,
+ 'version' => $version,
+ 'author' => $author,
+ 'url' => home_url(),
+ );
- $request = wp_remote_post(
- 'https://ultimatemember.com/',
- array(
- 'timeout' => 15,
- 'sslverify' => false,
- 'body' => $api_params
- )
- );
+ $request = wp_remote_post(
+ 'https://ultimatemember.com/',
+ array(
+ 'timeout' => 15,
+ 'sslverify' => false,
+ 'body' => $api_params
+ )
+ );
- if ( ! is_wp_error( $request ) )
- $request = json_decode( wp_remote_retrieve_body( $request ) );
+ if ( ! is_wp_error( $request ) )
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
- $request = ( $request ) ? maybe_unserialize( $request ) : false;
+ $request = ( $request ) ? maybe_unserialize( $request ) : false;
- if ( $edd_action == 'activate_license' || $edd_action == 'check_license' )
- update_option( "{$key}_edd_answer", $request );
- else
- delete_option( "{$key}_edd_answer" );
+ if ( $edd_action == 'activate_license' || $edd_action == 'check_license' )
+ update_option( "{$key}_edd_answer", $request );
+ else
+ delete_option( "{$key}_edd_answer" );
- }
- }
+ }
+ }
- function check_wrong_licenses() {
- $invalid_license = 0;
- $arr_inactive_license_keys = array();
+ /**
+ *
+ */
+ function check_wrong_licenses() {
+ $invalid_license = 0;
+ $arr_inactive_license_keys = array();
- if ( empty( $this->settings_structure['licenses']['fields'] ) )
- return;
+ if ( empty( $this->settings_structure['licenses']['fields'] ) )
+ return;
- foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
- $license = get_option( "{$field_data['id']}_edd_answer" );
+ foreach ( $this->settings_structure['licenses']['fields'] as $field_data ) {
+ $license = get_option( "{$field_data['id']}_edd_answer" );
- if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license )
- continue;
+ if ( ( is_object( $license ) && 'valid' == $license->license ) || 'valid' == $license )
+ continue;
- if ( ( is_object( $license ) && 'inactive' == $license->license ) || 'inactive' == $license ){
- $arr_inactive_license_keys[ ] = $license->item_name;
- }
+ if ( ( is_object( $license ) && 'inactive' == $license->license ) || 'inactive' == $license ){
+ $arr_inactive_license_keys[ ] = $license->item_name;
+ }
- $invalid_license++;
+ $invalid_license++;
- }
-
- if ( ! empty( $arr_inactive_license_keys ) ) { ?>
-
-
-
- www.UltimateMember.com.', 'ultimate-member' ), count( $arr_inactive_license_keys ) , ultimatemember_plugin_name, 'https://ultimatemember.com' ) ; ?>
-
-
-
-
-
-
-
- Licenses page to correct this issue.', 'ultimate-member' ), $invalid_license, ultimatemember_plugin_name, add_query_arg( array('page'=>'um_options', 'tab' => 'licenses'), admin_url( 'admin.php' ) ) ) ?>
-
-
-
- config()->email_notifications;
-
- if ( empty( $email_key ) || empty( $emails[$email_key] ) )
- include_once um_path . 'includes/admin/core/list-tables/emails-list-table.php';
- }
-
-
- function settings_email_tab( $section ) {
- $email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
- $emails = UM()->config()->email_notifications;
-
- if ( empty( $email_key ) || empty( $emails[$email_key] ) )
- return $section;
-
- $in_theme = UM()->mail()->template_in_theme( $email_key );
-
- /**
- * UM hook
- *
- * @type filter
- * @title um_admin_settings_email_section_fields
- * @description Extend UM Email Settings
- * @input_vars
- * [{"var":"$settings","type":"array","desc":"UM Email Settings"},
- * {"var":"$email_key","type":"string","desc":"Email Key"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_admin_settings_email_section_fields', 'function_name', 10, 2 );
- * @example
- *
- */
- $section_fields = apply_filters( 'um_admin_settings_email_section_fields', array(
- array(
- 'id' => 'um_email_template',
- 'type' => 'hidden',
- 'value' => $email_key,
- ),
- array(
- 'id' => $email_key . '_on',
- 'type' => 'checkbox',
- 'label' => $emails[$email_key]['title'],
- 'tooltip' => $emails[$email_key]['description'],
- ),
- array(
- 'id' => $email_key . '_sub',
- 'type' => 'text',
- 'label' => __( 'Subject Line','ultimate-member' ),
- 'conditional' => array( $email_key . '_on', '=', 1 ),
- 'tooltip' => __('This is the subject line of the e-mail','ultimate-member'),
- ),
- array(
- 'id' => $email_key,
- 'type' => 'email_template',
- 'label' => __( 'Message Body','ultimate-member' ),
- 'conditional' => array( $email_key . '_on', '=', 1 ),
- 'tooltip' => __('This is the content of the e-mail','ultimate-member'),
- 'value' => UM()->mail()->get_email_template( $email_key ),
- 'in_theme' => $in_theme
- ),
- ), $email_key );
+ }
+
+ if ( ! empty( $arr_inactive_license_keys ) ) { ?>
+
+
+
+ www.UltimateMember.com.', 'ultimate-member' ), count( $arr_inactive_license_keys ) , ultimatemember_plugin_name, 'https://ultimatemember.com' ) ; ?>
+
+
+
+
+
+
+
+ Licenses page to correct this issue.', 'ultimate-member' ), $invalid_license, ultimatemember_plugin_name, add_query_arg( array('page'=>'um_options', 'tab' => 'licenses'), admin_url( 'admin.php' ) ) ) ?>
+
+
+
+ config()->email_notifications;
+
+ if ( empty( $email_key ) || empty( $emails[$email_key] ) )
+ include_once um_path . 'includes/admin/core/list-tables/emails-list-table.php';
+ }
+
+
+ /**
+ * @param $section
+ *
+ * @return string
+ */
+ function settings_email_tab( $section ) {
+ $email_key = empty( $_GET['email'] ) ? '' : urldecode( $_GET['email'] );
+ $emails = UM()->config()->email_notifications;
+
+ if ( empty( $email_key ) || empty( $emails[$email_key] ) )
+ return $section;
+
+ $in_theme = UM()->mail()->template_in_theme( $email_key );
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_settings_email_section_fields
+ * @description Extend UM Email Settings
+ * @input_vars
+ * [{"var":"$settings","type":"array","desc":"UM Email Settings"},
+ * {"var":"$email_key","type":"string","desc":"Email Key"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_settings_email_section_fields', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ $section_fields = apply_filters( 'um_admin_settings_email_section_fields', array(
+ array(
+ 'id' => 'um_email_template',
+ 'type' => 'hidden',
+ 'value' => $email_key,
+ ),
+ array(
+ 'id' => $email_key . '_on',
+ 'type' => 'checkbox',
+ 'label' => $emails[$email_key]['title'],
+ 'tooltip' => $emails[$email_key]['description'],
+ ),
+ array(
+ 'id' => $email_key . '_sub',
+ 'type' => 'text',
+ 'label' => __( 'Subject Line','ultimate-member' ),
+ 'conditional' => array( $email_key . '_on', '=', 1 ),
+ 'tooltip' => __('This is the subject line of the e-mail','ultimate-member'),
+ ),
+ array(
+ 'id' => $email_key,
+ 'type' => 'email_template',
+ 'label' => __( 'Message Body','ultimate-member' ),
+ 'conditional' => array( $email_key . '_on', '=', 1 ),
+ 'tooltip' => __('This is the content of the e-mail','ultimate-member'),
+ 'value' => UM()->mail()->get_email_template( $email_key ),
+ 'in_theme' => $in_theme
+ ),
+ ), $email_key );
+
+ return $this->render_settings_section( $section_fields, 'email', $email_key );
+ }
+
+
+ /**
+ *
+ */
+ function settings_appearance_profile_tab() {
+ wp_enqueue_media();
+ }
+
+
+ /**
+ * @param $html
+ * @param $section_fields
+ *
+ * @return string
+ */
+ function settings_licenses_tab( $html, $section_fields ) {
+ ob_start(); ?>
+
+
+ Name . ' ' . $theme_data->Version;
+ // Get theme info
+ $theme_data = wp_get_theme();
+ $theme = $theme_data->Name . ' ' . $theme_data->Version;
- // Identify Hosting Provider
- $host = um_get_host();
+ // Identify Hosting Provider
+ $host = um_get_host();
- um_fetch_user( get_current_user_id() );
+ um_fetch_user( get_current_user_id() );
- if ( isset( $this->content ) ) {
- echo $this->content;
- } else { ?>
+ if ( isset( $this->content ) ) {
+ echo $this->content;
+ } else { ?>
-
Install Info
+
Install Info
-
-
+
+
### Begin Install Info ###
## Please include this information when posting support requests ##
@@ -2419,78 +2500,93 @@ Use Only Cookies: admin_forms_settings( array(
- 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column',
- 'prefix_id' => 'um_options',
- 'fields' => $section_fields
- ) )->render_form(); ?>
+ UM()->admin_forms_settings( array(
+ 'class' => 'um_options-' . $current_tab . '-' . $current_subtab . ' um-third-column',
+ 'prefix_id' => 'um_options',
+ 'fields' => $section_fields
+ ) )->render_form(); ?>
- mail()->get_template_file( 'theme', $template );
+ $theme_template_path = UM()->mail()->get_template_file( 'theme', $template );
- $in_theme = UM()->mail()->template_in_theme( $template );
- if ( ! $in_theme ) {
- UM()->mail()->copy_email_template( $template );
- }
+ $in_theme = UM()->mail()->template_in_theme( $template );
+ if ( ! $in_theme ) {
+ UM()->mail()->copy_email_template( $template );
+ }
- $fp = fopen( $theme_template_path, "w" );
- $result = fputs( $fp, $content );
- fclose( $fp );
+ $fp = fopen( $theme_template_path, "w" );
+ $result = fputs( $fp, $content );
+ fclose( $fp );
- if ( $result !== false ) {
- unset( $settings['um_email_template'] );
- unset( $settings[$template] );
- }
+ if ( $result !== false ) {
+ unset( $settings['um_email_template'] );
+ unset( $settings[$template] );
+ }
- return $settings;
- }
- }
+ return $settings;
+ }
+ }
}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-upgrade.php b/includes/admin/core/class-admin-upgrade.php
index c35d1df6..a7aae4e0 100644
--- a/includes/admin/core/class-admin-upgrade.php
+++ b/includes/admin/core/class-admin-upgrade.php
@@ -5,22 +5,41 @@ namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Upgrade' ) ) {
- /**
- * This class handles all functions that changes data structures and moving files
- */
- class Admin_Upgrade {
- var $update_versions;
- var $packages_dir;
- function __construct() {
- $this->packages_dir = plugin_dir_path( __FILE__ ) . 'packages' . DIRECTORY_SEPARATOR;
+ /**
+ * Class Admin_Upgrade
+ *
+ * This class handles all functions that changes data structures and moving files
+ *
+ * @package um\admin\core
+ */
+ class Admin_Upgrade {
- $um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
- if ( ! $um_last_version_upgrade || version_compare( $um_last_version_upgrade, ultimatemember_version, '<' ) )
- add_action( 'admin_init', array( $this, 'packages' ), 10 );
- }
+ /**
+ * @var
+ */
+ var $update_versions;
+
+
+ /**
+ * @var string
+ */
+ var $packages_dir;
+
+
+ /**
+ * Admin_Upgrade constructor.
+ */
+ function __construct() {
+ $this->packages_dir = plugin_dir_path( __FILE__ ) . 'packages' . DIRECTORY_SEPARATOR;
+
+ $um_last_version_upgrade = get_option( 'um_last_version_upgrade' );
+
+ if ( ! $um_last_version_upgrade || version_compare( $um_last_version_upgrade, ultimatemember_version, '<' ) )
+ add_action( 'admin_init', array( $this, 'packages' ), 10 );
+ }
/**
@@ -54,35 +73,35 @@ if ( ! class_exists( 'Admin_Upgrade' ) ) {
}
- /**
- * Parse packages dir for packages files
- */
- function set_update_versions() {
- $update_versions = array();
- $handle = opendir( $this->packages_dir );
- if ( $handle ) {
- while ( false !== ( $filename = readdir( $handle ) ) ) {
- if ( $filename != '.' && $filename != '..' )
- $update_versions[] = preg_replace( '/(.*?)\.php/i', '$1', $filename );
- }
- closedir( $handle );
+ /**
+ * Parse packages dir for packages files
+ */
+ function set_update_versions() {
+ $update_versions = array();
+ $handle = opendir( $this->packages_dir );
+ if ( $handle ) {
+ while ( false !== ( $filename = readdir( $handle ) ) ) {
+ if ( $filename != '.' && $filename != '..' )
+ $update_versions[] = preg_replace( '/(.*?)\.php/i', '$1', $filename );
+ }
+ closedir( $handle );
- usort( $update_versions, array( &$this, 'version_compare_sort' ) );
+ usort( $update_versions, array( &$this, 'version_compare_sort' ) );
- $this->update_versions = $update_versions;
- }
- }
+ $this->update_versions = $update_versions;
+ }
+ }
- /**
- * Sort versions by version compare function
- * @param $a
- * @param $b
- * @return mixed
- */
- function version_compare_sort( $a, $b ) {
- return version_compare( $a, $b );
- }
+ /**
+ * Sort versions by version compare function
+ * @param $a
+ * @param $b
+ * @return mixed
+ */
+ function version_compare_sort( $a, $b ) {
+ return version_compare( $a, $b );
+ }
- }
+ }
}
\ No newline at end of file
diff --git a/includes/admin/core/class-admin-users.php b/includes/admin/core/class-admin-users.php
index e621c75a..cd6ab24b 100644
--- a/includes/admin/core/class-admin-users.php
+++ b/includes/admin/core/class-admin-users.php
@@ -5,392 +5,402 @@ namespace um\admin\core;
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'Admin_Users' ) ) {
- class Admin_Users {
-
- function __construct() {
-
- $this->custom_role = 'um_role';
-
- add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
-
- add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
-
- add_filter( 'pre_user_query', array( &$this, 'sort_by_newest' ) );
-
- add_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
-
- add_filter( 'views_users', array( &$this, 'add_status_links' ) );
-
- add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
- }
- /**
- * Add UM Bulk actions to Users List Table
- *
- */
- function restrict_manage_users() { ?>
-
-
-
-
-
-
- get_bulk_admin_actions(); ?>
-
-
-
-
-
-
-
-
- 'My Custom Bulk Action'
- * );
- * return $actions;
- * }
- * ?>
- */
- $actions = apply_filters( 'um_admin_bulk_user_actions_hook', array(
- 'um_approve_membership' => array(
- 'label' => __( 'Approve Membership', 'ultimate-member' )
- ),
- 'um_reject_membership' => array(
- 'label' => __( 'Reject Membership', 'ultimate-member' )
- ),
- 'um_put_as_pending' => array(
- 'label' => __( 'Put as Pending Review', 'ultimate-member' )
- ),
- 'um_resend_activation' => array(
- 'label' => __( 'Resend Activation E-mail', 'ultimate-member' )
- ),
- 'um_deactivate' => array(
- 'label' => __( 'Deactivate', 'ultimate-member' )
- ),
- 'um_reenable' => array(
- 'label' => __( 'Reactivate', 'ultimate-member' )
- )
- ) );
+ $this->custom_role = 'um_role';
- $output = '';
- foreach ( $actions as $id => $action_data ) {
- $output .= '' . $action_data['label'] . ' ';
- }
- return $output;
- }
+ add_action( 'restrict_manage_users', array( &$this, 'restrict_manage_users' ) );
+
+ add_filter( 'user_row_actions', array( &$this, 'user_row_actions' ), 10, 2 );
+
+ add_filter( 'pre_user_query', array( &$this, 'sort_by_newest' ) );
+
+ add_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
+
+ add_filter( 'views_users', array( &$this, 'add_status_links' ) );
+
+ add_action( 'admin_init', array( &$this, 'um_bulk_users_edit' ), 9 );
+ }
- /**
- * Custom row actions for users page
- *
- * @param array $actions
- * @param $user_object \WP_User
- * @return array
- */
- function user_row_actions( $actions, $user_object ) {
- $user_id = $user_object->ID;
+ /**
+ * Add UM Bulk actions to Users List Table
+ *
+ */
+ function restrict_manage_users() { ?>
+
+
+
+
+
+
+ get_bulk_admin_actions(); ?>
+
+
+
+
+
+
+
+
+ " . __( 'View profile', 'ultimate-member' ) . "";
+ /**
+ * Get UM bulk actions HTML
+ *
+ * @return string
+ */
+ function get_bulk_admin_actions() {
- $submitted = get_user_meta( $user_id, 'submitted', true );
- if ( ! empty( $submitted ) )
- $actions['view_info'] = '' . __( 'Info', 'ultimate-member' ) . ' ';
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_bulk_user_actions_hook
+ * @description Admin Users List Table bulk actions
+ * @input_vars
+ * [{"var":"$actions","type":"array","desc":"User List Table bulk actions"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_bulk_user_actions_hook', 'function_name', 10, 1 );
+ * @example
+ * 'My Custom Bulk Action'
+ * );
+ * return $actions;
+ * }
+ * ?>
+ */
+ $actions = apply_filters( 'um_admin_bulk_user_actions_hook', array(
+ 'um_approve_membership' => array(
+ 'label' => __( 'Approve Membership', 'ultimate-member' )
+ ),
+ 'um_reject_membership' => array(
+ 'label' => __( 'Reject Membership', 'ultimate-member' )
+ ),
+ 'um_put_as_pending' => array(
+ 'label' => __( 'Put as Pending Review', 'ultimate-member' )
+ ),
+ 'um_resend_activation' => array(
+ 'label' => __( 'Resend Activation E-mail', 'ultimate-member' )
+ ),
+ 'um_deactivate' => array(
+ 'label' => __( 'Deactivate', 'ultimate-member' )
+ ),
+ 'um_reenable' => array(
+ 'label' => __( 'Reactivate', 'ultimate-member' )
+ )
+ ) );
- /**
- * UM hook
- *
- * @type filter
- * @title um_admin_user_row_actions
- * @description Admin views array
- * @input_vars
- * [{"var":"$actions","type":"array","desc":"User List Table actions"},
- * {"var":"$user_id","type":"int","desc":"User ID"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_admin_user_row_actions', 'function_name', 10, 2 );
- * @example
- *
- */
- $actions = apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
-
- return $actions;
- }
+ $output = '';
+ foreach ( $actions as $id => $action_data ) {
+ $output .= '' . $action_data['label'] . ' ';
+ }
+ return $output;
+ }
- /**
- * Change default sorting at WP Users list table
- *
- * @param $query
- * @return mixed
- */
- function sort_by_newest( $query ) {
- global $pagenow;
-
- if ( is_admin() && $pagenow == 'users.php' ) {
- if ( ! isset( $_REQUEST['orderby'] ) ) {
- $query->query_vars["order"] = 'desc';
- $query->query_orderby = " ORDER BY user_registered " . ( $query->query_vars["order"] == "desc" ? "desc " : "asc " ); //set sort order
- }
- }
-
- return $query;
- }
+ /**
+ * Custom row actions for users page
+ *
+ * @param array $actions
+ * @param $user_object \WP_User
+ * @return array
+ */
+ function user_row_actions( $actions, $user_object ) {
+ $user_id = $user_object->ID;
- /**
- * Filter WP users by UM Status
- *
- * @param $query
- * @return mixed
- */
- function filter_users_by_status( $query ) {
- global $wpdb, $pagenow;
+ $actions['frontend_profile'] = "" . __( 'View profile', 'ultimate-member' ) . " ";
- if ( is_admin() && $pagenow == 'users.php' && ! empty( $_GET['status'] ) ) {
+ $submitted = get_user_meta( $user_id, 'submitted', true );
+ if ( ! empty( $submitted ) )
+ $actions['view_info'] = '' . __( 'Info', 'ultimate-member' ) . ' ';
- $status = urldecode( $_GET['status'] );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_user_row_actions
+ * @description Admin views array
+ * @input_vars
+ * [{"var":"$actions","type":"array","desc":"User List Table actions"},
+ * {"var":"$user_id","type":"int","desc":"User ID"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_user_row_actions', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ $actions = apply_filters( 'um_admin_user_row_actions', $actions, $user_id );
- if ( $status == 'needs-verification' ) {
- $query->query_where = str_replace('WHERE 1=1',
- "WHERE 1=1 AND {$wpdb->users}.ID IN (
+ return $actions;
+ }
+
+
+ /**
+ * Change default sorting at WP Users list table
+ *
+ * @param $query
+ * @return mixed
+ */
+ function sort_by_newest( $query ) {
+ global $pagenow;
+
+ if ( is_admin() && $pagenow == 'users.php' ) {
+ if ( ! isset( $_REQUEST['orderby'] ) ) {
+ $query->query_vars["order"] = 'desc';
+ $query->query_orderby = " ORDER BY user_registered " . ( $query->query_vars["order"] == "desc" ? "desc " : "asc " ); //set sort order
+ }
+ }
+
+ return $query;
+ }
+
+
+ /**
+ * Filter WP users by UM Status
+ *
+ * @param $query
+ * @return mixed
+ */
+ function filter_users_by_status( $query ) {
+ global $wpdb, $pagenow;
+
+ if ( is_admin() && $pagenow == 'users.php' && ! empty( $_GET['status'] ) ) {
+
+ $status = urldecode( $_GET['status'] );
+
+ if ( $status == 'needs-verification' ) {
+ $query->query_where = str_replace('WHERE 1=1',
+ "WHERE 1=1 AND {$wpdb->users}.ID IN (
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
WHERE {$wpdb->usermeta}.meta_key = '_um_verified'
AND {$wpdb->usermeta}.meta_value = 'pending')",
- $query->query_where
- );
- } else {
- $query->query_where = str_replace('WHERE 1=1',
- "WHERE 1=1 AND {$wpdb->users}.ID IN (
+ $query->query_where
+ );
+ } else {
+ $query->query_where = str_replace('WHERE 1=1',
+ "WHERE 1=1 AND {$wpdb->users}.ID IN (
SELECT {$wpdb->usermeta}.user_id FROM $wpdb->usermeta
WHERE {$wpdb->usermeta}.meta_key = 'account_status'
AND {$wpdb->usermeta}.meta_value = '{$status}')",
- $query->query_where
- );
- }
+ $query->query_where
+ );
+ }
- }
+ }
- return $query;
- }
+ return $query;
+ }
- /**
- * Add status links to WP Users List Table
- *
- * @param $views
- * @return array|mixed|void
- */
- function add_status_links( $views ) {
- remove_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
+ /**
+ * Add status links to WP Users List Table
+ *
+ * @param $views
+ * @return array|mixed|void
+ */
+ function add_status_links( $views ) {
+ remove_filter( 'pre_user_query', array( &$this, 'filter_users_by_status' ) );
- $old_views = $views;
- $views = array();
+ $old_views = $views;
+ $views = array();
- if ( ! isset( $_REQUEST['role'] ) && ! isset( $_REQUEST['status'] ) ) {
- $views['all'] = 'All (' . UM()->query()->count_users() . ') ';
- } else {
- $views['all'] = 'All (' . UM()->query()->count_users() . ') ';
- }
+ if ( ! isset( $_REQUEST['role'] ) && ! isset( $_REQUEST['status'] ) ) {
+ $views['all'] = 'All (' . UM()->query()->count_users() . ') ';
+ } else {
+ $views['all'] = 'All (' . UM()->query()->count_users() . ') ';
+ }
- $status = array(
- 'approved' => __( 'Approved', 'ultimate-member' ),
- 'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ),
- 'awaiting_email_confirmation' => __( 'Waiting e-mail confirmation', 'ultimate-member' ),
- 'inactive' => __( 'Inactive', 'ultimate-member' ),
- 'rejected' => __( 'Rejected', 'ultimate-member' )
- );
+ $status = array(
+ 'approved' => __( 'Approved', 'ultimate-member' ),
+ 'awaiting_admin_review' => __( 'Pending review', 'ultimate-member' ),
+ 'awaiting_email_confirmation' => __( 'Waiting e-mail confirmation', 'ultimate-member' ),
+ 'inactive' => __( 'Inactive', 'ultimate-member' ),
+ 'rejected' => __( 'Rejected', 'ultimate-member' )
+ );
- UM()->query()->count_users_by_status( 'unassigned' );
+ UM()->query()->count_users_by_status( 'unassigned' );
- foreach ( $status as $k => $v ) {
- if ( isset( $_REQUEST['status'] ) && $_REQUEST['status'] == $k ) {
- $current = 'class="current"';
- } else {
- $current = '';
- }
+ foreach ( $status as $k => $v ) {
+ if ( isset( $_REQUEST['status'] ) && $_REQUEST['status'] == $k ) {
+ $current = 'class="current"';
+ } else {
+ $current = '';
+ }
- $views[$k] = ''. $v . ' ('.UM()->query()->count_users_by_status( $k ).') ';
- }
+ $views[$k] = ''. $v . ' ('.UM()->query()->count_users_by_status( $k ).') ';
+ }
- /**
- * UM hook
- *
- * @type filter
- * @title um_admin_views_users
- * @description Admin views array
- * @input_vars
- * [{"var":"$views","type":"array","desc":"User Views"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_admin_views_users', 'function_name', 10, 1 );
- * @example
- *
- */
- $views = apply_filters( 'um_admin_views_users', $views );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_views_users
+ * @description Admin views array
+ * @input_vars
+ * [{"var":"$views","type":"array","desc":"User Views"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_views_users', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $views = apply_filters( 'um_admin_views_users', $views );
- // remove all filters
- unset( $old_views['all'] );
+ // remove all filters
+ unset( $old_views['all'] );
- // add separator
- $views['subsep'] = ' ';
+ // add separator
+ $views['subsep'] = ' ';
- // merge views
- foreach ( $old_views as $key => $view ) {
- $views[ $key ] = $view;
- }
+ // merge views
+ foreach ( $old_views as $key => $view ) {
+ $views[ $key ] = $view;
+ }
- return $views;
- }
+ return $views;
+ }
- /***
- *** @Bulk user editing actions
- ***/
- function um_bulk_users_edit() {
- $admin_err = 0;
+ /**
+ * Bulk user editing actions
+ */
+ function um_bulk_users_edit() {
+ $admin_err = 0;
- // bulk edit users
- if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
+ // bulk edit users
+ if ( ! empty( $_REQUEST['users'] ) && ! empty( $_REQUEST['um_bulkedit'] ) && ! empty( $_REQUEST['um_bulk_action'] ) ) {
- if ( ! current_user_can( 'edit_users' ) )
- wp_die( __( 'You do not have enough permissions to do that.', 'ultimate-member' ) );
+ if ( ! current_user_can( 'edit_users' ) )
+ wp_die( __( 'You do not have enough permissions to do that.', 'ultimate-member' ) );
- check_admin_referer( 'bulk-users' );
+ check_admin_referer( 'bulk-users' );
- $users = $_REQUEST['users'];
- $bulk_action = current( array_filter( $_REQUEST['um_bulk_action'] ) );
+ $users = $_REQUEST['users'];
+ $bulk_action = current( array_filter( $_REQUEST['um_bulk_action'] ) );
- foreach ( $users as $user_id ) {
- UM()->user()->set( $user_id );
- if ( ! um_user( 'super_admin' ) ) {
+ foreach ( $users as $user_id ) {
+ UM()->user()->set( $user_id );
+ if ( ! um_user( 'super_admin' ) ) {
- /**
- * UM hook
- *
- * @type action
- * @title um_admin_user_action_hook
- * @description Action on bulk user action
- * @input_vars
- * [{"var":"$bulk_action","type":"string","desc":"Bulk Action"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_admin_user_action_hook{$action}', 'function_name', 10, 1 );
- * @example
- *
- */
- do_action( "um_admin_user_action_hook", $bulk_action );
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_user_action_hook
+ * @description Action on bulk user action
+ * @input_vars
+ * [{"var":"$bulk_action","type":"string","desc":"Bulk Action"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_user_action_hook{$action}', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ do_action( "um_admin_user_action_hook", $bulk_action );
- /**
- * UM hook
- *
- * @type action
- * @title um_admin_user_action_{$bulk_action}_hook
- * @description Action on bulk user action
- * @change_log
- * ["Since: 2.0"]
- * @usage add_action( 'um_admin_user_action_{$bulk_action}_hook', 'function_name', 10 );
- * @example
- *
- */
- do_action( "um_admin_user_action_{$bulk_action}_hook" );
+ /**
+ * UM hook
+ *
+ * @type action
+ * @title um_admin_user_action_{$bulk_action}_hook
+ * @description Action on bulk user action
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_action( 'um_admin_user_action_{$bulk_action}_hook', 'function_name', 10 );
+ * @example
+ *
+ */
+ do_action( "um_admin_user_action_{$bulk_action}_hook" );
- } else {
- $admin_err = 1;
- }
- }
+ } else {
+ $admin_err = 1;
+ }
+ }
- // Finished. redirect now
- if ( $admin_err == 0 ) {
+ // Finished. redirect now
+ if ( $admin_err == 0 ) {
- $uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
- $uri = add_query_arg( 'update', 'users_updated', $uri );
+ $uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
+ $uri = add_query_arg( 'update', 'users_updated', $uri );
- wp_redirect( $uri );
+ wp_redirect( $uri );
- exit;
- } else {
- wp_redirect( admin_url( 'users.php?update=err_users_updated' ) );
- exit;
- }
+ exit;
+ } else {
+ wp_redirect( admin_url( 'users.php?update=err_users_updated' ) );
+ exit;
+ }
- } else if ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
+ } else if ( ! empty( $_REQUEST['um_bulkedit'] ) ) {
- $uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
- wp_redirect( $uri );
- exit;
+ $uri = $this->set_redirect_uri( admin_url( 'users.php' ) );
+ wp_redirect( $uri );
+ exit;
- }
- }
+ }
+ }
- /**
- * Sets redirect URI after bulk action
- *
- * @param string $uri
- * @return string
- */
- function set_redirect_uri( $uri ) {
+ /**
+ * Sets redirect URI after bulk action
+ *
+ * @param string $uri
+ * @return string
+ */
+ function set_redirect_uri( $uri ) {
- if ( ! empty( $_REQUEST['s'] ) )
- $uri = add_query_arg( 's', $_REQUEST['s'], $uri );
+ if ( ! empty( $_REQUEST['s'] ) )
+ $uri = add_query_arg( 's', $_REQUEST['s'], $uri );
- if ( ! empty( $_REQUEST['status'] ) )
- $uri = add_query_arg( 'status', $_REQUEST['status'], $uri );
+ if ( ! empty( $_REQUEST['status'] ) )
+ $uri = add_query_arg( 'status', $_REQUEST['status'], $uri );
- return $uri;
+ return $uri;
- }
+ }
- }
+ }
}
\ No newline at end of file
diff --git a/includes/admin/core/um-admin-actions-modal.php b/includes/admin/core/um-admin-actions-modal.php
index 7b31fb3c..bdbe90d6 100644
--- a/includes/admin/core/um-admin-actions-modal.php
+++ b/includes/admin/core/um-admin-actions-modal.php
@@ -3,88 +3,93 @@
if ( ! defined( 'ABSPATH' ) ) exit;
- /***
- *** @Put status handler in modal
- ***/
- add_action('um_admin_field_modal_header', 'um_admin_add_message_handlers');
- function um_admin_add_message_handlers(){ ?>
metabox();
+/**
+ * Put status handler in modal
+ */
+function um_admin_add_message_handlers() {
+ ?>
+
+
+ metabox();
+
+ if ( isset( $field_args['conditional_support'] ) && $field_args['conditional_support'] == 0 ) {
+ return;
+ } ?>
+
+
- ?>
-
-
-
- in_edit = true; $metabox->edit_array = $edit_array; ?>
+ in_edit = true; $metabox->edit_array = $edit_array; ?>
tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
-
+
tooltip( __( 'Here you can setup conditional logic to show/hide this field based on specific fields value or conditions', 'ultimate-member' ) ); ?>
+
+
+
+
+
+
+
+ $arr ) {
+
+ if ( $k == 0 ) $k = '';
+ ?>
+
+
+
+ field_input( '_conditional_action' . $k, $form_id ); ?>
+ field_input( '_conditional_field' . $k , $form_id ); ?>
+ field_input( '_conditional_operator' . $k, $form_id ); ?>
+ field_input( '_conditional_value' . $k, $form_id ); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ field_input( '_conditional_action', $form_id ); ?>
+ field_input( '_conditional_field', $form_id ); ?>
+ field_input( '_conditional_operator', $form_id ); ?>
+ field_input( '_conditional_value', $form_id ); ?>
+
+
+
+
+
+
-
-
-
-
-
-
- $arr ) {
- if ( $k == 0 ) $k = '';
- ?>
-
-
-
- field_input( '_conditional_action' . $k, $form_id ); ?>
- field_input( '_conditional_field' . $k , $form_id ); ?>
- field_input( '_conditional_operator' . $k, $form_id ); ?>
- field_input( '_conditional_value' . $k, $form_id ); ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- field_input( '_conditional_action', $form_id ); ?>
- field_input( '_conditional_field', $form_id ); ?>
- field_input( '_conditional_operator', $form_id ); ?>
- field_input( '_conditional_value', $form_id ); ?>
-
-
-
-
-
-
-
-
-
-
+
+
-
- */
- $fields_without_metakey = apply_filters( 'um_fields_without_metakey', array(
- 'block',
- 'shortcode',
- 'spacing',
- 'divider',
- 'group'
- ) );
-
- $fields = UM()->query()->get_attr('custom_fields', $form_id);
- $count = 1;
- if ( isset( $fields ) && !empty( $fields) ) $count = count($fields)+1;
-
- // set unique meta key
- if ( in_array( $field_type, $fields_without_metakey ) && !isset($array['post']['_metakey']) ) {
- $array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
- }
-
- // set position
- if ( !isset( $array['post']['_position'] ) ) {
- $array['post']['_position'] = $count;
- }
-
- return $array;
+ if ( isset($array['conditional_field1']) && !empty( $array['conditional_action1'] ) && !empty( $array['conditional_operator1'] ) ) {
+ $array['conditional_value1'] = ! empty( $array['conditional_value1'] ) ? $array['conditional_value1'] : '';
+ $array['conditions'][] = array( $array['conditional_action1'], $array['conditional_field1'], $array['conditional_operator1'], $array['conditional_value1'] );
}
- /***
- *** @Apply a filter to handle errors for field updating in backend
- ***/
- add_filter('um_admin_field_update_error_handling', 'um_admin_field_update_error_handling', 1, 2 );
- function um_admin_field_update_error_handling( $errors, $array ){
- extract( $array );
+ if ( isset($array['conditional_field2']) && !empty( $array['conditional_action2'] ) && !empty( $array['conditional_operator2'] ) ) {
+ $array['conditional_value2'] = ! empty( $array['conditional_value2'] ) ? $array['conditional_value2'] : '';
+ $array['conditions'][] = array( $array['conditional_action2'], $array['conditional_field2'], $array['conditional_operator2'], $array['conditional_value2'] );
+ }
- $field_attr = UM()->builtin()->get_core_field_attrs( $field_type );
+ if ( isset($array['conditional_field3']) && !empty( $array['conditional_action3'] ) && !empty( $array['conditional_operator3'] ) ) {
+ $array['conditional_value3'] = ! empty( $array['conditional_value3'] ) ? $array['conditional_value3'] : '';
+ $array['conditions'][] = array( $array['conditional_action3'], $array['conditional_field3'], $array['conditional_operator3'], $array['conditional_value3'] );
+ }
+
+ if ( isset($array['conditional_field4']) && !empty( $array['conditional_action4'] ) && !empty( $array['conditional_operator4'] ) ) {
+ $array['conditional_value4'] = ! empty( $array['conditional_value4'] ) ? $array['conditional_value4'] : '';
+ $array['conditions'][] = array( $array['conditional_action4'], $array['conditional_field4'], $array['conditional_operator4'], $array['conditional_value4'] );
+ }
+
+ return $array;
+}
+add_filter('um_admin_pre_save_field_to_form', 'um_admin_pre_save_field_to_form', 1 );
+
+
+/**
+ * Some fields may require extra fields before saving
+ *
+ * @param $array
+ *
+ * @return mixed
+ */
+function um_admin_pre_save_fields_hook( $array ) {
+ extract( $array );
+
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_fields_without_metakey
+ * @description Field Types without meta key
+ * @input_vars
+ * [{"var":"$types","type":"array","desc":"Field Types"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_fields_without_metakey', 'function_name', 10, 1 );
+ * @example
+ *
+ */
+ $fields_without_metakey = apply_filters( 'um_fields_without_metakey', array(
+ 'block',
+ 'shortcode',
+ 'spacing',
+ 'divider',
+ 'group'
+ ) );
+
+ $fields = UM()->query()->get_attr('custom_fields', $form_id);
+ $count = 1;
+ if ( isset( $fields ) && !empty( $fields) ) $count = count($fields)+1;
+
+ // set unique meta key
+ if ( in_array( $field_type, $fields_without_metakey ) && !isset($array['post']['_metakey']) ) {
+ $array['post']['_metakey'] = "um_{$field_type}_{$form_id}_{$count}";
+ }
+
+ // set position
+ if ( !isset( $array['post']['_position'] ) ) {
+ $array['post']['_position'] = $count;
+ }
+
+ return $array;
+}
+add_filter('um_admin_pre_save_fields_hook', 'um_admin_pre_save_fields_hook', 1 );
+
+
+/**
+ * Apply a filter to handle errors for field updating in backend
+ *
+ * @param $errors
+ * @param $array
+ *
+ * @return mixed
+ */
+function um_admin_field_update_error_handling( $errors, $array ){
+ extract( $array );
+
+ $field_attr = UM()->builtin()->get_core_field_attrs( $field_type );
if ( isset( $field_attr['validate'] ) ) {
@@ -145,29 +159,42 @@ if ( ! defined( 'ABSPATH' ) ) exit;
return $errors;
}
-
- /***
- *** @Filter validation types on loop
- ****/
- add_filter('um_builtin_validation_types_continue_loop', 'um_builtin_validation_types_continue_loop', 1, 4);
- function um_builtin_validation_types_continue_loop( $break, $key, $form_id, $field_array ){
-
- // show unique username validation only for user_login field
- if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ){
- return false;
- }
-
- return $break;
- }
+add_filter('um_admin_field_update_error_handling', 'um_admin_field_update_error_handling', 1, 2 );
+/**
+ * Filter validation types on loop
+ *
+ * @param $break
+ * @param $key
+ * @param $form_id
+ * @param $field_array
+ *
+ * @return bool
+ */
+function um_builtin_validation_types_continue_loop( $break, $key, $form_id, $field_array ) {
- add_filter( 'um_restrict_content_hide_metabox', 'um_hide_metabox_restrict_content_shop', 10, 1 );
- function um_hide_metabox_restrict_content_shop( $hide ) {
- if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
- $_GET['post'] == wc_get_page_id( 'shop' ) ) {
- return true;
- }
-
- return $hide;
+ // show unique username validation only for user_login field
+ if ( isset( $field_array['metakey'] ) && $field_array['metakey'] == 'user_login' && $key !== 'unique_username' ) {
+ return false;
}
+
+ return $break;
+}
+add_filter( 'um_builtin_validation_types_continue_loop', 'um_builtin_validation_types_continue_loop', 1, 4 );
+
+
+/**
+ * @param $hide
+ *
+ * @return bool
+ */
+function um_hide_metabox_restrict_content_shop( $hide ) {
+ if ( function_exists( 'wc_get_page_id' ) && ! empty( $_GET['post'] ) &&
+ $_GET['post'] == wc_get_page_id( 'shop' ) ) {
+ return true;
+ }
+
+ return $hide;
+}
+add_filter( 'um_restrict_content_hide_metabox', 'um_hide_metabox_restrict_content_shop', 10, 1 );
\ No newline at end of file
diff --git a/includes/admin/templates/access/restrict_content.php b/includes/admin/templates/access/restrict_content.php
index 34055e55..9f12d96b 100644
--- a/includes/admin/templates/access/restrict_content.php
+++ b/includes/admin/templates/access/restrict_content.php
@@ -4,138 +4,139 @@ if ( ! defined( 'ABSPATH' ) ) exit;
?>
- ID ) )
- $data = get_post_meta( $object->ID, 'um_content_restriction', true );
- else
- $data = array();
+ ID ) ) {
+ $data = get_post_meta( $object->ID, 'um_content_restriction', true );
+ } else {
+ $data = array();
+ }
- $_um_access_roles_value = array();
- if ( ! empty( $data['_um_access_roles'] ) ) {
- foreach ( $data['_um_access_roles'] as $key => $value ) {
- if ( $value )
- $_um_access_roles_value[] = $key;
- }
- }
+ $_um_access_roles_value = array();
+ if ( ! empty( $data['_um_access_roles'] ) ) {
+ foreach ( $data['_um_access_roles'] as $key => $value ) {
+ if ( $value ) {
+ $_um_access_roles_value[] = $key;
+ }
+ }
+ }
- /**
- * UM hook
- *
- * @type filter
- * @title um_admin_access_settings_fields
- * @description Extend Admin Access Settings Fields
- * @input_vars
- * [{"var":"$fields","type":"array","desc":"Access Settings Fields"},
- * {"var":"$data","type":"array","desc":"Form Data"}]
- * @change_log
- * ["Since: 2.0"]
- * @usage add_filter( 'um_admin_access_settings_fields', 'function_name', 10, 2 );
- * @example
- *
- */
- $fields = apply_filters( 'um_admin_access_settings_fields', array(
- array(
- 'id' => '_um_custom_access_settings',
- 'type' => 'checkbox',
- 'label' => __( 'Restrict access to this content?', 'ultimate-member' ),
- 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
- ),
- array(
- 'id' => '_um_accessible',
- 'type' => 'select',
- 'label' => __( 'Who can access this content?', 'ultimate-member' ),
- 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
- 'options' => array(
- '0' => __( 'Everyone', 'ultimate-member' ),
- '1' => __( 'Logged out users', 'ultimate-member' ),
- '2' => __( 'Logged in users', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_custom_access_settings', '=', '1' )
- ),
- array(
- 'id' => '_um_access_roles',
- 'type' => 'multi_checkbox',
- 'label' => __( 'Select which roles can access this content', 'ultimate-member' ),
- 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
- 'value' => $_um_access_roles_value,
- 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ),
- 'columns' => 3,
- 'conditional' => array( '_um_accessible', '=', '2' )
- ),
- array(
- 'id' => '_um_noaccess_action',
- 'type' => 'select',
- 'label' => __( 'What happens when users without access tries to view the content?', 'ultimate-member' ),
- 'tooltip' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
- 'options' => array(
- '0' => __( 'Show access restricted message', 'ultimate-member' ),
- '1' => __( 'Redirect user', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_accessible', '!=', '0' )
- ),
- array(
- 'id' => '_um_restrict_by_custom_message',
- 'type' => 'select',
- 'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
- 'tooltip' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
- 'options' => array(
- '0' => __( 'Global default message (default)', 'ultimate-member' ),
- '1' => __( 'Custom message', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_noaccess_action', '=', '0' )
- ),
- array(
- 'id' => '_um_restrict_custom_message',
- 'type' => 'wp_editor',
- 'label' => __( 'Custom Restrict Content message', 'ultimate-member' ),
- 'tooltip' => __( 'Changed global restrict message', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
- 'conditional' => array( '_um_restrict_by_custom_message', '=', '1' )
- ),
- array(
- 'id' => '_um_access_redirect',
- 'type' => 'select',
- 'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
- 'tooltip' => __( 'Select redirect to page when user hasn\'t access to content', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
- 'conditional' => array( '_um_noaccess_action', '=', '1' ),
- 'options' => array(
- '0' => __( 'Login page', 'ultimate-member' ),
- '1' => __( 'Custom URL', 'ultimate-member' ),
- ),
- ),
- array(
- 'id' => '_um_access_redirect_url',
- 'type' => 'text',
- 'label' => __( 'Redirect URL', 'ultimate-member' ),
- 'tooltip' => __( 'Changed global restrict message', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
- 'conditional' => array( '_um_access_redirect', '=', '1' )
- ),
- array(
- 'id' => '_um_access_hide_from_queries',
- 'type' => 'checkbox',
- 'label' => __( 'Hide from queries', 'ultimate-member' ),
- 'tooltip' => __( 'Hide this content from archives, RSS feeds etc for users who do not have permission to view this content', 'ultimate-member' ),
- 'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
- 'conditional' => array( '_um_accessible', '!=', '0' )
- )
- ), $data );
+ /**
+ * UM hook
+ *
+ * @type filter
+ * @title um_admin_access_settings_fields
+ * @description Extend Admin Access Settings Fields
+ * @input_vars
+ * [{"var":"$fields","type":"array","desc":"Access Settings Fields"},
+ * {"var":"$data","type":"array","desc":"Form Data"}]
+ * @change_log
+ * ["Since: 2.0"]
+ * @usage add_filter( 'um_admin_access_settings_fields', 'function_name', 10, 2 );
+ * @example
+ *
+ */
+ $fields = apply_filters( 'um_admin_access_settings_fields', array(
+ array(
+ 'id' => '_um_custom_access_settings',
+ 'type' => 'checkbox',
+ 'label' => __( 'Restrict access to this content?', 'ultimate-member' ),
+ 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_custom_access_settings'] ) ? $data['_um_custom_access_settings'] : 0,
+ ),
+ array(
+ 'id' => '_um_accessible',
+ 'type' => 'select',
+ 'label' => __( 'Who can access this content?', 'ultimate-member' ),
+ 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_accessible'] ) ? $data['_um_accessible'] : 0,
+ 'options' => array(
+ '0' => __( 'Everyone', 'ultimate-member' ),
+ '1' => __( 'Logged out users', 'ultimate-member' ),
+ '2' => __( 'Logged in users', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_custom_access_settings', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_roles',
+ 'type' => 'multi_checkbox',
+ 'label' => __( 'Select which roles can access this content', 'ultimate-member' ),
+ 'tooltip' => __( 'Activate content restriction for this post', 'ultimate-member' ),
+ 'value' => $_um_access_roles_value,
+ 'options' => UM()->roles()->get_roles( false, array( 'administrator' ) ),
+ 'columns' => 3,
+ 'conditional' => array( '_um_accessible', '=', '2' )
+ ),
+ array(
+ 'id' => '_um_noaccess_action',
+ 'type' => 'select',
+ 'label' => __( 'What happens when users without access tries to view the content?', 'ultimate-member' ),
+ 'tooltip' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_noaccess_action'] ) ? $data['_um_noaccess_action'] : 0,
+ 'options' => array(
+ '0' => __( 'Show access restricted message', 'ultimate-member' ),
+ '1' => __( 'Redirect user', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_by_custom_message',
+ 'type' => 'select',
+ 'label' => __( 'Would you like to use the global default message or apply a custom message to this content?', 'ultimate-member' ),
+ 'tooltip' => __( 'Action when users without access tries to view the content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_by_custom_message'] ) ? $data['_um_restrict_by_custom_message'] : '0',
+ 'options' => array(
+ '0' => __( 'Global default message (default)', 'ultimate-member' ),
+ '1' => __( 'Custom message', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_noaccess_action', '=', '0' )
+ ),
+ array(
+ 'id' => '_um_restrict_custom_message',
+ 'type' => 'wp_editor',
+ 'label' => __( 'Custom Restrict Content message', 'ultimate-member' ),
+ 'tooltip' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_restrict_custom_message'] ) ? $data['_um_restrict_custom_message'] : '',
+ 'conditional' => array( '_um_restrict_by_custom_message', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_redirect',
+ 'type' => 'select',
+ 'label' => __( 'Where should users be redirected to?', 'ultimate-member' ),
+ 'tooltip' => __( 'Select redirect to page when user hasn\'t access to content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect'] ) ? $data['_um_access_redirect'] : '0',
+ 'conditional' => array( '_um_noaccess_action', '=', '1' ),
+ 'options' => array(
+ '0' => __( 'Login page', 'ultimate-member' ),
+ '1' => __( 'Custom URL', 'ultimate-member' ),
+ ),
+ ),
+ array(
+ 'id' => '_um_access_redirect_url',
+ 'type' => 'text',
+ 'label' => __( 'Redirect URL', 'ultimate-member' ),
+ 'tooltip' => __( 'Changed global restrict message', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_redirect_url'] ) ? $data['_um_access_redirect_url'] : '',
+ 'conditional' => array( '_um_access_redirect', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_access_hide_from_queries',
+ 'type' => 'checkbox',
+ 'label' => __( 'Hide from queries', 'ultimate-member' ),
+ 'tooltip' => __( 'Hide this content from archives, RSS feeds etc for users who do not have permission to view this content', 'ultimate-member' ),
+ 'value' => ! empty( $data['_um_access_hide_from_queries'] ) ? $data['_um_access_hide_from_queries'] : '',
+ 'conditional' => array( '_um_accessible', '!=', '0' )
+ )
+ ), $data );
- UM()->admin_forms( array(
- 'class' => 'um-restrict-content um-third-column',
- 'prefix_id' => 'um_content_restriction',
- 'fields' => $fields
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-restrict-content um-third-column',
+ 'prefix_id' => 'um_content_restriction',
+ 'fields' => $fields
+ ) )->render_form(); ?>
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/feed.php b/includes/admin/templates/dashboard/feed.php
index ee2b9da2..8670a505 100644
--- a/includes/admin/templates/dashboard/feed.php
+++ b/includes/admin/templates/dashboard/feed.php
@@ -1,18 +1,20 @@
-';
+
- wp_widget_rss_output(array(
- 'url' => 'https://ultimatemember.com/blog/feed/',
- 'title' => 'Latest From Ultimate Member',
- 'items' => 4,
- 'show_summary' => 0,
- 'show_author' => 0,
- 'show_date' => 1,
- ));
-
- echo "
";
-
- echo "";
-
-?>
\ No newline at end of file
+
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/language-contrib.php b/includes/admin/templates/dashboard/language-contrib.php
index fc42d800..6909e03b 100644
--- a/includes/admin/templates/dashboard/language-contrib.php
+++ b/includes/admin/templates/dashboard/language-contrib.php
@@ -1,3 +1,7 @@
-%1$s.','ultimate-member'), $locale); ?>
+
+ %1$s.', 'ultimate-member' ), $locale ); ?>
+
-community forum.','ultimate-member'); ?>
\ No newline at end of file
+
+ community forum.', 'ultimate-member' ); ?>
+
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/language-download.php b/includes/admin/templates/dashboard/language-download.php
index 80d21945..ab5f06d7 100644
--- a/includes/admin/templates/dashboard/language-download.php
+++ b/includes/admin/templates/dashboard/language-download.php
@@ -1,3 +1,9 @@
-%1$s (%2$s).','ultimate-member'), UM()->available_languages[$locale], $locale); ?>
+
+ %1$s (%2$s).', 'ultimate-member' ), UM()->available_languages[ $locale ], $locale ); ?>
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/language-update.php b/includes/admin/templates/dashboard/language-update.php
index dfae2d17..4287e3b7 100644
--- a/includes/admin/templates/dashboard/language-update.php
+++ b/includes/admin/templates/dashboard/language-update.php
@@ -1,3 +1,9 @@
-%1$s (%2$s).','ultimate-member'), UM()->available_languages[$locale], $locale); ?>
+
+ %1$s (%2$s).', 'ultimate-member' ), UM()->available_languages[ $locale ], $locale ); ?>
+
-
\ No newline at end of file
+
+
+
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/purge.php b/includes/admin/templates/dashboard/purge.php
index 44fc55cc..823d5cdb 100644
--- a/includes/admin/templates/dashboard/purge.php
+++ b/includes/admin/templates/dashboard/purge.php
@@ -1,11 +1,19 @@
-dir_size('temp') > 0.1 ) { ?>
+dir_size( 'temp' ) > 0.1 ) { ?>
-You can free up dir_size('temp'); ?>MB by purging your temp upload directory.
+
+ %s MB by purging your temp upload directory.', 'ultimate-member' ), $this->dir_size( 'temp' ) ); ?>
+
-Purge Temp
+
+
+
+
+
-Your temp uploads directory is clean . There is nothing to purge.
+
+ clean. There is nothing to purge.', 'ultimate-member' ); ?>
+
\ No newline at end of file
diff --git a/includes/admin/templates/dashboard/users.php b/includes/admin/templates/dashboard/users.php
index 73526d2b..124c69b7 100644
--- a/includes/admin/templates/dashboard/users.php
+++ b/includes/admin/templates/dashboard/users.php
@@ -1,45 +1,42 @@
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/directory/appearance.php b/includes/admin/templates/directory/appearance.php
index 385747e5..1d3d5c7f 100644
--- a/includes/admin/templates/directory/appearance.php
+++ b/includes/admin/templates/directory/appearance.php
@@ -1,5 +1,4 @@
-
admin_forms( array(
'class' => 'um-member-directory-appearance um-top-label',
'prefix_id' => 'um_metadata',
diff --git a/includes/admin/templates/directory/pagination.php b/includes/admin/templates/directory/pagination.php
index 545801b7..bea56bd2 100644
--- a/includes/admin/templates/directory/pagination.php
+++ b/includes/admin/templates/directory/pagination.php
@@ -1,5 +1,4 @@
-
admin_forms( array(
'class' => 'um-member-directory-pagination um-half-column',
'prefix_id' => 'um_metadata',
diff --git a/includes/admin/templates/directory/profile.php b/includes/admin/templates/directory/profile.php
index e54f0551..1eeee62d 100644
--- a/includes/admin/templates/directory/profile.php
+++ b/includes/admin/templates/directory/profile.php
@@ -1,16 +1,15 @@
- builtin()->all_user_fields() as $key => $arr ) {
- $user_fields[$key] = isset( $arr['title'] ) ? $arr['title'] : '';
- }
+ builtin()->all_user_fields() as $key => $arr ) {
+ $user_fields[$key] = isset( $arr['title'] ) ? $arr['title'] : '';
+ }
$post_id = get_the_ID();
$_um_tagline_fields = get_post_meta( $post_id, '_um_tagline_fields', true );
$_um_reveal_fields = get_post_meta( $post_id, '_um_reveal_fields', true );
- UM()->admin_forms( array(
+ UM()->admin_forms( array(
'class' => 'um-member-directory-profile um-half-column',
'prefix_id' => 'um_metadata',
'fields' => array(
@@ -69,8 +68,8 @@
'value' => $_um_reveal_fields,
'add_text' => __( 'Add New Custom Field', 'ultimate-member' ),
'conditional' => array( '_um_show_userinfo', '=', 1 ),
- 'options' => $user_fields,
- 'show_default_number' => 1,
+ 'options' => $user_fields,
+ 'show_default_number' => 1,
),
array(
'id' => '_um_show_social',
diff --git a/includes/admin/templates/directory/shortcode.php b/includes/admin/templates/directory/shortcode.php
index f14cf4c8..35124f74 100644
--- a/includes/admin/templates/directory/shortcode.php
+++ b/includes/admin/templates/directory/shortcode.php
@@ -1,5 +1,3 @@
\ No newline at end of file
diff --git a/includes/admin/templates/extensions.php b/includes/admin/templates/extensions.php
index 7622a605..e0da08cb 100644
--- a/includes/admin/templates/extensions.php
+++ b/includes/admin/templates/extensions.php
@@ -1,221 +1,248 @@
'https://ultimatemember.com/extensions/bbpress/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/bbpress.png',
- 'name' => 'bbPress',
- 'desc' => 'With the bbPress extension you can integrate Ultimate Member with bbPress',
- );
+$premium['bbpress'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/bbpress/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/bbpress.png',
+ 'name' => 'bbPress',
+ 'desc' => 'With the bbPress extension you can integrate Ultimate Member with bbPress',
+);
- $premium['profile-completeness'] = array(
- 'url' => 'https://ultimatemember.com/extensions/profile-completeness/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/profile-completeness.png',
- 'name' => 'Profile Completeness',
- 'desc' => 'Encourage or force users to complete their profile on your site',
- );
+$premium['profile-completeness'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/profile-completeness/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/profile-completeness.png',
+ 'name' => 'Profile Completeness',
+ 'desc' => 'Encourage or force users to complete their profile on your site',
+);
- $premium['verified-users'] = array(
- 'url' => 'https://ultimatemember.com/extensions/verified-users/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/verified-users.png',
- 'name' => 'Verified Users',
- 'desc' => 'Add a user verficiation system to your site so user accounts can be verified',
- );
+$premium['verified-users'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/verified-users/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/verified-users.png',
+ 'name' => 'Verified Users',
+ 'desc' => 'Add a user verficiation system to your site so user accounts can be verified',
+);
- $premium['friends'] = array(
- 'url' => 'https://ultimatemember.com/extensions/friends/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/friends.png',
- 'name' => 'Friends',
- 'desc' => 'Increase user interaction on your site by allowing users to become friends',
- );
+$premium['friends'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/friends/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/friends.png',
+ 'name' => 'Friends',
+ 'desc' => 'Increase user interaction on your site by allowing users to become friends',
+);
- $premium['woocommerce'] = array(
- 'url' => 'https://ultimatemember.com/extensions/woocommerce/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/woocommerce.png',
- 'name' => 'WooCommerce',
- 'desc' => 'Integrates the popular e-commerce plugin WooCommerce with Ultimate Member',
- );
+$premium['woocommerce'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/woocommerce/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/woocommerce.png',
+ 'name' => 'WooCommerce',
+ 'desc' => 'Integrates the popular e-commerce plugin WooCommerce with Ultimate Member',
+);
- $premium['notices'] = array(
- 'url' => 'https://ultimatemember.com/extensions/notices/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notices.png',
- 'name' => 'Notices',
- 'desc' => 'Alert users to important information using conditional notices',
- );
+$premium['notices'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/notices/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notices.png',
+ 'name' => 'Notices',
+ 'desc' => 'Alert users to important information using conditional notices',
+);
- $premium['followers'] = array(
- 'url' => 'https://ultimatemember.com/extensions/followers/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/follow.png',
- 'name' => 'Followers',
- 'desc' => 'Increase user interaction on your site by allowing users to follow each other',
- );
+$premium['followers'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/followers/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/follow.png',
+ 'name' => 'Followers',
+ 'desc' => 'Increase user interaction on your site by allowing users to follow each other',
+);
- $premium['mycred'] = array(
- 'url' => 'https://ultimatemember.com/extensions/mycred/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mycred.png',
- 'name' => 'myCRED',
- 'desc' => 'With the myCRED extension you can integrate Ultimate Member with myCRED',
- );
+$premium['mycred'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/mycred/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mycred.png',
+ 'name' => 'myCRED',
+ 'desc' => 'With the myCRED extension you can integrate Ultimate Member with myCRED',
+);
- $premium['private-messages'] = array(
- 'url' => 'https://ultimatemember.com/extensions/private-messages/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/private-messages.png',
- 'name' => 'Private Messages',
- 'desc' => 'Add a private messaging system to your site & allow users to message each other',
- );
+$premium['private-messages'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/private-messages/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/private-messages.png',
+ 'name' => 'Private Messages',
+ 'desc' => 'Add a private messaging system to your site & allow users to message each other',
+);
- $premium['social-activity'] = array(
- 'url' => 'https://ultimatemember.com/extensions/social-activity/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-activity.png',
- 'name' => 'Social Activity',
- 'desc' => 'Let users create public wall posts & see the activity of other users',
- );
+$premium['social-activity'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/social-activity/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-activity.png',
+ 'name' => 'Social Activity',
+ 'desc' => 'Let users create public wall posts & see the activity of other users',
+);
- $premium['social-login'] = array(
- 'url' => 'https://ultimatemember.com/extensions/social-login/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-login.png',
- 'name' => 'Social Login',
- 'desc' => 'Let users register & login to your site via Facebook, Twitter, G+, LinkedIn, and more',
- );
+$premium['social-login'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/social-login/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/social-login.png',
+ 'name' => 'Social Login',
+ 'desc' => 'Let users register & login to your site via Facebook, Twitter, G+, LinkedIn, and more',
+);
- $premium['instagram'] = array(
- 'url' => 'https://ultimatemember.com/extensions/instagram/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/instagram.png',
- 'name' => 'Instagram',
- 'desc' => 'Allow users to show their Instagram photos on their profile',
- );
+$premium['instagram'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/instagram/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/instagram.png',
+ 'name' => 'Instagram',
+ 'desc' => 'Allow users to show their Instagram photos on their profile',
+);
- $premium['user-tags'] = array(
- 'url' => 'https://ultimatemember.com/extensions/user-tags/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/usertags.png',
- 'name' => 'User Tags',
- 'desc' => 'With this extension you can add a user tag system to your website',
- );
+$premium['user-tags'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/user-tags/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/usertags.png',
+ 'name' => 'User Tags',
+ 'desc' => 'With this extension you can add a user tag system to your website',
+);
- $premium['mailchimp'] = array(
- 'url' => 'https://ultimatemember.com/extensions/mailchimp/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mailchimp.png',
- 'name' => 'MailChimp',
- 'desc' => 'Allow users to subscribe to your mailchimp lists when they signup on your site',
- );
+$premium['mailchimp'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/mailchimp/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/mailchimp.png',
+ 'name' => 'MailChimp',
+ 'desc' => 'Allow users to subscribe to your mailchimp lists when they signup on your site',
+);
- $premium['user-reviews'] = array(
- 'url' => 'https://ultimatemember.com/extensions/user-reviews/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/user-reviews.png',
- 'name' => 'User Reviews',
- 'desc' => 'Allow users to rate & review each other using a 5 star rate/review system',
- );
+$premium['user-reviews'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/user-reviews/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/user-reviews.png',
+ 'name' => 'User Reviews',
+ 'desc' => 'Allow users to rate & review each other using a 5 star rate/review system',
+);
- $premium['real-time-notifications'] = array(
- 'url' => 'https://ultimatemember.com/extensions/real-time-notifications/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notifications.png',
- 'name' => 'Real-time Notifications',
- 'desc' => 'Add a notifications system to your site so users can receive real-time notifications',
- );
+$premium['real-time-notifications'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/real-time-notifications/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/05/notifications.png',
+ 'name' => 'Real-time Notifications',
+ 'desc' => 'Add a notifications system to your site so users can receive real-time notifications',
+);
- $premium['private-content'] = array(
- 'url' => 'https://ultimatemember.com/extensions/private-content/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/bb-plugin/cache/private-content-page-circle.png',
- 'name' => 'Private Content',
- 'desc' => 'With the private content extension you can provide logged in users with content that only they can access and view',
- );
+$premium['private-content'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/private-content/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/bb-plugin/cache/private-content-page-circle.png',
+ 'name' => 'Private Content',
+ 'desc' => 'With the private content extension you can provide logged in users with content that only they can access and view',
+);
-
- $free['online-users'] = array(
- 'url' => 'https://ultimatemember.com/extensions/online-users/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/Online-Users.png',
- 'name' => 'Online Users',
- 'desc' => 'Display online users on your site so users can see who is online'
- );
-
- $free['google-recaptcha'] = array(
- 'url' => 'https://ultimatemember.com/extensions/google-recaptcha/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/google.png',
- 'name' => 'Google reCAPTCHA',
- 'desc' => 'Stop bots on your registration & login forms with Google reCAPTCHA',
- );
- $free['terms-conditions'] = array(
- 'url' => 'https://ultimatemember.com/extensions/terms-conditions/',
- 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/terms-conditions.png',
- 'name' => 'Terms & Conditions',
- 'desc' => 'Add terms & conditions to your registration form',
- );
-
-?>
+$free['online-users'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/online-users/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/Online-Users.png',
+ 'name' => 'Online Users',
+ 'desc' => 'Display online users on your site so users can see who is online'
+);
+
+$free['google-recaptcha'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/google-recaptcha/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/google.png',
+ 'name' => 'Google reCAPTCHA',
+ 'desc' => 'Stop bots on your registration & login forms with Google reCAPTCHA',
+);
+
+$free['terms-conditions'] = array(
+ 'url' => 'https://ultimatemember.com/extensions/terms-conditions/',
+ 'image' => 'https://ultimatemember.com/wp-content/uploads/edd/2017/07/terms-conditions.png',
+ 'name' => 'Terms & Conditions',
+ 'desc' => 'Add terms & conditions to your registration form',
+); ?>
-
+
Ultimate Member - Extensions
-
+
-
Core Extensions Bundle – Check out our extensions bundle which includes all extensions at a significant discount.
-
+
+ Core Extensions Bundle – Check out our extensions bundle which includes all extensions at a significant discount.
+
+
-
+
-
-
-
- $info ) { ?>
-
-
-
-
-
-
-
-
-
- $info ) { ?>
-
-
-
-
-
+
-
+ if ( isset( $_REQUEST['filter'] ) && $_REQUEST['filter'] == 'free' ) {
+ foreach ( $free as $key => $info ) { ?>
+
+
-
-
-
-
-
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/includes/admin/templates/form/builder.php b/includes/admin/templates/form/builder.php
index 99d7f64f..34919c1f 100644
--- a/includes/admin/templates/form/builder.php
+++ b/includes/admin/templates/form/builder.php
@@ -1,9 +1,6 @@
-builder()->form_id ) ) {
+builder()->form_id ) ) {
UM()->builder()->form_id = $this->form_id;
-}
-?>
+} ?>
diff --git a/includes/admin/templates/form/login_settings.php b/includes/admin/templates/form/login_settings.php
index b2af83cc..f24bbc0b 100644
--- a/includes/admin/templates/form/login_settings.php
+++ b/includes/admin/templates/form/login_settings.php
@@ -1,5 +1,4 @@
-
-
-
+
\ No newline at end of file
diff --git a/includes/admin/templates/modal/fonticons.php b/includes/admin/templates/modal/fonticons.php
index a321d8c0..a732db66 100644
--- a/includes/admin/templates/modal/fonticons.php
+++ b/includes/admin/templates/modal/fonticons.php
@@ -1,16 +1,14 @@
-
fonticons()->all ) ); ?>
+ fonticons()->all ) ); ?>
-
-
-
+
\ No newline at end of file
diff --git a/includes/admin/templates/role/admin-permissions.php b/includes/admin/templates/role/admin-permissions.php
index 19f293c6..ad7e1f29 100644
--- a/includes/admin/templates/role/admin-permissions.php
+++ b/includes/admin/templates/role/admin-permissions.php
@@ -1,58 +1,58 @@
admin_forms( array(
- 'class' => 'um-role-admin um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_can_access_wpadmin',
- 'type' => 'checkbox',
- 'label' => __( 'Can access wp-admin?', 'ultimate-member' ),
- 'tooltip' => __( 'The core admin role must always have access to wp-admin / WordPress backend', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_access_wpadmin'] ) ? $role['_um_can_access_wpadmin'] : 0,
- ),
- array(
- 'id' => '_um_can_not_see_adminbar',
- 'type' => 'checkbox',
- 'label' => __( 'Force hiding adminbar in frontend?', 'ultimate-member' ),
- 'tooltip' => __( 'Show/hide the adminbar on frontend', 'ultimate-member' ),
- 'value' => isset( $role['_um_can_not_see_adminbar'] ) ? $role['_um_can_not_see_adminbar'] : 1,
- ),
- array(
- 'id' => '_um_can_edit_everyone',
- 'type' => 'checkbox',
- 'label' => __( 'Can edit other member accounts?', 'ultimate-member' ),
- 'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_edit_everyone'] ) ? $role['_um_can_edit_everyone'] : 0,
- ),
- array(
- 'id' => '_um_can_edit_roles',
- 'type' => 'select',
- 'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
- 'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
- 'options' => UM()->roles()->get_roles(),
- 'multi' => true,
- 'value' => ! empty( $role['_um_can_edit_roles'] ) ? $role['_um_can_edit_roles'] : array(),
- 'conditional' => array( '_um_can_edit_everyone', '=', '1' )
- ),
- array(
- 'id' => '_um_can_delete_everyone',
- 'type' => 'checkbox',
- 'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
- 'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
- ),
- array(
- 'id' => '_um_can_delete_roles',
- 'type' => 'select',
- 'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
- 'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
- 'options' => UM()->roles()->get_roles(),
- 'multi' => true,
- 'value' => ! empty( $role['_um_can_delete_roles'] ) ? $role['_um_can_delete_roles'] : array(),
- 'conditional' => array( '_um_can_delete_everyone', '=', '1' )
- )
- )
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-role-admin um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_can_access_wpadmin',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can access wp-admin?', 'ultimate-member' ),
+ 'tooltip' => __( 'The core admin role must always have access to wp-admin / WordPress backend', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_access_wpadmin'] ) ? $role['_um_can_access_wpadmin'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_not_see_adminbar',
+ 'type' => 'checkbox',
+ 'label' => __( 'Force hiding adminbar in frontend?', 'ultimate-member' ),
+ 'tooltip' => __( 'Show/hide the adminbar on frontend', 'ultimate-member' ),
+ 'value' => isset( $role['_um_can_not_see_adminbar'] ) ? $role['_um_can_not_see_adminbar'] : 1,
+ ),
+ array(
+ 'id' => '_um_can_edit_everyone',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can edit other member accounts?', 'ultimate-member' ),
+ 'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_edit_everyone'] ) ? $role['_um_can_edit_everyone'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_edit_roles',
+ 'type' => 'select',
+ 'label' => __( 'Can edit these user roles only', 'ultimate-member' ),
+ 'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
+ 'options' => UM()->roles()->get_roles(),
+ 'multi' => true,
+ 'value' => ! empty( $role['_um_can_edit_roles'] ) ? $role['_um_can_edit_roles'] : array(),
+ 'conditional' => array( '_um_can_edit_everyone', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_can_delete_everyone',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can delete other member accounts?', 'ultimate-member' ),
+ 'tooltip' => __( 'Allow this role to edit accounts of other members', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_delete_everyone'] ) ? $role['_um_can_delete_everyone'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_delete_roles',
+ 'type' => 'select',
+ 'label' => __( 'Can delete these user roles only', 'ultimate-member' ),
+ 'tooltip' => __( 'Which roles that role can edit, choose none to allow role to edit all member roles', 'ultimate-member' ),
+ 'options' => UM()->roles()->get_roles(),
+ 'multi' => true,
+ 'value' => ! empty( $role['_um_can_delete_roles'] ) ? $role['_um_can_delete_roles'] : array(),
+ 'conditional' => array( '_um_can_delete_everyone', '=', '1' )
+ )
+ )
+ ) )->render_form(); ?>
\ No newline at end of file
diff --git a/includes/admin/templates/role/delete.php b/includes/admin/templates/role/delete.php
index c9c3471a..66ff7972 100644
--- a/includes/admin/templates/role/delete.php
+++ b/includes/admin/templates/role/delete.php
@@ -2,30 +2,30 @@
admin_forms( array(
- 'class' => 'um-role-delete um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_after_delete',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after account is deleted', 'ultimate-member' ),
- 'tooltip' => __( 'Select what happens when a user with this role deletes their own account', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_after_delete'] ) ? $role['_um_after_delete'] : array(),
- 'options' => array(
- 'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
- 'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
- )
- ),
- array(
- 'id' => '_um_delete_redirect_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'tooltip' => __( 'Set a url to redirect this user role to after they delete account', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_delete_redirect_url'] ) ? $role['_um_delete_redirect_url'] : '',
- 'conditional' => array( '_um_after_delete', '=', 'redirect_url' )
- )
- )
- ) )->render_form(); ?>
-
+ UM()->admin_forms( array(
+ 'class' => 'um-role-delete um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_after_delete',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after account is deleted', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what happens when a user with this role deletes their own account', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_after_delete'] ) ? $role['_um_after_delete'] : array(),
+ 'options' => array(
+ 'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
+ 'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
+ )
+ ),
+ array(
+ 'id' => '_um_delete_redirect_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'tooltip' => __( 'Set a url to redirect this user role to after they delete account', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_delete_redirect_url'] ) ? $role['_um_delete_redirect_url'] : '',
+ 'conditional' => array( '_um_after_delete', '=', 'redirect_url' )
+ )
+ )
+ ) )->render_form(); ?>
+
\ No newline at end of file
diff --git a/includes/admin/templates/role/general.php b/includes/admin/templates/role/general.php
index bd681e2c..0db07a9b 100644
--- a/includes/admin/templates/role/general.php
+++ b/includes/admin/templates/role/general.php
@@ -1,24 +1,24 @@
admin_forms( array(
- 'class' => 'um-role-general um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_can_edit_profile',
- 'type' => 'checkbox',
- 'label' => __( 'Can edit their profile?', 'ultimate-member' ),
- 'tooltip' => __( 'Can this role edit his own profile?', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_edit_profile'] ) ? $role['_um_can_edit_profile'] : 0,
- ),
- array(
- 'id' => '_um_can_delete_profile',
- 'type' => 'checkbox',
- 'label' => __( 'Can delete their account?', 'ultimate-member' ),
- 'tooltip' => __( 'Allow this role to delete their account and end their membership on your site', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_delete_profile'] ) ? $role['_um_can_delete_profile'] : 0,
- )
- )
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-role-general um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_can_edit_profile',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can edit their profile?', 'ultimate-member' ),
+ 'tooltip' => __( 'Can this role edit his own profile?', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_edit_profile'] ) ? $role['_um_can_edit_profile'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_delete_profile',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can delete their account?', 'ultimate-member' ),
+ 'tooltip' => __( 'Allow this role to delete their account and end their membership on your site', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_delete_profile'] ) ? $role['_um_can_delete_profile'] : 0,
+ )
+ )
+ ) )->render_form(); ?>
\ No newline at end of file
diff --git a/includes/admin/templates/role/home.php b/includes/admin/templates/role/home.php
index 9440f3a7..c8f92fe8 100644
--- a/includes/admin/templates/role/home.php
+++ b/includes/admin/templates/role/home.php
@@ -2,26 +2,26 @@
admin_forms( array(
- 'class' => 'um-role-home um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_default_homepage',
- 'type' => 'checkbox',
- 'label' => __( 'Can view default homepage?', 'ultimate-member' ),
- 'tooltip' => __( 'Allow this user role to view your site\'s homepage', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_default_homepage'] ) ? $role['_um_default_homepage'] : 1,
- ),
- array(
- 'id' => '_um_redirect_homepage',
- 'type' => 'text',
- 'label' => __( 'Custom Homepage Redirect', 'ultimate-member' ),
- 'tooltip' => __( 'Set a url to redirect this user role to if they try to view your site\'s homepage', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_redirect_homepage'] ) ? $role['_um_redirect_homepage'] : '',
- 'conditional' => array( '_um_default_homepage', '=', '0' )
- )
- )
- ) )->render_form(); ?>
-
+ UM()->admin_forms( array(
+ 'class' => 'um-role-home um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_default_homepage',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can view default homepage?', 'ultimate-member' ),
+ 'tooltip' => __( 'Allow this user role to view your site\'s homepage', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_default_homepage'] ) ? $role['_um_default_homepage'] : 1,
+ ),
+ array(
+ 'id' => '_um_redirect_homepage',
+ 'type' => 'text',
+ 'label' => __( 'Custom Homepage Redirect', 'ultimate-member' ),
+ 'tooltip' => __( 'Set a url to redirect this user role to if they try to view your site\'s homepage', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_redirect_homepage'] ) ? $role['_um_redirect_homepage'] : '',
+ 'conditional' => array( '_um_default_homepage', '=', '0' )
+ )
+ )
+ ) )->render_form(); ?>
+
\ No newline at end of file
diff --git a/includes/admin/templates/role/login.php b/includes/admin/templates/role/login.php
index 7c2330cf..359d0840 100644
--- a/includes/admin/templates/role/login.php
+++ b/includes/admin/templates/role/login.php
@@ -2,32 +2,32 @@
admin_forms( array(
- 'class' => 'um-role-login um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_after_login',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after login', 'ultimate-member' ),
- 'tooltip' => __( 'Select what happens when a user with this role logins to your site', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_after_login'] ) ? $role['_um_after_login'] : array(),
- 'options' => array(
- 'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
- 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
- 'refresh' => __( 'Refresh active page', 'ultimate-member' ),
- 'redirect_admin' => __( 'Redirect to WordPress Admin', 'ultimate-member' )
- )
- ),
- array(
- 'id' => '_um_login_redirect_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'tooltip' => __( 'Set a url to redirect this user role to after they login with their account', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_login_redirect_url'] ) ? $role['_um_login_redirect_url'] : '',
- 'conditional' => array( '_um_after_login', '=', 'redirect_url' )
- )
- )
- ) )->render_form(); ?>
-
+ UM()->admin_forms( array(
+ 'class' => 'um-role-login um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_after_login',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after login', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what happens when a user with this role logins to your site', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_after_login'] ) ? $role['_um_after_login'] : array(),
+ 'options' => array(
+ 'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
+ 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
+ 'refresh' => __( 'Refresh active page', 'ultimate-member' ),
+ 'redirect_admin' => __( 'Redirect to WordPress Admin', 'ultimate-member' )
+ )
+ ),
+ array(
+ 'id' => '_um_login_redirect_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'tooltip' => __( 'Set a url to redirect this user role to after they login with their account', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_login_redirect_url'] ) ? $role['_um_login_redirect_url'] : '',
+ 'conditional' => array( '_um_after_login', '=', 'redirect_url' )
+ )
+ )
+ ) )->render_form(); ?>
+
\ No newline at end of file
diff --git a/includes/admin/templates/role/logout.php b/includes/admin/templates/role/logout.php
index 654a51af..59e4acb3 100644
--- a/includes/admin/templates/role/logout.php
+++ b/includes/admin/templates/role/logout.php
@@ -2,30 +2,30 @@
admin_forms( array(
- 'class' => 'um-role-logout um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_after_logout',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after logout', 'ultimate-member' ),
- 'tooltip' => __( 'Select what happens when a user with this role logouts of your site', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_after_logout'] ) ? $role['_um_after_logout'] : array(),
- 'options' => array(
- 'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
- 'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
- )
- ),
- array(
- 'id' => '_um_logout_redirect_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'tooltip' => __( 'Set a url to redirect this user role to after they logout from site', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_logout_redirect_url'] ) ? $role['_um_logout_redirect_url'] : '',
- 'conditional' => array( '_um_after_logout', '=', 'redirect_url' )
- )
- )
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-role-logout um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_after_logout',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after logout', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what happens when a user with this role logouts of your site', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_after_logout'] ) ? $role['_um_after_logout'] : array(),
+ 'options' => array(
+ 'redirect_home' => __( 'Go to Homepage', 'ultimate-member' ),
+ 'redirect_url' => __( 'Go to Custom URL', 'ultimate-member' ),
+ )
+ ),
+ array(
+ 'id' => '_um_logout_redirect_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'tooltip' => __( 'Set a url to redirect this user role to after they logout from site', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_logout_redirect_url'] ) ? $role['_um_logout_redirect_url'] : '',
+ 'conditional' => array( '_um_after_logout', '=', 'redirect_url' )
+ )
+ )
+ ) )->render_form(); ?>
\ No newline at end of file
diff --git a/includes/admin/templates/role/profile.php b/includes/admin/templates/role/profile.php
index 03fba778..be86c4d5 100644
--- a/includes/admin/templates/role/profile.php
+++ b/includes/admin/templates/role/profile.php
@@ -1,44 +1,44 @@
admin_forms( array(
- 'class' => 'um-role-profile um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_can_view_all',
- 'type' => 'checkbox',
- 'label' => __( 'Can view other member profiles?', 'ultimate-member' ),
- 'tooltip' => __( 'Can this role view all member profiles?', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_view_all'] ) ? $role['_um_can_view_all'] : 0,
- ),
- array(
- 'id' => '_um_can_view_roles',
- 'type' => 'select',
- 'label' => __( 'Can view these user roles only', 'ultimate-member' ),
- 'tooltip' => __( 'Which roles that role can view, choose none to allow role to view all member roles', 'ultimate-member' ),
- 'options' => UM()->roles()->get_roles(),
- 'multi' => true,
- 'value' => ! empty( $role['_um_can_view_roles'] ) ? $role['_um_can_view_roles'] : array(),
- 'conditional' => array( '_um_can_view_all', '=', '1' )
- ),
- array(
- 'id' => '_um_can_make_private_profile',
- 'type' => 'checkbox',
- 'name' => '_um_can_make_private_profile',
- 'label' => __( 'Can make their profile private?', 'ultimate-member' ),
- 'tooltip' => __( 'Can this role make their profile private?', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_make_private_profile'] ) ? $role['_um_can_make_private_profile'] : 0,
- ),
- array(
- 'id' => '_um_can_access_private_profile',
- 'type' => 'checkbox',
- 'name' => '_um_can_access_private_profile',
- 'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
- 'tooltip' => __( 'Can this role view private profiles?', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
- )
- )
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-role-profile um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_can_view_all',
+ 'type' => 'checkbox',
+ 'label' => __( 'Can view other member profiles?', 'ultimate-member' ),
+ 'tooltip' => __( 'Can this role view all member profiles?', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_view_all'] ) ? $role['_um_can_view_all'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_view_roles',
+ 'type' => 'select',
+ 'label' => __( 'Can view these user roles only', 'ultimate-member' ),
+ 'tooltip' => __( 'Which roles that role can view, choose none to allow role to view all member roles', 'ultimate-member' ),
+ 'options' => UM()->roles()->get_roles(),
+ 'multi' => true,
+ 'value' => ! empty( $role['_um_can_view_roles'] ) ? $role['_um_can_view_roles'] : array(),
+ 'conditional' => array( '_um_can_view_all', '=', '1' )
+ ),
+ array(
+ 'id' => '_um_can_make_private_profile',
+ 'type' => 'checkbox',
+ 'name' => '_um_can_make_private_profile',
+ 'label' => __( 'Can make their profile private?', 'ultimate-member' ),
+ 'tooltip' => __( 'Can this role make their profile private?', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_make_private_profile'] ) ? $role['_um_can_make_private_profile'] : 0,
+ ),
+ array(
+ 'id' => '_um_can_access_private_profile',
+ 'type' => 'checkbox',
+ 'name' => '_um_can_access_private_profile',
+ 'label' => __( 'Can view/access private profiles?', 'ultimate-member' ),
+ 'tooltip' => __( 'Can this role view private profiles?', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_can_access_private_profile'] ) ? $role['_um_can_access_private_profile'] : 0,
+ )
+ )
+ ) )->render_form(); ?>
\ No newline at end of file
diff --git a/includes/admin/templates/role/register.php b/includes/admin/templates/role/register.php
index 4418689f..b3787983 100644
--- a/includes/admin/templates/role/register.php
+++ b/includes/admin/templates/role/register.php
@@ -1,110 +1,110 @@
admin_forms( array(
- 'class' => 'um-role-register um-half-column',
- 'prefix_id' => 'role',
- 'fields' => array(
- array(
- 'id' => '_um_status',
- 'type' => 'select',
- 'label' => __( 'Registration Status', 'ultimate-member' ),
- 'tooltip' => __( 'Select the status you would like this user role to have after they register on your site', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_status'] ) ? $role['_um_status'] : array(),
- 'options' => array(
- 'approved' => __( 'Auto Approve', 'ultimate-member' ),
- 'checkmail' => __( 'Require Email Activation', 'ultimate-member' ),
- 'pending' => __( 'Require Admin Review', 'ultimate-member' )
- ),
- ),
- array(
- 'id' => '_um_auto_approve_act',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
- 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_auto_approve_act'] ) ? $role['_um_auto_approve_act'] : array(),
- 'options' => array(
- 'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
- 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_status', '=', 'approved' )
- ),
- array(
- 'id' => '_um_auto_approve_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_auto_approve_url'] ) ? $role['_um_auto_approve_url'] : '',
- 'conditional' => array( '_um_auto_approve_act', '=', 'redirect_url' )
- ),
- array(
- 'id' => '_um_login_email_activate',
- 'type' => 'checkbox',
- 'label' => __( 'Login user after validating the activation link?', 'ultimate-member' ),
- 'tooltip' => __( 'Login the user after validating the activation link', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_login_email_activate'] ) ? $role['_um_login_email_activate'] : 0,
- 'conditional' => array( '_um_status', '=', 'checkmail' )
- ),
- array(
- 'id' => '_um_checkmail_action',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
- 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_checkmail_action'] ) ? $role['_um_checkmail_action'] : array(),
- 'options' => array(
- 'show_message' => __( 'Show custom message', 'ultimate-member' ),
- 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_status', '=', 'checkmail' )
- ),
- array(
- 'id' => '_um_checkmail_message',
- 'type' => 'textarea',
- 'label' => __( 'Personalize the custom message', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_checkmail_message'] ) ? $role['_um_checkmail_message'] : __('Thank you for registering. Before you can login we need you to activate your account by clicking the activation link in the email we just sent you.','ultimate-member'),
- 'conditional' => array( '_um_checkmail_action', '=', 'show_message' )
- ),
- array(
- 'id' => '_um_checkmail_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_checkmail_url'] ) ? $role['_um_checkmail_url'] : '',
- 'conditional' => array( '_um_checkmail_action', '=', 'redirect_url' )
- ),
- array(
- 'id' => '_um_url_email_activate',
- 'type' => 'text',
- 'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ),
- 'tooltip' => __( 'If you want users to go to a specific page other than login page after e-mail activation, enter the URL here.', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_url_email_activate'] ) ? $role['_um_url_email_activate'] : '',
- 'conditional' => array( '_um_status', '=', 'checkmail' ),
- ),
- array(
- 'id' => '_um_pending_action',
- 'type' => 'select',
- 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
- 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_pending_action'] ) ? $role['_um_pending_action'] : array(),
- 'options' => array(
- 'show_message' => __( 'Show custom message', 'ultimate-member' ),
- 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
- ),
- 'conditional' => array( '_um_status', '=', 'pending' )
- ),
- array(
- 'id' => '_um_pending_message',
- 'type' => 'textarea',
- 'label' => __( 'Personalize the custom message', 'ultimate-member' ),
- 'value' => ! empty( $role['_um_pending_message'] ) ? $role['_um_pending_message'] : __('Thank you for applying for membership to our site. We will review your details and send you an email letting you know whether your application has been successful or not.','ultimate-member'),
- 'conditional' => array( '_um_pending_action', '=', 'show_message' )
- ),
- array(
- 'id' => '_um_pending_url',
- 'type' => 'text',
- 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
- 'conditional' => array( '_um_pending_action', '=', 'redirect_url' ),
- 'value' => ! empty( $role['_um_pending_url'] ) ? $role['_um_pending_url'] : '',
- ),
- )
- ) )->render_form(); ?>
+ UM()->admin_forms( array(
+ 'class' => 'um-role-register um-half-column',
+ 'prefix_id' => 'role',
+ 'fields' => array(
+ array(
+ 'id' => '_um_status',
+ 'type' => 'select',
+ 'label' => __( 'Registration Status', 'ultimate-member' ),
+ 'tooltip' => __( 'Select the status you would like this user role to have after they register on your site', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_status'] ) ? $role['_um_status'] : array(),
+ 'options' => array(
+ 'approved' => __( 'Auto Approve', 'ultimate-member' ),
+ 'checkmail' => __( 'Require Email Activation', 'ultimate-member' ),
+ 'pending' => __( 'Require Admin Review', 'ultimate-member' )
+ ),
+ ),
+ array(
+ 'id' => '_um_auto_approve_act',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_auto_approve_act'] ) ? $role['_um_auto_approve_act'] : array(),
+ 'options' => array(
+ 'redirect_profile' => __( 'Redirect to profile', 'ultimate-member' ),
+ 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_status', '=', 'approved' )
+ ),
+ array(
+ 'id' => '_um_auto_approve_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_auto_approve_url'] ) ? $role['_um_auto_approve_url'] : '',
+ 'conditional' => array( '_um_auto_approve_act', '=', 'redirect_url' )
+ ),
+ array(
+ 'id' => '_um_login_email_activate',
+ 'type' => 'checkbox',
+ 'label' => __( 'Login user after validating the activation link?', 'ultimate-member' ),
+ 'tooltip' => __( 'Login the user after validating the activation link', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_login_email_activate'] ) ? $role['_um_login_email_activate'] : 0,
+ 'conditional' => array( '_um_status', '=', 'checkmail' )
+ ),
+ array(
+ 'id' => '_um_checkmail_action',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_checkmail_action'] ) ? $role['_um_checkmail_action'] : array(),
+ 'options' => array(
+ 'show_message' => __( 'Show custom message', 'ultimate-member' ),
+ 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_status', '=', 'checkmail' )
+ ),
+ array(
+ 'id' => '_um_checkmail_message',
+ 'type' => 'textarea',
+ 'label' => __( 'Personalize the custom message', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_checkmail_message'] ) ? $role['_um_checkmail_message'] : __('Thank you for registering. Before you can login we need you to activate your account by clicking the activation link in the email we just sent you.','ultimate-member'),
+ 'conditional' => array( '_um_checkmail_action', '=', 'show_message' )
+ ),
+ array(
+ 'id' => '_um_checkmail_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_checkmail_url'] ) ? $role['_um_checkmail_url'] : '',
+ 'conditional' => array( '_um_checkmail_action', '=', 'redirect_url' )
+ ),
+ array(
+ 'id' => '_um_url_email_activate',
+ 'type' => 'text',
+ 'label' => __( 'URL redirect after e-mail activation', 'ultimate-member' ),
+ 'tooltip' => __( 'If you want users to go to a specific page other than login page after e-mail activation, enter the URL here.', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_url_email_activate'] ) ? $role['_um_url_email_activate'] : '',
+ 'conditional' => array( '_um_status', '=', 'checkmail' ),
+ ),
+ array(
+ 'id' => '_um_pending_action',
+ 'type' => 'select',
+ 'label' => __( 'Action to be taken after registration', 'ultimate-member' ),
+ 'tooltip' => __( 'Select what action is taken after a person registers on your site. Depending on the status you can redirect them to their profile, a custom url or show a custom message', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_pending_action'] ) ? $role['_um_pending_action'] : array(),
+ 'options' => array(
+ 'show_message' => __( 'Show custom message', 'ultimate-member' ),
+ 'redirect_url' => __( 'Redirect to URL', 'ultimate-member' ),
+ ),
+ 'conditional' => array( '_um_status', '=', 'pending' )
+ ),
+ array(
+ 'id' => '_um_pending_message',
+ 'type' => 'textarea',
+ 'label' => __( 'Personalize the custom message', 'ultimate-member' ),
+ 'value' => ! empty( $role['_um_pending_message'] ) ? $role['_um_pending_message'] : __('Thank you for applying for membership to our site. We will review your details and send you an email letting you know whether your application has been successful or not.','ultimate-member'),
+ 'conditional' => array( '_um_pending_action', '=', 'show_message' )
+ ),
+ array(
+ 'id' => '_um_pending_url',
+ 'type' => 'text',
+ 'label' => __( 'Set Custom Redirect URL', 'ultimate-member' ),
+ 'conditional' => array( '_um_pending_action', '=', 'redirect_url' ),
+ 'value' => ! empty( $role['_um_pending_url'] ) ? $role['_um_pending_url'] : '',
+ ),
+ )
+ ) )->render_form(); ?>
diff --git a/includes/admin/templates/role/role-edit.php b/includes/admin/templates/role/role-edit.php
index 4162a3d1..bcb0cc25 100644
--- a/includes/admin/templates/role/role-edit.php
+++ b/includes/admin/templates/role/role-edit.php
@@ -1,6 +1,6 @@
roles[ $_GET['id'] ]['name'];
+ if ( empty( $data['_um_is_custom'] ) )
+ $data['name'] = $wp_roles->roles[ $_GET['id'] ]['name'];
}
if ( ! empty( $_POST['role'] ) ) {
- $data = $_POST['role'];
+ $data = $_POST['role'];
- $id = '';
- $redirect = '';
- $error = '';
+ $id = '';
+ $redirect = '';
+ $error = '';
- if ( empty( $data['name'] ) ) {
+ if ( empty( $data['name'] ) ) {
- $error .= __( 'Title is empty!', 'ultimate-member' ) . '' . __( 'User Role Added Successfully.', 'ultimate-member' ) . '
';
+ break;
+ case 'u':
+ echo '