Пример #1
0
 function __construct()
 {
     $this->wp_all_pages = false;
     $this->wp_all_posts = false;
     $this->wp_all_categories = false;
     $this->slug = 'wp-upme';
     $this->tabs = array('general' => __('UPME Settings', 'upme'), 'customizer' => __('Custom Fields', 'upme'), 'sync' => __('Sync / Tools', 'upme'), 'user_cache' => __('Update Search Cache', 'upme'));
     $this->default_tab = 'general';
     add_action('admin_menu', array(&$this, 'add_menu'), 9);
     add_action('admin_enqueue_scripts', array(&$this, 'add_styles'), 9);
     $current_option = get_option('upme_options');
     $this->defaults = array('html_user_login_message' => __('Please log in to view / edit your profile.', 'upme'), 'html_login_to_view' => __('Please log in to view user profiles.', 'upme'), 'html_private_content' => __('This content is for members only. You must log in to view this content.', 'upme'), 'clickable_profile' => 1, 'set_password' => 1, 'guests_can_view' => 1, 'users_can_view' => 1, 'style' => 'default', 'profile_page_id' => '0', 'login_page_id' => '0', 'registration_page_id' => '0', 'redirect_backend_profile' => '0', 'redirect_backend_registration' => '0', 'redirect_backend_login' => '0', 'html_registration_disabled' => __('User registration is currently not allowed.', 'upme'), 'link_author_posts_page' => '1', 'msg_register_success' => __('Registration successful. Please check your email.', 'upme'), 'automatic_login' => 0, 'login_redirect_page_id' => '0', 'date_format' => 'mm/dd/yy', 'show_empty_field_on_profile' => '0', 'show_empty_field_on_profile' => '0', 'hide_frontend_admin_bar' => 'enabled', 'profile_title_field' => 'display_name', 'select_user_role_in_registration' => '0', 'choose_roles_for_registration' => get_option('default_role'), 'label_for_registration_user_role' => __('Select Role', 'upme'), 'reset_password_page_id' => '0', 'set_email_confirmation' => '0', 'lightbox_avatar_cropping' => '1', 'show_recent_user_posts' => '0', 'maximum_allowed_posts' => '3', 'show_feature_image_posts' => '0', 'website_link_on_profile' => '0', 'default_predefined_country' => 'US', 'enforce_password_strength' => '0', 'choose_roles_for_view_profile' => 'administrator', 'profile_modal_window_shortcode' => '[upme]', 'disable_fancybox_script_styles' => '0', 'html_login_to_view_form' => '1', 'html_user_login_message_form' => '1', 'html_private_content_form' => '1', 'html_other_profiles_restricted' => __('Viewing of other profiles restricted for your user role.', 'upme'), 'profile_view_status' => '1', 'html_profile_status_msg' => __('This is a private profile. You are not allowed to view this profile.', 'upme'), 'display_profile_status' => '0', 'html_profile_approval_pending_msg' => __('This profile is pending approval. You will get a notification once the profile is approved.', 'upme'), 'profile_approval_status' => '0', 'ajax_profile_field_save' => '0', 'html_terms_and_conditions' => __('I agree to Terms and Conditions.', 'upme'), 'accepting_terms_and_conditions' => '0', 'site_lockdown_status' => '0', 'site_lockdown_allowed_pages' => '', 'site_lockdown_allowed_posts' => '', 'site_lockdown_allowed_urls' => '', 'site_lockdown_redirect_url' => $current_option['login_page_id'], 'site_lockdown_rss_feed' => '0', 'html_members_private_content' => __('This content is restricted for your user account.', 'upme'), 'link_post_author_to_upme' => '0', 'display_profile_after_post' => '0', 'author_post_profile_template' => '0', 'disable_fitvids_script_styles' => '0', 'disable_tipsy_script_styles' => '0', 'disable_opensans_google_font' => '0', 'email_two_factor_verification_status' => '0', 'profile_tabs_display_status' => 'disabled', 'profile_tabs_initial_display_status' => 'enabled', 'email_from_name' => __('WordPress', 'upme'), 'email_from_address' => upme_get_default_email_address(), 'notifications_all_admins' => '0', 'help_text_html' => '0', 'register_form_title_text' => __('Your display name will appear here.', 'upme'), 'register_form_title_type_username' => '1', 'delete_user_profiles' => 'disabled', 'profile_collapsible_tabs' => '0', 'profile_collapsible_tabs_display' => '0', 'profile_cover_image_status' => '0');
     /* UPME Filters for customizing defualt options */
     $this->defaults = apply_filters('upme_init_options', $this->defaults);
     // End Filter
     $this->default_settings = array('upme-general-settings' => array('style' => 'default', 'date_format' => 'mm/dd/yy', 'hide_frontend_admin_bar' => 'enabled', 'lightbox_avatar_cropping' => '1', 'ajax_profile_field_save' => '0'), 'upme-profile-settings' => array('clickable_profile' => '1', 'link_author_posts_page' => '1', 'avatar_max_size' => '2', 'show_separator_on_profile' => '0', 'show_empty_field_on_profile' => '0', 'profile_title_field' => 'display_name', 'show_recent_user_posts' => '0', 'maximum_allowed_posts' => '3', 'show_feature_image_posts' => '0', 'website_link_on_profile' => '0', 'profile_modal_window_shortcode' => '[upme]', 'profile_view_status' => '1', 'display_profile_status' => '0', 'link_post_author_to_upme' => '0', 'display_profile_after_post' => '0', 'author_post_profile_template' => '0', 'email_two_factor_verification_status' => '0', 'profile_tabs_display_status' => 'disabled', 'profile_tabs_initial_display_status' => 'enabled', 'delete_user_profiles' => 'disabled', 'profile_cover_image_status' => '0'), 'upme-system-pages' => array('profile_page_id' => '0', 'login_page_id' => '0', 'registration_page_id' => '0', 'reset_password_page_id' => '0'), 'upme-redirect-setting' => array('redirect_backend_profile' => '0', 'redirect_backend_login' => '0', 'redirect_backend_registration' => '0', 'login_redirect_page_id' => '0', 'register_redirect_page_id' => '0'), 'upme-registration-option' => array('set_password' => '1', 'automatic_login' => '0', 'captcha_plugin' => 'none', 'captcha_label' => 'Captcha', 'recaptcha_public_key' => '', 'recaptcha_private_key' => '', 'msg_register_success' => __('Registration successful. Please check your email.', 'upme'), 'html_register_success_after' => '', 'select_user_role_in_registration' => '0', 'choose_roles_for_registration' => get_option('default_role'), 'label_for_registration_user_role' => __('Select Role', 'upme'), 'set_email_confirmation' => '0', 'default_predefined_country' => 'US', 'enforce_password_strength' => '0', 'profile_approval_status' => '0', 'accepting_terms_and_conditions' => '0', 'register_form_title_text' => __('Your display name will appear here.', 'upme'), 'register_form_title_type_username' => '1'), 'upme-search-settings' => array('use_cron' => '1', 'require_search_input' => '0', 'users_are_called' => __('User', 'upme'), 'combined_search_text' => __('Combined Search', 'upme'), 'search_button_text' => __('Filter', 'upme')), 'upme-privacy-option' => array('users_can_view' => '1', 'guests_can_view' => '1', 'choose_roles_for_view_profile' => 'administrator'), 'upme-misc-messages' => array('html_login_to_view' => __('Please log in to view user profiles.', 'upme'), 'html_user_login_message' => __('Please log in to view / edit your profile.', 'upme'), 'html_private_content' => __('This content is for members only. You must log in to view this content.', 'upme'), 'html_registration_disabled' => __('User registration is currently not allowed.', 'upme'), 'html_login_to_view_form' => '1', 'html_user_login_message_form' => '1', 'html_private_content_form' => '1', 'html_other_profiles_restricted' => __('Viewing of other profiles restricted for your user role.', 'upme'), 'html_profile_status_msg' => __('This is a private profile. You are not allowed to view this profile.', 'upme'), 'html_profile_approval_pending_msg' => __('This profile is pending approval. You will get a notification once the profile is approved.', 'upme'), 'html_terms_and_conditions' => __('I agree to Terms and Conditions.', 'upme'), 'html_members_private_content' => __('This content is restricted for your user account.', 'upme')), 'upme-scripts-styles' => array('disable_fancybox_script_styles' => '0', 'disable_fitvids_script_styles' => '0', 'disable_tipsy_script_styles' => '0', 'disable_opensans_google_font' => '0'));
     $this->default_module_settings = array('upme-site-lockdown-settings' => array('site_lockdown_status' => '0', 'site_lockdown_allowed_pages' => '', 'site_lockdown_allowed_posts' => '', 'site_lockdown_allowed_urls' => '', 'site_lockdown_redirect_url' => $current_option['login_page_id'], 'site_lockdown_rss_feed' => '0'), 'upme-email-general-settings' => array('email_from_name' => __('WordPress', 'upme'), 'email_from_address' => upme_get_default_email_address(), 'notifications_all_admins' => '0'), 'upme-custom-fields-settings' => array('help_text_html' => '0'));
     /* UPME Filters for customizing defualt module options */
     $this->default_module_settings = apply_filters('upme_default_module_settings', $this->default_module_settings);
     // End Filter
     $this->colorsdefault = array();
     $this->option_with_checkbox = array('redirect_backend_profile', 'redirect_backend_registration', 'redirect_backend_login', 'link_author_posts_page', 'show_separator_on_profile', 'show_empty_field_on_profile', 'use_cron', 'select_user_role_in_registration', 'lightbox_avatar_cropping', 'show_recent_user_posts', 'disable_fancybox_script_styles', 'html_login_to_view_form', 'html_user_login_message_form', 'html_private_content_form', 'ajax_profile_field_save', 'site_lockdown_status', 'link_post_author_to_upme', 'display_profile_after_post', 'disable_fitvids_script_styles', 'disable_tipsy_script_styles', 'disable_opensans_google_font', 'notifications_all_admins');
     /* UPME Filters for customizing checkbox options */
     $this->option_with_checkbox = apply_filters('upme_option_with_checkbox', $this->option_with_checkbox);
     // End Filter
     $this->options = get_option('upme_options');
     if (!get_option('upme_options')) {
         update_option('upme_options', $this->defaults);
     }
     /* Store icons in array */
     $this->fontawesome = $this->list_font_awesome_icons();
     asort($this->fontawesome);
     // Adding Action hook to show additional profile fields
     add_action('show_user_profile', array($this, 'upme_user_extra_fields'));
     add_action('edit_user_profile', array($this, 'upme_user_extra_fields'));
     //add_action( 'load-profile.php', array($this,'upme_user_extra_fields') );
     // Adding Action hook to save additional profile fields
     add_action('personal_options_update', array($this, 'upme_save_user_extra_fields'), 9999);
     add_action('edit_user_profile_update', array($this, 'upme_save_user_extra_fields'));
     if (is_admin()) {
         add_action('wp_ajax_update_user_cache', array($this, 'upme_update_user_cache'));
         add_action('wp_ajax_save_upme_settings', array($this, 'upme_save_settings'));
         add_action('wp_ajax_reset_upme_settings', array($this, 'upme_reset_settings'));
         add_action('wp_ajax_upme_update_custom_field', array($this, 'upme_ajax_update_custom_field'));
         add_action('wp_ajax_upme_reset_custom_fields', array($this, 'reset_all'));
         add_action('wp_ajax_upme_create_custom_field', array($this, 'upme_ajax_create_custom_field'));
         add_filter('user_profile_update_errors', array($this, 'upme_profile_update_errors'), 10, 3);
         add_action('user_register', array($this, 'upme_register_backend_user'));
     }
     define('PROFILE_HELP', __('Enter a custom meta key for this profile field if do not want to use a predefined meta field above. It is recommended to only use alphanumeric characters and underscores, for example my_custom_meta is a proper meta key.', 'upme'));
     define('SEPARATOR_HELP', __('A Meta Key may be added to your separator in order to reference it with the [upme view=x,x,x] shortcode option. It is recommended to only use alphanumeric characters and underscores, for example my_custom_meta is a proper meta key.', 'upme'));
     add_action('admin_footer', array($this, 'upme_user_action_buttons'));
     add_action('load-users.php', array($this, 'upme_users_page_loaded'));
     add_action('admin_notices', array($this, 'upme_bulk_admin_notices'));
     add_filter('manage_users_columns', array($this, 'upme_manage_user_custom_columns'));
     add_action('manage_users_custom_column', array($this, 'upme_manage_user_custom_column_values'), 10, 3);
     add_filter('manage_users_sortable_columns', array($this, 'upme_users_sortable_columns'));
     add_action('pre_user_query', array($this, 'upme_users_orderby_filters'));
     $custom_file_field_types_params = array();
     $this->custom_file_field_types = apply_filters('upme_custom_file_field_types', array(), $custom_file_field_types_params);
     $this->errors = null;
 }
Пример #2
0
function upme_upgrade_2_0_24()
{
    global $wpdb, $upme_email_templates;
    $current_option = get_option('upme_options');
    $current_option['profile_tabs_display_status'] = 'disabled';
    $current_option['profile_tabs_initial_display_status'] = 'enabled';
    $current_option['email_from_name'] = __('WordPress', 'upme');
    $current_option['email_from_address'] = upme_get_default_email_address();
    $current_option['notifications_all_admins'] = '0';
    $current_option['woocommerce_profile_tab_status'] = '0';
    update_option('upme_options', $current_option);
    $email_templates = get_option('upme_email_templates');
    $email_templates['reg_activation_approval_admin'] = $upme_email_templates->upme_get_template('reg_activation_approval_admin', '1');
    $email_templates['reg_activation_approval_user'] = $upme_email_templates->upme_get_template('reg_activation_approval_user', '1');
    $email_templates['reg_activation_admin'] = $upme_email_templates->upme_get_template('reg_activation_admin', '1');
    $email_templates['reg_activation_user'] = $upme_email_templates->upme_get_template('reg_activation_user', '1');
    $email_templates['reg_approval_admin'] = $upme_email_templates->upme_get_template('reg_approval_admin', '1');
    $email_templates['reg_approval_user'] = $upme_email_templates->upme_get_template('reg_approval_user', '1');
    update_option('upme_email_templates', $email_templates);
}