Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2023-3713: class-profile-magic-admin.php in profilegrid-user-profiles-groups-and-communities/tags/5.4.8/admin – WordPress Plugin Repository

The ProfileGrid plugin for WordPress is vulnerable to unauthorized modification of data due to a missing capability check on the ‘profile_magic_check_smtp_connection’ function in versions up to, and including, 5.5.1. This makes it possible for authenticated attackers, with subscriber-level permissions or above to update the site options arbitrarily. This can be used by attackers to achieve privilege escalation.

CVE
#web#mac#google#js#java#wordpress#php#auth

1<?php2/**3 * The admin-specific functionality of the plugin.4 *5 * @link https://profilegrid.co6 * @since 1.0.07 *8 * @package Profile_Magic9 * @subpackage Profile_Magic/admin10 */1112/**13 * The admin-specific functionality of the plugin.14 *15 * Defines the plugin name, version, and two examples hooks for how to16 * enqueue the admin-specific stylesheet and JavaScript.17 *18 * @package Profile_Magic19 * @subpackage Profile_Magic/admin20 * @author ProfileGrid [email protected]21 */2223class Profile_Magic_Admin {2425 /**26 * The ID of this plugin.27 *28 * @since 1.0.029 * @access private30 * @var string $profile_magic The ID of this plugin.31 */32 private $profile_magic;3334 /**35 * The version of this plugin.36 *37 * @since 1.0.038 * @access private39 * @var string $version The current version of this plugin.40 */41 private $version;4243 /**44 * Initialize the class and set its properties.45 *46 * @since 1.0.047 * @param string $profile_magic The name of this plugin.48 * @param string $version The version of this plugin.49 */50 public function __construct( $profile_magic, $version ) {5152 $this->profile_magic = $profile_magic;53 $this->version = $version;54 $this->pm_theme_path = plugin_dir_path( __FILE__ ) . '…/public/partials/themes/’;55 $theme_path = get_stylesheet_directory();56 $override_template = $theme_path . '/profilegrid-user-profiles-groups-and-communities/themes/’;57 $this->pm_theme_path_in_wptheme = $override_template;5859 }6061 /**62 * Register the stylesheets for the admin area.63 *64 * @since 1.0.065 */66 public function pg_activation_redirect() {67 $dbhandler = new PM_DBhandler();68 if ( $dbhandler->get_global_option_value( 'pg_redirect_to_group_page’, ‘0’ ) == ‘1’ ) {69 wp_safe_redirect( ‘admin.php?page=pm_manage_groups’ );70 exit;71 }72 }7374 public function activate_sitewide_plugins( $blog_id ) {75 // Switch to new website76 $dbhandler = new PM_DBhandler();77 switch_to_blog( $blog_id );78 // Activate79 foreach ( array_keys( get_site_option( ‘active_sitewide_plugins’ ) ) as $plugin ) {80 do_action( ‘activate_’ . $plugin, false );81 do_action( ‘activate’ . '_plugin’, $plugin, false );82 }83 // Restore current website84 restore_current_blog();85 }8687 public function enqueue_styles() {88 /**89 * This function is provided for demonstration purposes only.90 *91 * An instance of this class should be passed to the run() function92 * defined in Profile_Magic_Loader as all of the hooks are defined93 * in that particular class.94 *95 * The Profile_Magic_Loader will then create the relationship96 * between the defined hooks and the functions defined in this97 * class.98 */99 if ( is_user_logged_in() ) :100 global $wp_scripts;101 // tell WordPress to load jQuery UI tabs102 wp_enqueue_script( ‘jquery-ui-tabs’ );103 // get registered script object for jquery-ui104 wp_enqueue_style( ‘wp-color-picker’ );105 $screen = get_current_screen();106 if ( isset( $screen ) && ‘admin_page_pm_profile_fields’ !== $screen->base && ‘admin_page_pm_profile_view’ !== $screen->base ) {107 wp_enqueue_style( 'jquery-ui-smoothness’, plugin_dir_url( __FILE__ ) . 'css/smoothness-jquery-ui.min.css’, array(), $this->version, ‘all’ );108109 }110 wp_enqueue_style( $this->profile_magic, plugin_dir_url( __FILE__ ) . 'css/profile-magic-admin.css’, array(), $this->version, ‘all’ );111 wp_enqueue_style( 'pm-font-awesome’, plugin_dir_url( __FILE__ ) . 'css/font-awesome.css’, array(), $this->version, ‘all’ );112 wp_enqueue_style( ‘thickbox’ );113 wp_register_style( 'pm_googleFonts’, 'https://fonts.googleapis.com/css?family=Titillium+Web:400,600’, array(), $this->version, ‘all’ );114 wp_enqueue_style( ‘pm_googleFonts’ );115 wp_register_style( 'pm_material_icon’, 'https://fonts.googleapis.com/icon?family=Material+Icons’, array(), $this->version, ‘all’ );116 wp_enqueue_style( ‘pm_material_icon’ );117 // endif;118 endif;119 }120121 /**122 * Register the JavaScript for the admin area.123 *124 * @since 1.0.0125 */126 public function enqueue_scripts() {127 $pmrequests = new PM_request();128 /**129 * This function is provided for demonstration purposes only.130 *131 * An instance of this class should be passed to the run() function132 * defined in Profile_Magic_Loader as all of the hooks are defined133 * in that particular class.134 *135 * The Profile_Magic_Loader will then create the relationship136 * between the defined hooks and the functions defined in this137 * class.138 */139 if ( is_user_logged_in() ) :140 $dbhandler = new PM_DBhandler();141 wp_enqueue_script( ‘jquery’ );142 wp_enqueue_script( ‘jquery-ui-core’ );143 wp_enqueue_script( ‘jquery-ui-tabs’ );144 wp_enqueue_Script( ‘jquery-ui-sortable’ );145 wp_enqueue_script( ‘jquery-ui-autocomplete’ );146 wp_enqueue_script( ‘thickbox’ );147 wp_enqueue_script( ‘jquery-ui-dialog’ );148 wp_enqueue_script( ‘media-upload’ );149 wp_enqueue_script( ‘jquery-form’ );150 wp_enqueue_script( ‘jquery-ui-datepicker’ );151152 wp_enqueue_media();153 wp_enqueue_script( $this->profile_magic, plugin_dir_url( __FILE__ ) . 'js/profile-magic-admin.js’, array( ‘jquery’ ), $this->version, false );154 wp_enqueue_script( 'profile-magic-admin-footer’, plugin_dir_url( __FILE__ ) . 'js/profile-magic-admin-footer.js’, array( 'jquery’, ‘wp-color-picker’ ), $this->version, true );155 wp_localize_script(156 $this->profile_magic,157 'pm_ajax_object’,158 array(159 ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ),160 ‘nonce’ => wp_create_nonce( ‘ajax-nonce’ ),161 )162 );163 $error = array();164 $error[‘valid_email’] = __( 'Please enter a valid e-mail address.’, ‘profilegrid-user-profiles-groups-and-communities’ );165 $error[‘valid_number’] = __( 'Please enter a valid number.’, ‘profilegrid-user-profiles-groups-and-communities’ );166 $error[‘valid_date’] = __( 'Please enter a valid date(yyyy-mm-dd format).’, ‘profilegrid-user-profiles-groups-and-communities’ );167 $error[‘required_field’] = __( 'This is a required field.’, ‘profilegrid-user-profiles-groups-and-communities’ );168 $error[‘file_type’] = __( 'This file type is not allowed.’, ‘profilegrid-user-profiles-groups-and-communities’ );169 $error[‘short_password’] = __( 'Your password should be at least 7 characters long.’, ‘profilegrid-user-profiles-groups-and-communities’ );170 $error[‘pass_not_match’] = __( 'Password and confirm password do not match.’, ‘profilegrid-user-profiles-groups-and-communities’ );171 $error[‘user_exist’] = __( 'Sorry, username already exist.’, ‘profilegrid-user-profiles-groups-and-communities’ );172 $error[‘email_exist’] = __( 'Sorry, email already exist.’, ‘profilegrid-user-profiles-groups-and-communities’ );173 $error[‘valid_facebook_url’] = __( 'Please enter a valid facebook url.’, ‘profilegrid-user-profiles-groups-and-communities’ );174 $error[‘valid_twitter_url’] = __( 'Please enter a valid twitter url.’, ‘profilegrid-user-profiles-groups-and-communities’ );175 $error[‘valid_google_url’] = __( 'Please enter a valid google+ url.’, ‘profilegrid-user-profiles-groups-and-communities’ );176 $error[‘valid_linked_in_url’] = __( 'Please enter a valid linkedin url.’, ‘profilegrid-user-profiles-groups-and-communities’ );177 $error[‘valid_youtube_url’] = __( 'Please enter a valid youtube url.’, ‘profilegrid-user-profiles-groups-and-communities’ );178 $error[‘valid_mixcloud_url’] = __( 'Please enter a valid Mixcloud url.’, ‘profilegrid-user-profiles-groups-and-communities’ );179 $error[‘valid_soundcloud_url’] = __( 'Please enter a valid SoundCloud url.’, ‘profilegrid-user-profiles-groups-and-communities’ );180 $error[‘valid_instagram_url’] = __( 'Please enter a valid instagram url.’, ‘profilegrid-user-profiles-groups-and-communities’ );181 $error[‘atleast_one_field’] = __( 'Select at least one field.’, ‘profilegrid-user-profiles-groups-and-communities’ );182 $error[‘seprator_not_empty’] = __( 'Seperator field can not be empty.’, ‘profilegrid-user-profiles-groups-and-communities’ );183 $error[‘choose_image’] = __( 'Choose Image’, ‘profilegrid-user-profiles-groups-and-communities’ );184 $error[‘valid_image’] = __( 'This is not a valid image’, ‘profilegrid-user-profiles-groups-and-communities’ );185 $error[‘valid_group_name’] = __( 'Please enter a valid group name.’, ‘profilegrid-user-profiles-groups-and-communities’ );186 $error[‘group_manager_first’] = __( 'You must define a Group Manager first, before making a Group closed.’, ‘profilegrid-user-profiles-groups-and-communities’ );187 $error[‘delete’] = __( 'Delete’, ‘profilegrid-user-profiles-groups-and-communities’ );188 $error[‘success’] = __( 'Success’, ‘profilegrid-user-profiles-groups-and-communities’ );189 $error[‘failure’] = __( 'Failure’, ‘profilegrid-user-profiles-groups-and-communities’ );190 $error[‘select_group’] = __( 'please select a group’, ‘profilegrid-user-profiles-groups-and-communities’ );191 $error[‘no_user_search’] = __( 'Sorry, no user with this username in this group.’, ‘profilegrid-user-profiles-groups-and-communities’ );192 $error[‘select_field_completeness’] = __( 'Select a Multiple Fields.’, ‘profilegrid-user-profiles-groups-and-communities’ );193 $error[‘completeness_no_fields’] = __( 'Sorry, there are no fields like this here.’, ‘profilegrid-user-profiles-groups-and-communities’ );194195 $error[‘change_group’] = __( 'You are changing the group of this user. All data associated with profile fields of old group will be hidden and the user will have to edit and fill profile fields associated with the new group. Do you wish to continue?’, ‘profilegrid-user-profiles-groups-and-communities’ );196 $error[‘allow_file_ext’] = $dbhandler->get_global_option_value( 'pm_allow_file_types’, ‘jpg|jpeg|png|gif’ );197 wp_localize_script( $this->profile_magic, 'pm_error_object’, $error );198199 $upload_requirements = array();200 $upload_requirements[‘pg_profile_image_max_file_size’] = $dbhandler->get_global_option_value( 'pg_profile_image_max_file_size’, ‘’ );201 $upload_requirements[‘pg_cover_image_max_file_size’] = $dbhandler->get_global_option_value( 'pg_cover_image_max_file_size’, ‘’ );202 $upload_requirements[‘pg_profile_photo_minimum_width’] = $dbhandler->get_global_option_value( 'pg_profile_photo_minimum_width’, ‘DEFAULT’ );203 $upload_requirements[‘pg_cover_photo_minimum_width’] = $dbhandler->get_global_option_value( 'pg_cover_photo_minimum_width’, ‘800’ );204 $upload_requirements[‘pg_image_quality’] = $dbhandler->get_global_option_value( 'pg_image_quality’, ‘90’ );205 if ( ! isset( $upload_requirements[‘pg_cover_photo_minimum_width’] ) || empty( $upload_requirements[‘pg_cover_photo_minimum_width’] ) ) {206 $upload_requirements[‘pg_cover_photo_minimum_width’] = '800’;207 }208 $upload_requirements[‘error_max_profile_filesize’] = sprintf( __( 'Image size exceeds the maximum limit. Maximum allowed image size is %1$d byte.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $upload_requirements[‘pg_profile_image_max_file_size’] );209 $upload_requirements[‘error_min_profile_width’] = sprintf( __( 'Image dimensions are too small. Minimum size is %1$d by %2$d pixels.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $upload_requirements[‘pg_profile_photo_minimum_width’], $upload_requirements[‘pg_profile_photo_minimum_width’] );210 $upload_requirements[‘error_min_cover_width’] = sprintf( __( 'Image dimensions are too small. Minimum size is %1$d by %2$d pixels.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $upload_requirements[‘pg_cover_photo_minimum_width’],300 );211 wp_localize_script( $this->profile_magic, 'pm_upload_object’, $upload_requirements );212 // endif;213 endif;214215 }216217 public function profile_magic_admin_menu_for_extensions() {218 add_submenu_page( 'pm_manage_groups’, 'Extensions’, 'Extensions’, 'manage_options’, 'pm_extensions’, array( $this, ‘pm_extensions’ ) );219 }220221 public function profile_magic_admin_menu() {222 add_menu_page( __( 'ProfileGrid’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'ProfileGrid’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_manage_groups’, array( $this, ‘pm_manage_groups’ ), 'dashicons-groups’, 26 );223 add_submenu_page( '’, __( 'New Group’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'New Group’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_add_group’, array( $this, ‘pm_add_group’ ) );224 add_submenu_page( '’, __( 'Profile Fields’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Profile Fields’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_profile_fields’, array( $this, ‘pm_profile_fields’ ) );225 add_submenu_page( '’, __( 'New Field’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'New Field’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_add_field’, array( $this, ‘pm_add_field’ ) );226 add_submenu_page( '’, __( 'New Section’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'New Section’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_add_section’, array( $this, ‘pm_add_section’ ) );227 add_submenu_page( '’, __( 'Profile Templates’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Profile Templates’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_theme_settings’, array( $this, ‘pm_theme_settings’ ) );228 add_submenu_page( 'pm_manage_groups’, __( 'Members’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Members’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_user_manager’, array( $this, ‘pm_user_manager’ ) );229 add_submenu_page( 'pm_manage_groups’, __( 'Requests’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Requests’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_requests_manager’, array( $this, ‘pm_requests_manager’ ) );230 add_submenu_page( '’, __( 'Profile View’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Profile View’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_profile_view’, array( $this, ‘pm_profile_view’ ) );231 add_submenu_page( '’, __( 'Edit User’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Edit User’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_user_edit’, array( $this, ‘pm_user_edit’ ) );232 add_submenu_page( 'pm_manage_groups’, __( 'Email Templates’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Email Templates’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_email_templates’, array( $this, ‘pm_email_templates’ ) );233 add_submenu_page( '’, __( 'Add Email Template’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Add Email Template’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_add_email_template’, array( $this, ‘pm_add_email_template’ ) );234 add_submenu_page( '’, __( 'Email Preview’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Email Preview’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_email_preview’, array( $this, ‘pm_email_preview’ ) );235 add_submenu_page( '’, __( 'Analytics’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Analytics’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_analytics’, array( $this, ‘pm_analytics’ ) );236 add_submenu_page( '’, __( 'Membership’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Membership’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_membership’, array( $this, ‘pm_membership’ ) );237 add_submenu_page( 'pm_manage_groups’, __( 'Shortcodes’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Shortcodes’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_shortcodes’, array( $this, ‘pm_shortcodes’ ) );238 add_submenu_page( 'pm_manage_groups’, __( 'Global Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Global Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_settings’, array( $this, ‘pm_settings’ ) );239 add_submenu_page( '’, __( 'General Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'General Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_general_settings’, array( $this, ‘pm_general_settings’ ) );240241 add_submenu_page( '’, __( 'Anti Spam Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Anti Spam Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_security_settings’, array( $this, ‘pm_security_settings’ ) );242 add_submenu_page( '’, __( 'User Accounts Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'User Accounts Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_user_settings’, array( $this, ‘pm_user_settings’ ) );243 add_submenu_page( '’, __( 'Email Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Email Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_email_settings’, array( $this, ‘pm_email_settings’ ) );244 add_submenu_page( '’, __( 'Third Party Integrations’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Third Party Integrations’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_third_party_settings’, array( $this, ‘pm_third_party_settings’ ) );245 add_submenu_page( '’, __( 'Payments Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Payments Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_payment_settings’, array( $this, ‘pm_payment_settings’ ) );246 add_submenu_page( '’, __( 'Tools’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Tools’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_tools’, array( $this, ‘pm_tools’ ) );247 add_submenu_page( '’, __( 'Export Users’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Export Users’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_export_users’, array( $this, ‘pm_export_users’ ) );248 add_submenu_page( '’, __( 'Import Users’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Import Users’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_import_users’, array( $this, ‘pm_import_users’ ) );249 add_submenu_page( '’, __( 'Blog Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Blog Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_blog_settings’, array( $this, ‘pm_blog_settings’ ) );250 add_submenu_page( '’, __( 'Message Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Message Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_message_settings’, array( $this, ‘pm_message_settings’ ) );251 add_submenu_page( '’, __( 'Friends Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Friends Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_friend_settings’, array( $this, ‘pm_friend_settings’ ) );252 add_submenu_page( '’, __( 'Upload Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Upload Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_upload_settings’, array( $this, ‘pm_upload_settings’ ) );253 add_submenu_page( '’, __( 'SEO Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'SEO Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_seo_settings’, array( $this, ‘pm_seo_settings’ ) );254 add_submenu_page( '’, __( 'Export Options’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Export Options’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_export_options’, array( $this, ‘pm_export_options’ ) );255 add_submenu_page( '’, __( 'Import Options’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Import Options’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_import_options’, array( $this, ‘pm_import_options’ ) );256 add_submenu_page( '’, __( 'Content Restrictions’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Content Restrictions’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_content_restrictions’, array( $this, ‘pm_content_restrictions’ ) );257 add_submenu_page( '’, __( 'Woocommerce Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Woocommerce Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_woocommerce_extension’, array( $this, ‘pm_woocommerce_extension’ ) );258 add_submenu_page( '’, __( 'Advanced Woocommerce Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Advanced Woocommerce Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_woocommerce_advanced_extension’, array( $this, ‘pm_woocommerce_advanced_extension’ ) );259 add_submenu_page( '’, __( 'RegistrationMagic Integrations’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'RegistrationMagic Integrations’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_rm_integration’, array( $this, ‘pm_rm_integration’ ) );260 add_submenu_page( '’, __( 'Profile Notifications’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Profile Notifications’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_profile_notification_settings’, array( $this, ‘pm_profile_notification_settings’ ) );261 add_submenu_page( '’, __( 'Woocommerce Wishlist Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Woocommerce Wishlist Extension’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_woocommerce_wishlist_extension’, array( $this, ‘pm_woocommerce_wishlist_extension’ ) );262 add_submenu_page( '’, __( 'Profile Tabs Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Profile Tabs Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_profile_tabs_settings’, array( $this, ‘pm_profile_tabs_settings’ ) );263 add_submenu_page( '’, __( 'Private Profile Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Private Profile Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_private_profile_settings’, array( $this, ‘pm_private_profile_settings’ ) );264 add_submenu_page( '’, __( 'Elements Visibility Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Elements Visibility Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_elements_visibility_settings’, array( $this, ‘pm_elements_visibility_settings’ ) );265 add_submenu_page( '’, __( 'Performance Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Performance Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_performance_options’, array( $this, ‘pm_performance_options’ ) );266 add_submenu_page( '’, __( 'Activation Wizard’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'Activation Wizard’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_activation_wizard’, array( $this, ‘pm_activation_wizard’ ) );267 add_submenu_page( '’, __( 'All Users Listing Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), __( 'All Users Listing Settings’, ‘profilegrid-user-profiles-groups-and-communities’ ), 'manage_options’, 'pm_users_listing_settings’, array( $this, ‘pm_users_listing_settings’ ) );268269 }270271 public function pm_offers() {272 include 'partials/pg-offers.php’;273 }274275 public function pm_activation_wizard() {276277 include 'partials/pg-activation-wizard.php’;278279 }280281 public function pg_fetch_offers() {282 $url = 'https://profilegrid.co/pg-offers.json’;283 $html = wp_remote_get( $url );284 $json = json_decode( $html[‘body’] );285 if ( ! empty( $json ) ) {286 foreach ( $json as $offer ) {287 ?>288 <div class="pg-offer">289 <div class="pg-offer-wrap">290 <?php if ( isset( $offer->title ) ) : ?>291 <span class="pg-offer-title"><strong><?php echo wp_kses_post( $offer->title ); ?></strong></span>292 <?php endif; ?>293 <?php if ( isset( $offer->offer ) ) : ?>294 <span class="pg-offer-desc"><?php echo wp_kses_post( $offer->offer ); ?></span>295 <?php endif; ?>296 <?php if ( isset( $offer->code ) ) : ?>297 <span class="pg-offer-code"><strong><?php echo wp_kses_post( $offer->code ); ?></strong></span>298 <?php endif; ?>299 </div>300 <?php if ( isset( $offer->link ) ) : ?>301 <div class="pg-buy-btn"><a href="<?php echo esc_url( $offer->link ); ?>">302 <?php303 if ( isset( $offer->link_title ) && ! empty( $offer->link_title ) ) {304 echo wp_kses_post( $offer->link_title );305306 } else {307 esc_html_e( 'Buy Now’, ‘profilegrid-user-profiles-groups-and-communities’ );308309 }310 ?>311 </a></div>312 <?php endif; ?>313 </div> 314 <?php315 }316 } else {317 ?>318<div class="pg-no-offer"><?php esc_html_e( 'Sorry, no offers available right now.’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></div>319 <?php320 }321322 die;323 }324325 public function pm_performance_options() {326 include 'partials/performance-setting.php’;327 }328329 public function pm_users_listing_settings() {330 include 'partials/pm-users-listing-setting.php’;331 }332333 public function pm_elements_visibility_settings() {334 include 'partials/elements-visibility-setting.php’;335 }336337 public function pm_profile_tabs_settings() {338 include 'partials/profile-tab-setting.php’;339 }340341 public function pm_premium_options() {342 include 'partials/premium-features.php’;343 }344345 public function pm_premium_options_profile_labels() {346 include 'partials/premium-features-profile-labels.php’;347 }348349 public function pm_premium_options_custom_tabs() {350 include 'partials/premium-features-custom-tabs.php’;351 }352353 public function pm_premium_options_custom_product_tabs() {354 include 'partials/premium-features-custom-product-tabs.php’;355 }356357 public function pm_premium_options_mailchimp() {358 include 'partials/premium-features-mailchimp.php’;359 }360361 public function pm_premium_options_mailpoet() {362 include 'partials/premium-features-mailpoet.php’;363 }364365 public function pm_private_profile_settings() {366 include 'partials/private-profile-setting.php’;367 }368369 public function pm_theme_settings() {370 include 'partials/theme-setting.php’;371 }372373 public function pm_woocommerce_wishlist_extension() {374 include 'partials/woocommerce-wishlist-extension.php’;375 }376377378 public function pm_requests_manager() {379 include 'partials/pm-membership-requests.php’;380 }381382 public function pm_message_settings() {383 include 'partials/message-settings.php’;384 }385386 public function pm_profile_notification_settings() {387 include 'partials/profile-notification-settings.php’;388 }389390391 public function pm_rm_integration() {392 if ( class_exists( ‘Profile_Magic’ ) && class_exists( ‘Registration_Magic’ ) ) {393 include 'partials/rmagic_settings.php’;394 } else {395 include 'partials/rmagic_banner_settings.php’;396 }397 }398399 public function pm_woocommerce_extension() {400 include 'partials/woocommerce-extension.php’;401 }402403 public function pm_woocommerce_advanced_extension() {404 include 'partials/woocommerce-advanced-extension.php’;405 }406407 public function pm_content_restrictions() {408 include 'partials/content-restrictions.php’;409 }410411 public function pm_import_options() {412 include 'partials/import-options.php’;413 }414415 public function pm_export_options() {416 include 'partials/export-options.php’;417 }418419 public function pm_seo_settings() {420 include 'partials/seo-settings.php’;421 }422423 public function pm_upload_settings() {424 include 'partials/upload-settings.php’;425 }426427 public function pm_extensions() {428 include 'partials/pm_extensions_new.php’;429 }430431 public function pm_friend_settings() {432 include 'partials/friends-settings.php’;433 }434435 public function pm_tools() {436 include 'partials/pm-tools.php’;437 }438439 public function pm_payment_settings() {440 include 'partials/payment-settings.php’;441 }442443 public function pm_blog_settings() {444 include 'partials/blog-settings.php’;445 }446447 public function pm_export_users() {448 include 'partials/pm-export-users.php’;449 }450451 public function pm_import_users() {452 include 'partials/pm-import-users.php’;453 }454455 public function pm_profile_magic_add_group_option( $gid, $group_options ) {456 include 'partials/profile-magic-group-option.php’;457 }458459 public function pm_profile_magic_premium_group_option( $gid, $group_options ) {460 include 'partials/premium-group-options.php’;461 }462463 public function pm_profile_magic_add_option_setting_page() {464 include 'partials/profile-magic-paypal-admin-display.php’;465 }466467 public function pm_add_email_template() {468 include 'partials/email-template.php’;469 $this->pg_get_footer_banner();470 }471472 public function pm_shortcodes() {473 include 'partials/shortcode.php’;474 $this->pg_get_footer_banner();475 }476 public function pm_email_templates() {477 include 'partials/email-templates-list.php’;478 $this->pg_get_footer_banner();479 }480481 public function pm_email_preview() {482 include 'partials/email-preview.php’;483 }484485 public function pm_template_preview_button() {486 echo '<a href="admin.php?page=pm_email_preview&TB_iframe=false&width=600&height=550inlineId=wpbody" class="thickbox" onClick="return preview()“>Preview</a>’;487488 }489490 public function pm_manage_groups() {491 include 'partials/manage-groups.php’;492 }493494 public function pm_add_group() {495 include 'partials/add-group-tabview.php’;496 }497498 public function pm_add_field() {499 include 'partials/add-field.php’;500 }501502 public function pm_add_section() {503 include 'partials/add-section.php’;504 }505506 public function pm_profile_fields() {507 include 'partials/manage-fields.php’;508 }509510 public function pm_user_manager() {511 include 'partials/user-manager.php’;512 $this->pg_get_footer_banner();513 }514515 public function pm_profile_view() {516 include 'partials/user-profile.php’;517 }518519 public function pm_third_party_settings() {520 include 'partials/thirdparty-settings.php’;521 }522523 public function pm_email_settings() {524 include 'partials/email-settings.php’;525 }526527 public function pm_user_settings() {528 include 'partials/user-settings.php’;529 }530531 public function pm_general_settings() {532 include 'partials/general-settings.php’;533534 }535536 public function pm_security_settings() {537 include 'partials/security-settings.php’;538 }539540 public function pm_settings() {541 include 'partials/global-settings.php’;542 $this->pg_get_footer_banner();543 }544545546547548 public function profile_magic_set_field_order() {549 include 'partials/set-fields-order.php’;550 die;551 }552553 public function profile_magic_set_group_order() {554 include 'partials/set-groups-order.php’;555 die;556 }557558 public function profile_magic_set_group_items() {559 include 'partials/set-groups-order.php’;560 die;561 }562563 public function profile_magic_set_section_order() {564 $dbhandler = new PM_DBhandler();565 $textdomain = $this->profile_magic;566 $path = plugin_dir_url( __FILE__ );567 $identifier = 'SECTION’;568 $list_order = filter_input( INPUT_POST, ‘list_order’ );569 if ( isset( $list_order ) ) {570 $list = explode( ',’, $list_order );571 $i = 1;572 foreach ( $list as $id ) {573 $dbhandler->update_row( $identifier, 'id’, $id, array( ‘ordering’ => $i ), array( ‘%d’ ), ‘%d’ );574575 $i++;576 }577 }578 die;579 }580581 public function profile_magic_section_dropdown() {582 $gid = filter_input( INPUT_POST, ‘gid’ );583 $dbhandler = new PM_DBhandler();584 $sections = $dbhandler->get_all_result( 'SECTION’, array( 'id’, ‘section_name’ ), array( ‘gid’ => $gid ) );585 foreach ( $sections as $section ) {586 ?>587 <option value="<?php echo esc_attr( $section->id ); ?>” 588 <?php589 if ( ! empty( $row ) ) {590 selected( $row->associate_section, $section->id );}591 ?>592 ><?php echo esc_html( $section->section_name ); ?></option>593 <?php594 }595 die;596 }597598599 public function profile_magic_check_smtp_connection() {600601 if ( ! isset( $_POST[‘nonce’] ) || ! wp_verify_nonce( sanitize_key( $_POST[‘nonce’] ), ‘ajax-nonce’ ) ) {602 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );603 }604 $dbhandler = new PM_DBhandler();605 $pmrequests = new PM_request();606 $identifier = 'SETTINGS’;607 $exclude = array( '_wpnonce’, '_wp_http_referer’, ‘submit_settings’ );608 $post = $pmrequests->sanitize_request( $_POST, $identifier, $exclude );609 if ( $post != false ) {610 if ( isset( $post[‘pm_smtp_password’] ) && $post[‘pm_smtp_password’] != ‘’ ) {611 $post[‘pm_smtp_password’] = $post[‘pm_smtp_password’];612 } else {613 unset( $post[‘pm_smtp_password’] );614 }615 foreach ( $post as $key => $value ) {616 $dbhandler->update_global_option_value( $key, $value );617 }618 }619 $dbhandler->update_global_option_value( 'pm_enable_smtp’, 1 );620 $to = $dbhandler->get_global_option_value( ‘pm_smtp_test_email_address’ );621 $from_email_address = $pmrequests->profile_magic_get_from_email();622 $headers = “MIME-Version: 1.0\r\n";623 $headers .= “Content-type:text/html;charset=UTF-8\r\n";624 $headers .= ‘From:’ . $from_email_address . “\r\n";625 echo esc_html( wp_mail( $to, 'Test SMTP Connection’, 'Test’, $headers ) );626 die;627628 }629630631632 public function pm_fields_list_for_email() {633 $dbhandler = new PM_DBhandler();634 $exclude = “and field_type not in(‘file’,’user_avatar’,’heading’,’paragraph’,’confirm_pass’,’user_pass’,’divider’,’spacing’,’birth_date’,’user_email’)“;635 $groups = $dbhandler->get_all_result( ‘GROUPS’ );636 echo '<select name="pm_field_list” class="pm_field_list” onchange="pm_insert_field_in_email(this.value)“>’;637 echo ‘<option>’ . esc_html__( 'Select A Field’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;638 echo ‘<optgroup label="’ . esc_attr__( 'Comman Fields’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '” >’;639 echo ‘<option value="{{user_login}}">’ . esc_html__( 'User Name’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;640 echo ‘<option value="{{user_pass}}">’ . esc_html__( 'User Password’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;641 echo ‘<option value="{{display_name}}">’ . esc_html__( 'Display Name’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;642 echo ‘<option value="{{user_email}}">’ . esc_html__( 'Email’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;643 echo '</optgroup>’;644 if ( isset( $groups ) ) :645 foreach ( $groups as $group ) {646 $fields = $dbhandler->get_all_result( 'FIELDS’, '*’, array( ‘associate_group’ => $group->id ), 'results’, 0, false, 'ordering’, false, $exclude );647 if ( isset( $fields ) ) :648 echo ‘<optgroup label="’ . esc_attr( $group->group_name ) . '” >’;649 650 foreach ( $fields as $field ) {651 echo ‘<option value="{{’ . esc_attr( $field->field_key ) . ‘}}">’ . esc_html( $field->field_name ) . '</option>’;652 }653 654655 echo '</optgroup>’;656 endif;657 }658 echo ‘<optgroup label="’ . esc_html__( 'Other Fields’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '” >’;659 echo ‘<option value="{{post_name}}">’ . esc_html__( 'Post Name’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;660 echo ‘<option value="{{edit_post_link}}">’ . esc_html__( 'Review Post Link’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;661 echo ‘<option value="{{post_link}}">’ . esc_html__( 'Post Link’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;662 echo ‘<option value="{{group_name}}">’ . esc_html__( 'User Group Name’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</option>’;663 echo '</optgroup>’;664 echo '</select>’;665 endif;666667 }668669 public function profile_magic_show_user_fields( $user ) {670 $dbhandler = new PM_DBhandler();671 $pg_profile_image_max_file_size = $dbhandler->get_global_option_value( 'pg_profile_image_max_file_size’, ‘’ );672 $pg_cover_image_max_file_size = $dbhandler->get_global_option_value( 'pg_cover_image_max_file_size’, ‘’ );673 $pg_profile_photo_minimum_width = $dbhandler->get_global_option_value( 'pg_profile_photo_minimum_width’, ‘DEFAULT’ );674 $pg_cover_photo_minimum_width = $dbhandler->get_global_option_value( 'pg_cover_photo_minimum_width’, ‘DEFAULT’ );675676 if ( $pg_profile_photo_minimum_width == ‘DEFAULT’ ) {677 $pg_profile_photo_minimum_width = 150;678 }679 if ( $pg_cover_photo_minimum_width == ‘DEFAULT’ ) {680 $pg_cover_photo_minimum_width = 800;681 }682 if ( $pg_profile_image_max_file_size == ‘’ ) {683 $message = sprintf( __( 'File Restrictions: Please make sure your image size fits within %1$d by %2$d pixels.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $pg_profile_photo_minimum_width, $pg_profile_photo_minimum_width );684 } else {685 $message = sprintf( __( 'File Restrictions: Please make sure your image size fits within %1$d by %2$d pixels and does not exceeds total size of %3$d bytes.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $pg_profile_photo_minimum_width, $pg_profile_photo_minimum_width, $pg_profile_image_max_file_size );686 }687688 if ( $pg_cover_image_max_file_size == ‘’ ) {689 $message2 = sprintf( __( 'File Restrictions: Please make sure your image size fits within %1$d by %2$d pixels.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $pg_cover_photo_minimum_width, 300 );690 } else {691 $message2 = sprintf( __( 'File Restrictions: Please make sure your image size fits within %1$d by %2$d pixels and does not exceeds total size of %3$d bytes.’, ‘profilegrid-user-profiles-groups-and-communities’ ), $pg_cover_photo_minimum_width, 300, $pg_cover_image_max_file_size );692 }693694 $pm_customfields = new PM_Custom_Fields();695 $pmrequests = new PM_request();696 if ( is_object( $user ) ) {697 $uid = $user->ID;698 $gids = $pmrequests->profile_magic_get_user_field_value( $user->ID, ‘pm_group’ );699 $gid = $pmrequests->pg_filter_users_group_ids( $gids );700 } else {701 $gid = array();702 $uid = 0;703 }704705 if ( ! empty( $gid ) ) :706 if ( current_user_can( ‘manage_options’ ) ) {707 $exclude = 'associate_group in(' . implode( ',’, $gid ) . ") and field_type not in(‘first_name’,’last_name’,’user_name’,’user_email’,’user_url’,’user_pass’,’confirm_pass’,’description’,’user_avatar’,’heading’,’paragraph’)“;708 } else {709 $exclude = 'associate_group in(' . implode( ',’, $gid ) . ") and field_type not in(‘first_name’,’last_name’,’user_name’,’user_email’,’user_url’,’user_pass’,’confirm_pass’,’description’,’user_avatar’,’heading’,’paragraph’,’read_only’)“;710 }711712 $fields = $dbhandler->get_all_result( 'FIELDS’, '*’, 1, 'results’, 0, false, 'ordering’, false, $exclude );713 endif;714 $col = $dbhandler->get_global_option_value( 'pm_reg_form_cols’, 1 );715716 $profile_pic = ( is_object( $user ) ) ? get_user_meta( $uid, 'pm_user_avatar’, true ) : false;717 $groups = $dbhandler->get_all_result( 'GROUPS’, array( 'id’, ‘group_name’ ) );718 $pm_profile_privacy = $pmrequests->profile_magic_get_user_field_value( $uid, ‘pm_profile_privacy’ );719 $pm_hide_my_profile = $pmrequests->profile_magic_get_user_field_value( $uid, ‘pm_hide_my_profile’ );720 if ( empty( $pm_hide_my_profile ) ) {721 $pm_hide_my_profile = '0’;722 }723 $cover_image = $pmrequests->profile_magic_get_user_field_value( $uid, ‘pm_cover_image’ );724 ?>725 <table class="form-table"> 726 <tbody>727 <tr>728 729 <th class="pm-field-lable">730 <label for="pm_field_37"><?php esc_html_e( 'Profile Picture’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>731 </th>732 <td class="pm-field-input"> 733 <input id="pm_user_avatar” type="hidden” name="pm_user_avatar” class="icon_id" value="<?php734 if ( isset( $profile_pic ) ) {735 echo esc_attr( $profile_pic );}736 ?>" />737 <input id="field_icon_button" name="field_icon_button" class="button group_icon_button" type="button" value="<?php esc_attr_e( 'Upload Image’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>" />738 <span class="pg_profile_image_container" style="739 <?php740 if ( ! is_object( $user ) || $profile_pic == false ) {741 echo 'display: none;’;}742 ?>743 “>744 <?php745 echo get_avatar(746 $user->user_email,747 100,748 '’,749 false,750 array(751 ‘class’ => 'pm-user user-profile-image’,752 ‘id’ => 'pg_upload_image_preview’,753 ‘force_display’ => true,754 )755 );756 ?>757 <input type="button” name="pg_remove_image" id="pg_remove_image" class="button" value="<?php esc_attr_e( 'Remove’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>" onclick="pg_remove_profile_image()“/>758 </span>759 <p class="description"><?php echo wp_kses_post( $message ); ?></p>760 <div class="errortext” style="display:none;"></div>761 </td> 762 </tr>763 764 <tr>765 766 <th class="pm-field-lable">767 <label for="pm_field_37"><?php esc_html_e( 'Cover Image’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>768 </th>769 <td class="pm-field-input"> 770 <input id="pm_cover_image" type="hidden" name="pm_cover_image" class="cover_icon_id" value="<?php771 if ( isset( $cover_image ) ) {772 echo esc_attr( $cover_image );}773 ?>" />774 <input id="cover_image_button" name="cover_image_button" class="button cover_image_button" type="button" value="<?php esc_attr_e( 'Upload Image’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>" />775 <span class="pg_cover_image_container" style="776 <?php777 if ( ! is_object( $user ) || $cover_image == false ) {778 echo 'display: none;’;}779 ?>780 “>781 <?php782 $src = wp_get_attachment_image_src( $cover_image, array( 100, 100 ) );783784 ?>785 <img src="786 <?php787 if ( isset( $src[‘0’] ) ) {788 echo esc_url( $src[‘0’] );}789 ?>790 " width="100” height="100" class="pm-user" id="pg_upload_cover_image_preview" />791 <input type="button" name="pg_remove_cover_image" id="pg_remove_cover_image" class="button" value="<?php esc_attr_e( 'Remove’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>" onclick="pm_remove_cover_image()“/>792 </span>793 <p class="description"><?php echo wp_kses_post( $message2 ); ?></p>794 <div class="errortext” style="display:none;"></div>795 </td> 796 </tr>797 <?php798 $pm_show_privacy_settings = $dbhandler->get_global_option_value( 'pm_show_privacy_settings’, ‘’ );799 if ( $pm_show_privacy_settings == 1 ) {800 ?>801 <tr>802 <th class="pm-field-lable">803 <label for="pm_profile_privacy"><?php esc_html_e( 'Profile Privacy’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>804 </th>805 <td class="pm-field-input"> 806 <select name="pm_profile_privacy" id="pm_profile_privacy">807 <option value="1" <?php selected( $pm_profile_privacy, ‘1’ ); ?>><?php esc_html_e( 'Everyone’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></option>808 <option value="2" <?php selected( $pm_profile_privacy, ‘2’ ); ?>><?php esc_html_e( 'Friends’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></option>809 <option value="3" <?php selected( $pm_profile_privacy, ‘3’ ); ?>><?php esc_html_e( 'Group Members’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></option>810 <option value="4" <?php selected( $pm_profile_privacy, ‘4’ ); ?>><?php esc_html_e( 'Friends & Group Members’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></option>811 <option value="5" <?php selected( $pm_profile_privacy, ‘5’ ); ?>><?php esc_html_e( 'Only Me’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></option>812 </select>813 </td> 814 </tr>815 <?php } ?>816 817 <?php818 $allowhiddenusers = $dbhandler->get_global_option_value( 'pm_allow_user_to_hide_their_profile’, ‘’ );819 if ( $allowhiddenusers == 1 ) {820 ?>821 <tr>822 <th class="pm-field-lable">823 <label for="pm_hide_my_profile"><?php esc_html_e( 'Hide My Profile From Groups, Directories and Search Results’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>824 </th>825 <td class="pm-field-input"> 826 <div class="pmradio">827 <div class="pm-radio-option">828 <input type="radio" class="pg-hide-privacy-profile" name="pm_hide_my_profile" value="0" <?php checked( $pm_hide_my_profile, ‘0’ ); ?>> 829 <label class="pg-hide-my-profile"><?php esc_html_e( 'No’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>830 </div>831 <div class="pm-radio-option">832 <input type="radio" class="pg-hide-privacy-profile" name="pm_hide_my_profile" value="1" <?php checked( $pm_hide_my_profile, ‘1’ ); ?> > 833 <label class="pg-hide-my-profile"><?php esc_html_e( 'Yes’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?> </label>834 </div>835836 </div>837 </td> 838 </tr>839 840 <?php } ?>841 842 </tbody>843 </table>844 <?php if ( current_user_can( ‘manage_options’ ) ) : ?>845 <table class="form-table"> 846 <tr>847848 <th class="pm-field-lable">849 <label for="pm_field_37"><?php esc_html_e( 'User Group(s)', ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>850 </th>851 <td class="pm-field-input"> 852 <select multiple name="pm_group[]" id="pm_group">853 <?php854 foreach ( $groups as $group ) {855 ?>856 <option value="<?php echo esc_attr( $group->id ); ?>" 857 <?php858 if ( ! empty( $gid ) ) {859 if ( in_array( $group->id, $gid ) ) {860 echo 'selected’;}861 }862 ?>863 ><?php echo esc_html( $group->group_name ); ?></option>864 <?php } ?>865 </select>866 <p class="description"><?php esc_html_e( 'Press ctrl or ⌘ (in Mac) while clicking to assign multiple ProfileGrid Groups’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></p>867 <div class="errortext" style="display:none;"></div>868 </td>869 </tr>870 </table>871 872 <?php873 endif;874 if ( isset( $fields ) && ! empty( $fields ) ) :875 if ( $lastRec = count( $fields ) && ! empty( $gid ) ) {876 echo '<div class="pm_dashboard_custom_fields">’;877 $i = 0;878 foreach ( $fields as $field ) {879 $value = $pmrequests->profile_magic_get_user_field_value( $user->ID, $field->field_key );880 $pm_customfields->pm_get_custom_form_fields( $field, $value, $this->profile_magic );881 $i++;882 }883 echo '</div>’;884 }885 endif;886 if ( is_object( $user ) ) {887 echo ‘<input type="hidden" id="pg_user_id" name="pg_user_id" value="’ . esc_attr( $user->ID ) . '" />’;888 }889 wp_nonce_field( 'pg_user_profile’, ‘pg_user_profile_nonce’ );890 echo '<div class="all_errors" style="display:none;"></div>’;891892 }893894 public function profile_magic_update_user_fields( $user_id ) {895 $pm_sanitizer = new PM_sanitizer();896 $nonce = filter_input( INPUT_POST, ‘pg_user_profile_nonce’ );897 if ( isset( $nonce ) && wp_verify_nonce( $nonce, ‘pg_user_profile’ ) ) {898899 $post = $pm_sanitizer->sanitize( $_POST );900 $dbhandler = new PM_DBhandler();901 $pmrequests = new PM_request();902 $pm_emails = new PM_Emails();903 $notification = new Profile_Magic_Notification();904 $current_user = wp_get_current_user();905 if ( ! current_user_can( 'edit_user’, $user_id ) ) {906 return false;907 }908 if ( ! isset( $post[‘reg_form_submit’] ) ) {909 if ( isset( $post[‘pm_user_avatar’] ) ) {910 $pm_user_avatar = $post[‘pm_user_avatar’];911 } else {912 $pm_user_avatar = '’;913 }914 $is_update_profile_image = update_user_meta( $user_id, 'pm_user_avatar’, $pm_user_avatar );915 if ( $is_update_profile_image ) {916 if ( $pm_user_avatar == ‘’ ) {917 do_action( 'pm_remove_profile_image’, $user_id );918 } else {919 do_action( 'pm_update_profile_image’, $user_id );920 }921 }922 if ( isset( $post[‘pm_cover_image’] ) ) {923 $pm_cover_image = $post[‘pm_cover_image’];924 } else {925 $pm_cover_image = '’;926 }927 $is_update_cover_image = update_user_meta( $user_id, 'pm_cover_image’, $pm_cover_image );928929 if ( $is_update_cover_image ) {930 if ( $pm_cover_image == ‘’ ) {931 do_action( 'pm_remove_cover_image’, $user_id );932 } else {933 do_action( 'pm_update_cover_image’, $user_id );934 }935 }936937 $allowhiddenusers = $dbhandler->get_global_option_value( 'pm_allow_user_to_hide_their_profile’, ‘’ );938 if ( $allowhiddenusers == 1 ) {939 update_user_meta( $user_id, 'pm_hide_my_profile’, $post[‘pm_hide_my_profile’] );940 }941942 $pm_show_privacy_settings = $dbhandler->get_global_option_value( 'pm_show_privacy_settings’, ‘’ );943 if ( $pm_show_privacy_settings == 1 ) {944 update_user_meta( $user_id, 'pm_profile_privacy’, $post[‘pm_profile_privacy’] );945 }946 $gids = $pmrequests->profile_magic_get_user_field_value( $user_id, ‘pm_group’ );947 $gid = $pmrequests->pg_filter_users_group_ids( $gids );948 if ( ! empty( $gid ) ) {949 $exclude = 'associate_group in(' . implode( ‘,’, $gid ) . ") and field_type not in(‘first_name’,’last_name’,’user_name’,’user_email’,’user_url’,’user_pass’,’confirm_pass’,’description’,’user_avatar’,’heading’,’paragraph’)“;950 $fields = $dbhandler->get_all_result( 'FIELDS’, '*’, 1, 'results’, 0, false, 'ordering’, false, $exclude );951 } else {952 $fields = array();953 }954 $pmrequests->pm_update_user_custom_fields_data( $_POST, $_FILES, $_SERVER, $gid, $fields, $user_id );955 if ( isset( $post[‘pm_group’] ) ) {956 $pm_group = $post[‘pm_group’];957 }958 if ( ! isset( $pm_group ) ) {959 $pm_group = array();960 }961962 add_user_meta( $user_id, 'rm_user_status’, 0, true );963964 if ( current_user_can( ‘manage_options’ ) ) {965 update_user_meta( $user_id, 'pm_group’, $pm_group );966 $new_groups = array_diff( $pm_group, $gid );967 $old_groups = array_diff( $gid, $pm_group );968969 foreach ( $old_groups as $o_id ) {970 $notification->pm_removed_old_group_notification( $user_id, $o_id );971 if ( $current_user->ID != $user_id ) {972 $pm_emails->pm_send_group_based_notification( $o_id, $user_id, ‘on_membership_terminate’ );973 }974 }975976 foreach ( $new_groups as $n_gid ) {977 $notification->pm_joined_new_group_notification( $user_id, $n_gid );978 do_action( 'profile_magic_join_group_additional_process’, $n_gid, $user_id );979 }980 }981 }982 }983 elseif ( ! isset( $post[‘reg_form_submit’] ) )984 {985 update_user_meta( $user_id, 'rm_user_status’, ‘0’ );986 }987 }988989 public function profile_magic_activate_user_by_email() {990 $pmemails = new PM_Emails();991 $req = filter_input( INPUT_GET, 'user’, FILTER_SANITIZE_STRING );992 $pmrequests = new PM_request();993 $req_deco = $pmrequests->pm_encrypt_decrypt_pass( 'decrypt’, $req );994 $user_data = json_decode( $req_deco );995 $redirect_url = $pmrequests->profile_magic_get_frontend_url( 'pm_user_login_page’, site_url( ‘/wp-login.php’ ) );996 $nonce_name = ‘user_activation_link_’ . $user_data->user_id;997 $nonce = filter_input( INPUT_GET, ‘_wpnonce’ );998999 if ( wp_verify_nonce( $nonce, $nonce_name ) && $user_data->activation_code === get_user_meta( $user_data->user_id, 'pm_activation_code’, true ) ) {1000 $gids = get_user_meta( $user_data->user_id, 'pm_group’, true );1001 $gid = $pmrequests->pg_filter_users_group_ids( $gids );1002 $primary_group = $pmrequests->pg_get_primary_group_id( $gid );1003 if ( ! empty( $gid ) ) {1004 $pmemails->pm_send_group_based_notification( $primary_group, $user_data->user_id, ‘on_user_activate’ );1005 }1006 update_user_meta( $user_data->user_id, 'rm_user_status’, 0 );1007 if ( ! delete_user_meta( $user_data->user_id, ‘pm_activation_code’ ) ) {1008 $redirect_url = add_query_arg( 'errors’, 'ajx_failed_del’, $redirect_url );1009 } else {1010 $message = __( 'You have successfully activated the user.’, ‘profilegrid-user-profiles-groups-and-communities’ );1011 $redirect_url = add_query_arg( 'activated’, 'success’, $redirect_url );1012 }1013 } else {1014 $message = __( 'Failed to upadte user information.Can not activate user’, ‘profilegrid-user-profiles-groups-and-communities’ );1015 $redirect_url = add_query_arg( 'errors’, 'invalid_code’, $redirect_url );1016 }1017 wp_safe_redirect( esc_url_raw( $redirect_url ) );1018 exit;1019 die;1020 }10211022 public function pm_load_export_fields_dropdown() {1023 include 'partials/export-fields.php’;1024 die;1025 }10261027 public function pm_upload_csv() {10281029 include 'partials/pm-import-ajax.php’;1030 die;1031 }10321033 public function pg_custom_upload_mimes( $mimes = array() ) {1034 $mimes[‘json’] = 'text/plain’;1035 return $mimes;1036 }1037 public function pm_upload_json() {1038 $retrieved_nonce = filter_input( INPUT_POST, ‘_wpnonce’ );1039 if ( ! wp_verify_nonce( $retrieved_nonce, ‘pm_import_options’ ) ) {1040 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1041 }10421043 $dbhandler = new PM_DBhandler();1044 $pmrequests = new PM_request();1045 $current_user = wp_get_current_user();1046 $pmexportimport = new PM_Export_Import();1047 $post = isset( $_POST ) ? $_POST : array();10481049 $allowed_ext = 'json’;1050 if ( isset( $_FILES[‘uploadjson’] ) && ! empty( $_FILES[‘uploadjson’] ) ) {1051 $filefield = $_FILES[‘uploadjson’];1052 $attachment_id = $pmrequests->make_upload_and_get_attached_id( $filefield, $allowed_ext );1053 if ( ! is_numeric( $attachment_id ) ) {1054 add_filter( 'upload_mimes’, array( $this, ‘pg_custom_upload_mimes’ ) );1055 $attachment_id = $pmrequests->make_upload_and_get_attached_id( $filefield, $allowed_ext );1056 }1057 if ( is_numeric( $attachment_id ) ) {1058 $filepath = wp_get_attachment_url( $attachment_id );1059 $content = wp_remote_get( $filepath );1060 $filecontent = $content[‘body’];1061 $options_data = json_decode( $filecontent );1062 foreach ( $options_data as $data ) {1063 if ( is_object( $data ) ) {1064 $dbhandler->update_global_option_value( $data->option_name, $data->option_value );1065 } elseif ( is_array( $data ) ) {1066 $dbhandler->update_global_option_value( $data[0], $data[1] );1067 }1068 }1069 echo ‘<div class="uimrow">’ . esc_html__( 'Your configuration file was successfully imported and included settings have been applied.’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>’;10701071 } else {1072 echo '<div class="uimrow” style="color:red;">’ . esc_html( $attachment_id ) . '</div>’;1073 }1074 } else {1075 echo ‘<div class="uimrow" style="color:red;">’ . esc_html__( 'Select a JSON file earlier exported from ProfileGrid.’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>’;1076 }10771078 die;1079 }10801081 public function profile_grid_myme_types( $mime_types ) {1082 $mime_types[‘csv’] = 'text/csv’;1083 $mime_types[‘json’] = 'application/json’;1084 return $mime_types;1085 }10861087 public function profile_magic_show_feedback_form() {1088 $currentScreen = get_current_screen();1089 if ( $currentScreen->id == ‘plugins’ ) {1090 $path = plugin_dir_url( __FILE__ );1091 ?>1092 <div class="pmagic uimagic">1093 <div id="pg-deactivate-feedback-dialog-wrapper" class="pg-modal-view" style="display: none">1094 <div class="pg-modal-overlay" style="display: none"></div>10951096 <div class="pg-modal-wrap pg-deactivate-feedback"> 1097 <div class="pg-modal-titlebar">1098 <div class="pg-modal-title"><?php esc_html_e( 'ProfileGrid Feedback’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?> </div>1099 <div class="pg-modal-close">×</div>1100 </div>11011102 <form id="pg-deactivate-feedback-dialog-form" method="post">1103 <input type="hidden" name="action" value="pg_deactivate_feedback" />1104 <div class="pg-modal-container">1105 <div class="uimrow">1106 <div id="pg-deactivate-feedback-dialog-form-caption"><?php esc_html_e( 'If you have a moment, please share why you are deactivating ProfileGrid:’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></div>1107 <div id="pg-deactivate-feedback-dialog-form-body">1108 <div class="pg-deactivate-feedback-dialog-input-wrapper">1109 <input id="pg-deactivate-feedback-feature_not_available" class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="feature_not_available">1110 <label for="pg-deactivate-feedback-feature_not_available" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😞</span><?php esc_html_e( “Doesn’t have the feature I need", ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1111 <div class="pginput” id="pg_reason_feature_not_available" style="display:none"><input class="pg-feedback-text" type="text" name="pg_reason_feature_not_available" placeholder="<?php esc_attr_e( 'Please let us know the missing feature…’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"></div>1112 </div>1113 <div class="pg-deactivate-feedback-dialog-input-wrapper">1114 <input id="pg-deactivate-feedback-feature_not_working" class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="feature_not_working" >1115 <label for="pg-deactivate-feedback-feature_not_working" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😕</span><?php esc_html_e( “One of the features didn’t worked", ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1116 <div class="pginput” id="pg_reason_feature_not_working" style="display:none"><input class="pg-feedback-text" type="text" name="pg_reason_feature_not_working" placeholder="<?php esc_attr_e( “Please let us know the feature, like 'emails notifications’", ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"></div>1117 </div>1118 <div class="pg-deactivate-feedback-dialog-input-wrapper">1119 <input id="pg-deactivate-feedback-found_a_better_plugin” class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="found_a_better_plugin" >1120 <label for="pg-deactivate-feedback-found_a_better_plugin" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😊</span><?php esc_html_e( 'Moved to a different plugin’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1121 <div class="pginput" id="pg_reason_found_a_better_plugin" style="display:none"><input class="pg-feedback-text" type="text" name="pg_reason_found_a_better_plugin" placeholder="<?php esc_attr_e( “Could you please share the plugin’s name", ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"></div>1122 </div>1123 <div class="pg-deactivate-feedback-dialog-input-wrapper">1124 <input id="pg-deactivate-feedback-plugin_broke_site” class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="plugin_broke_site">1125 <label for="pg-deactivate-feedback-plugin_broke_site" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😡</span><?php esc_html_e( 'The plugin broke my site’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1126 </div>1127 <div class="pg-deactivate-feedback-dialog-input-wrapper">1128 <input id="pg-deactivate-feedback-plugin_stopped_working" class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="plugin_stopped_working">1129 <label for="pg-deactivate-feedback-plugin_stopped_working" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😠</span><?php esc_html_e( 'The plugin suddenly stopped working’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1130 </div>1131 <div class="pg-deactivate-feedback-dialog-input-wrapper">1132 <input id="pg-deactivate-feedback-temporary_deactivation" class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="temporary_deactivation">1133 <label for="pg-deactivate-feedback-temporary_deactivation" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😊</span><?php esc_html_e( “It’s a temporary deactivation", ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1134 </div>11351136 <div class="pg-deactivate-feedback-dialog-input-wrapper">1137 <input id="pg-deactivate-feedback-other” class="pg-deactivate-feedback-dialog-input" type="radio" name="pg_feedback_key" value="other">1138 <label for="pg-deactivate-feedback-other" class="pg-deactivate-feedback-dialog-label"><span class="pg-feedback-emoji">😐</span><?php esc_html_e( 'Other’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></label>1139 <div class="pginput" id="pg_reason_other" style="display:none"><input class="pg-feedback-text" type="text" name="pg_reason_other" placeholder="<?php esc_attr_e( 'Please share the reason’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"></div>1140 </div>1141 </div>11421143 </div>1144 </div>11451146 <div class="pg-ajax-loader" style="display:none">1147 <i class="fa fa-spinner fa-pulse fa-3x fa-fw"></i>1148 <span class=""><?php esc_html_e( 'Loading…’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></span>1149 </div>11501151 <div class="pg-modal-footer uimrow">1152 <input type="button" id="pg-feedback-btn" value="<?php esc_attr_e( 'Submit & Deactivate’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"/>1153 <input type="button" id="pg-feedback-cancel-btn" value="<?php esc_attr_e( 'Cancel’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?>"/>1154 </div>1155 <?php wp_nonce_field( ‘pm_feedback_form’ ); ?>11561157 </form>1158 </div>115911601161 </div>1162 </div>1163 <?php1164 }1165 }11661167 public function pg_post_feedback() {1168 $retrieved_nonce = filter_input( INPUT_POST, ‘_wpnonce’ );1169 $msg = filter_input( INPUT_POST, ‘msg’ );1170 $feedback = filter_input( INPUT_POST, ‘feedback’ );1171 if ( ! wp_verify_nonce( $retrieved_nonce, ‘pm_feedback_form’ ) ) {1172 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1173 }11741175 if ( isset( $msg ) ) {1176 $msg = sanitize_text_field( $msg );1177 } else {1178 $msg = '’;1179 }1180 if ( isset( $feedback ) ) {1181 $feedback = sanitize_text_field( $feedback );1182 } else {1183 $feedback = '’;1184 }1185 $message = '’;1186 $pmrequests = new PM_request();1187 $from_email_address = $pmrequests->profile_magic_get_from_email();1188 switch ( $feedback ) {1189 case 'feature_not_available’:1190 $body = 'Feature not available: ';1191 break;1192 case 'feature_not_working’:1193 $body = 'Feature not working: ';1194 break;1195 case 'found_a_better_plugin’:1196 $body = 'Found a better plugin: ';1197 break;1198 case 'plugin_broke_site’:1199 $body = 'Plugin broke my site.’;1200 break;1201 case 'plugin_stopped_working’:1202 $body = 'Plugin stopped working’;1203 break;1204 case ‘temporary_deactivation’:1205 $body = “It’s a temporary deactivation";1206 break;1207 case 'upgrade’:1208 $body = 'Upgrading to premium ';1209 break;1210 case 'other’:1211 $body = 'Other: ‘;1212 break;1213 default:1214 return;1215 }1216 if ( ! empty( $feedback ) ) {1217 $message .= $body . "\n\r";1218 if ( ! empty( $msg ) ) {1219 $message .= $msg . "\n\r";1220 }1221 $message .= "\n\r ProfileGrid Version - " . PROGRID_PLUGIN_VERSION;1222 $headers = "MIME-Version: 1.0\r\n";1223 $headers .= "Content-type:text/html;charset=UTF-8\r\n";1224 $headers .= ‘From:’ . $from_email_address . “\r\n";1225 wp_mail( '[email protected]’, 'PG Feedback’, $message, $headers );1226 die;1227 }1228 }12291230 public function pg_frontend_group_short_code() {1231 $pg_function = new Profile_Magic_Basic_Functions( $this->profile_magic, $this->version );1232 $link = $pg_function->pg_get_extension_shortcode( ‘FRONTEND_GROUP’ );1233 $path = plugin_dir_url( __FILE__ );1234 $html = ‘1235 <div class="pg-scsubblock">1236 <div class="pg-scblock pg-sctitle">’ . __( 'Group Creation Form’, ‘profilegrid-user-profiles-groups-and-communities’ ) . ‘</div>1237 <div class="pg-scblock"><span class="pg-code">’ . $link . '</span></div>1238 <div class="pg-scblock"><img class="pg-scimg” src="’ . $path . ‘partials/images/sc-12.png"></div>1239 <div class="pg-scblock pg-scdesc">’ . __( 'Allow registered users to create new Groups on front end. These Groups behave and work just like regular ProfileGrid groups.’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>1240 </div>’;1241 $html = apply_filters( 'pg_filter_frontend_group_shortcode’, $html );1242 echo wp_kses_post( $html );1243 }12441245 public function pg_geolocation_short_code() {1246 $pg_function = new Profile_Magic_Basic_Functions( $this->profile_magic, $this->version );1247 $link = $pg_function->pg_get_extension_shortcode( ‘GEOLOCATION’ );1248 $path = plugin_dir_url( __FILE__ );1249 $html = ‘1250 <div class="pg-scsubblock">1251 <div class="pg-scblock pg-sctitle">’ . __( 'Generate User Map’, ‘profilegrid-user-profiles-groups-and-communities’ ) . ‘</div>1252 <div class="pg-scblock"><span class="pg-code">’ . $link . '</span></div>1253 <div class="pg-scblock"><img class="pg-scimg” src="’ . $path . ‘partials/images/sc-11.png"></div>1254 <div class="pg-scblock pg-scdesc">’ . __( 'Generate maps showing locations of all users or specific groups using simple shortcodes. Get location data from registration form.’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>1255 </div>’;1256 $html = apply_filters( 'pg_filter_geolocation_shortcode’, $html );1257 echo wp_kses_post( $html );1258 }12591260 public function pg_groupwall_short_code() {1261 $pg_function = new Profile_Magic_Basic_Functions( $this->profile_magic, $this->version );1262 $link = $pg_function->pg_get_extension_shortcode( ‘GROUPWALL’ );1263 $path = plugin_dir_url( __FILE__ );1264 $html = ‘1265 <div class="pg-scsubblock">1266 <div class="pg-scblock pg-sctitle">’ . __( 'Wall Post Submission Form’, ‘profilegrid-user-profiles-groups-and-communities’ ) . ‘</div>1267 <div class="pg-scblock"><span class="pg-code">’ . $link . ‘</span></div>1268 <div class="pg-scblock"><img class="pg-scimg" src="’ . $path . ‘partials/images/sc-13.jpg"></div>1269 <div class="pg-scblock pg-scdesc">’ . __( 'Allows group members to write and submit posts to their group wall. Users can also upload and attach images to their wall posts.’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>1270 </div>’;1271 $html = apply_filters( 'pg_filter_groupwall_shortcode’, $html );1272 echo wp_kses_post( $html );1273 }12741275 public function pg_get_footer_banner() {1276 $path = plugin_dir_url( __FILE__ ) . 'partials/images/extension_banner.png’;12771278 ?>1279 <div class="pg-footer-banner"><a href="admin.php?page=pm_extensions"><img src="<?php echo esc_url( $path ); ?>" /></a></div>1280 <?php1281 }12821283 public function pm_dismissible_notice() {1284 $dbhandler = new PM_DBhandler();1285 $pmrequests = new PM_request();1286 $notice_name = $dbhandler->get_global_option_value( 'pg_dismissible_plugin’, ‘0’ );1287 $is_pg_page = $pmrequests->is_pg_dashboard_page();1288 if ( $notice_name == ‘1’ ) {1289 return;}1290 if ( $is_pg_page == false ) {1291 return;}1292 ?>1293 <div class="notice notice-info is-dismissible pg-dismissible" id="pg_dismissible_plugin">1294 <p><?php esc_html_e( “If you are testing multiple user profile plugins for WordPress, there’s a chance that one or more of them can override ProfileGrid’s functionality. If something is not working as expected, please try turning them off. A very common example is profile image upload feature not working.", ‘profilegrid-user-profiles-groups-and-communities’ ); ?></p>1295 </div>1296 <?php1297 }12981299 public function pm_dismissible_woo_bundle_notice() {1300 $dbhandler = new PM_DBhandler();1301 $pmrequests = new PM_request();1302 $notice_name = $dbhandler->get_global_option_value( 'pg_woo_bundle_dismissible_plugin’, ‘0’ );1303 $is_pg_page = $pmrequests->is_pg_dashboard_page();1304 if ( $notice_name == ‘1’ ) {1305 return;}1306 if ( $is_pg_page == false ) {1307 return;}1308 $activate_extensions = $pmrequests->pg_get_activate_extensions();1309 if ( ! empty( $activate_extensions[‘paid’] ) ) {1310 return;}1311 if ( class_exists( ‘Profile_Magic’ ) && class_exists( ‘WooCommerce’ ) && class_exists( ‘Profilegrid_Woocommerce’ ) ) {13121313 ?>1314 <div class="notice notice-success is-dismissible pg-dismissible” id="pg_woo_bundle_dismissible_plugin">1315 <p><?php esc_html_e( 'Do you want even more comprehensive WooCommerce integration with your user profiles and user groups? Upgrade to WooCommerce Premium Bundle for ProfileGrid.’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?> <a href="https://profilegrid.co/extensions/woocommerce-membership-extensions/?utm_source=pg_plugin&utm_medium=wp_notice&utm_campaign=woo_bundle_promo"><?php esc_html_e( 'Learn more’, ‘profilegrid-user-profiles-groups-and-communities’ ); ?></a></p>1316 </div>1317 <?php1318 }1319 }13201321 public function pm_dismissible_notice_ajax() {1322 $pm_sanitizer = new PM_sanitizer();13231324 $nonce = filter_input( INPUT_POST, ‘nonce’ );1325 if ( ! isset( $nonce ) || ! wp_verify_nonce( $nonce, ‘ajax-nonce’ ) ) {1326 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1327 }1328 $post = $pm_sanitizer->sanitize( $_POST );1329 $dbhandler = new PM_DBhandler();1330 if ( isset( $post[‘notice_name’] ) ) {1331 $notice_name = $post[‘notice_name’];1332 $dbhandler->update_global_option_value( $notice_name, ‘1’ );13331334 }1335 $default = array();1336 if ( isset( $post[‘rm_form_id’] ) ) {1337 $rmformid = $post[‘rm_form_id’];1338 $get_value = maybe_unserialize( get_option( 'pg_rm_change_form_type’, $default ) );1339 if ( isset( $get_value[ $rmformid ] ) ) {1340 unset( $get_value[ $rmformid ] );1341 $dbhandler->update_global_option_value( 'pg_rm_change_form_type’, $get_value );13421343 }1344 delete_option( ‘pg_rm_change_form_type_’ . $rmformid );1345 delete_option( ‘pg_rm_change_form_type_group_name_’ . $rmformid );1346 }1347 die;1348 }13491350 public function pm_dismissible_woocommerce_notice() {1351 $dbhandler = new PM_DBhandler();1352 $pmrequests = new PM_request();1353 $url = 'https://profilegrid.co/extensions/woocommerce-integration/?utm_source=plugin&utm_medium=wp_notice’;1354 $notice_name = $dbhandler->get_global_option_value( ‘pg_woocommerce_ext_notice’, ‘0’ );1355 $is_pg_page = $pmrequests->is_pg_dashboard_page();1356 if ( $notice_name == ‘1’ ) {1357 return;}1358 if ( class_exists( ‘Profile_Magic’ ) && class_exists( ‘WooCommerce’ ) && ! class_exists( ‘Profilegrid_Woocommerce’ ) ) {1359 ?>1360 <div class="notice notice-info is-dismissible pg-dismissible" id="pg_woocommerce_ext_notice">1361 <p><?php echo sprintf( wp_kses_post( "If you wish to integrate WooCommerce data with ProfileGrid user profiles, please download WooCommerce extension from <a target=’_blank’ href=’%s’>here.</a>", ‘profilegrid-user-profiles-groups-and-communities’ ), esc_url( $url ) ); ?></p>1362 </div>1363 <?php1364 }1365 }13661367 public function pm_dismissible_custom_profile_tab_notice() {1368 $dbhandler = new PM_DBhandler();1369 $pmrequests = new PM_request();1370 $url = 'https://profilegrid.co/extensions/custom-user-profile-tabs-content/’;1371 $notice_name = $dbhandler->get_global_option_value( ‘pg_custom_tab_ext_notice’, ‘0’ );1372 $is_pg_page = $pmrequests->is_pg_dashboard_page();1373 if ( $notice_name == ‘1’ ) {1374 return;}1375 if ( $is_pg_page == false ) {1376 return;}13771378 if ( class_exists( ‘Profile_Magic’ ) && class_exists( ‘WooCommerce’ ) && class_exists( ‘Profilegrid_Woocommerce’ ) && ! class_exists( ‘Profilegrid_User_Content’ ) ) {1379 ?>1380 <div class="notice notice-info is-dismissible pg-dismissible" id="pg_custom_tab_ext_notice">1381 <p><?php echo sprintf( wp_kses_post( "Do you wish to display information from WooCommerce extensions and other WordPress plugins inside frontend user profiles? Try our Custom User Profile Tabs extension, which can turn user profiles into powerful hubs with all user specific information in one place! <a target=’_blank’ href=’%s’>Get it here.</a>", ‘profilegrid-user-profiles-groups-and-communities’ ), esc_url( $url ) ); ?></p>1382 </div>1383 <?php1384 }1385 }13861387 public function pm_dismissible_bbpress_notice() {1388 $dbhandler = new PM_DBhandler();1389 $pmrequests = new PM_request();1390 $url = 'https://profilegrid.co/extensions/custom-user-profile-tabs-content/’;1391 $notice_name = $dbhandler->get_global_option_value( ‘pg_bbpress_ext_notice’, ‘0’ );1392 $is_pg_page = $pmrequests->is_pg_dashboard_page();1393 if ( $notice_name == ‘1’ ) {1394 return;}13951396 if ( class_exists( ‘Profile_Magic’ ) && is_plugin_active( ‘bbpress/bbpress.php’ ) && class_exists( ‘Profilegrid_Bbpress’ ) && ! class_exists( ‘Profilegrid_User_Content’ ) ) {1397 ?>1398 <div class="notice notice-info is-dismissible pg-dismissible" id="pg_bbpress_ext_notice">1399 <p><?php echo sprintf( wp_kses_post( "Do you wish to display information from bbPress extensions and other WordPress plugins inside frontend user profiles? Try our Custom User Profile Tabs extension, which can turn user profiles into powerful hubs with all user specific information in one place! <a target=’_blank’ href=’%s’>Get it here.</a>", ‘profilegrid-user-profiles-groups-and-communities’ ), esc_url( $url ) ); ?></p>1400 </div>1401 <?php1402 }1403 }1404140514061407 public function pm_check_associate_email_tmpl() {1408 $pm_sanitizer = new PM_sanitizer();14091410 $nonce = filter_input( INPUT_POST, ‘nonce’ );1411 if ( ! isset( $nonce ) || ! wp_verify_nonce( $nonce, ‘ajax-nonce’ ) ) {1412 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1413 }1414 $post = $pm_sanitizer->sanitize( $_POST );1415 $pmrequests = new PM_request();1416 if ( isset( $post[‘searchIDs’] ) ) {1417 $selected = $post[‘searchIDs’];1418 if ( isset( $selected[‘ID’] ) ) {1419 unset( $selected[‘ID’] );1420 }1421 if ( isset( $selected[‘filter’] ) ) {1422 unset( $selected[‘filter’] );1423 }1424 }14251426 $count_selected = count( $selected );1427 $msg = '’;1428 foreach ( $selected as $tid ) {1429 $exist_tmpl = $pmrequests->pg_check_email_template_if_used_in_any_group( $tid );1430 if ( $exist_tmpl != false ) {1431 if ( $count_selected > 1 ) {1432 $msg = __( 'One or more email templates you are trying to delete are being used for notifications by a group. Please disassociate them before attempting to delete.’, ‘profilegrid-user-profiles-groups-and-communities’ );1433 } else {1434 $msg = __( 'The Email Template you are trying to delete is being used for notifications by 1 or more user groups. Disassociate the template from all associated groups before deleting.’, ‘profilegrid-user-profiles-groups-and-communities’ );1435 }1436 }1437 }1438 echo esc_html( $msg );1439 die;1440 }14411442 public function pm_groups_widget() {1443 register_widget( ‘Profilegrid_Groups_Menu’ );1444 }14451446 public function pm_group_option_update() {1447 $dbhandler = new PM_DBhandler();1448 $pmrequest = new PM_request();14491450 $pg_main_groups = $dbhandler->get_all_result( 'GROUPS’, array( ‘id’ ), $where = 1, $result_type = 'results’, $offset = 0, $limit = false, $sort_by = null, $descending = false, $additional = '’, $output = 'ARRAY_A’, $distinct = false );1451 if ( ! empty( $pg_main_groups ) ) {1452 $pg_groups = $pmrequest->pm_to_array( $pg_main_groups );1453 $group_menu = get_option( ‘pg_group_menu’ );1454 if ( ! empty( $group_menu ) ) {1455 update_option( 'pg_group_menu’, $pg_groups );1456 } else {1457 if ( isset( $pg_groups ) ) :1458 $tmp = $group_menu;1459 if ( isset( $group_menu ) && is_array( $group_menu ) && ! empty( $group_menu ) ) {1460 sort( $group_menu );1461 }1462 if ( isset( $pg_groups ) && is_array( $pg_groups ) && ! empty( $pg_groups ) ) {1463 sort( $pg_groups );1464 }1465 endif;1466 if ( $group_menu == $pg_groups ) :1467 update_option( 'pg_group_menu’, $tmp );1468 else :1469 update_option( 'pg_group_menu’, $pg_groups );1470 update_option( 'pg_group_list’, $pg_groups );1471 endif;1472 }1473 $group_list = get_option( ‘pg_group_list’ );1474 if ( ! $group_list ) {1475 update_option( 'pg_group_list’, $pg_groups );1476 }1477 $pg_group_icon = get_option( ‘pg_group_icon’ );1478 if ( ! $pg_group_icon ) {1479 update_option( 'pg_group_icon’, ‘yes’ );1480 }1481 }1482 }14831484 public function pg_groupleader_assign_remove_fun( $gid, $prev_is_leader, $prev_group_leaders, $new_is_leader, $new_group_leaders ) {1485 $pmemails = new PM_Emails();1486 $is_remove = false;1487 $is_assign = false;1488 $new_group_leaders = maybe_unserialize( $new_group_leaders );14891490 if ( $prev_is_leader != ‘’ && $prev_is_leader == 1 && $new_is_leader == 0 ) {1491 if ( ! empty( $prev_group_leaders ) ) {1492 foreach ( $prev_group_leaders as $old_admin ) {1493 $user_data = get_user_by( 'ID’, $old_admin );1494 $pmemails->pm_send_group_based_notification( $gid, $user_data->ID, ‘on_admin_removal’ );1495 do_action( 'pm_unassign_group_manager_privilege’, $gid, $user_data->ID );1496 }1497 }1498 } else {1499 if ( empty( $prev_group_leaders ) ) {1500 $prev_group_leaders = array();1501 }1502 if ( empty( $new_group_leaders ) ) {1503 $new_group_leaders = array();1504 }1505 $admins_removed = array_diff( $prev_group_leaders, $new_group_leaders );1506 $admins_added = array_diff( $new_group_leaders, $prev_group_leaders );15071508 if ( ! empty( $admins_added ) ) {1509 foreach ( $admins_added as $new_admin ) {1510 $user_data = get_user_by( 'ID’, $new_admin );1511 $pmemails->pm_send_group_based_notification( $gid, $user_data->ID, ‘on_admin_assignment’ );1512 do_action( 'pm_assign_group_manager_privilege’, $gid, $user_data->ID );1513 }1514 }1515 if ( ! empty( $admins_removed ) ) {1516 foreach ( $admins_removed as $old_admin ) {1517 $user_data = get_user_by( 'ID’, $old_admin );1518 $pmemails->pm_send_group_based_notification( $gid, $user_data->ID, ‘on_admin_removal’ );1519 do_action( 'pm_unassign_group_manager_privilege’, $gid, $user_data->ID );1520 }1521 }1522 }1523 return;1524 }15251526 public function rm_form_type_changed_fun( $form_id, $form_type, $previous_form_type ) {1527 $pmrequest = new PM_request();1528 $dbhandler = new PM_DBhandler();1529 $is_associate = $pmrequest->pm_check_rm_form_associate_with_groups( $form_id );1530 if ( ! empty( $is_associate ) && $form_type != ‘1’ && $previous_form_type == ‘1’ ) {1531 $group_name = array();1532 foreach ( $is_associate as $group ) {1533 $group_name[] = $dbhandler->get_value( 'GROUPS’, 'group_name’, $group );1534 $group_options = maybe_unserialize( $dbhandler->get_value( 'GROUPS’, 'group_options’, $group ) );1535 $group_options[‘pg_rm_form’] = '0’;15361537 $dbhandler->update_row( 'GROUPS’, 'id’, $group, array( ‘group_options’ => maybe_serialize( $group_options ) ), array( ‘%s’ ), ‘%d’ );1538 }1539 if ( ! empty( $group_name ) ) {1540 $name = implode( ',’, $group_name );1541 } else {1542 $name = '’;1543 }15441545 $default = array();1546 $get_value = maybe_unserialize( get_option( 'pg_rm_change_form_type’, $default ) );1547 $get_value[] = $form_id;1548 update_option( 'pg_rm_change_form_type’, $get_value );1549 update_option( ‘pg_rm_change_form_type_’ . $form_id, $form_id );1550 update_option( ‘pg_rm_change_form_type_group_name_’ . $form_id, $name );1551 }1552 }15531554 public function pm_dismissible_rm_form_type_changed() {1555 $pmrequest = new PM_request();1556 $dbhandler = new PM_DBhandler();1557 $default = array();1558 $get_value = maybe_unserialize( get_option( 'pg_rm_change_form_type’, $default ) );15591560 if ( ! empty( $get_value ) && is_array( $get_value ) ) {1561 foreach ( $get_value as $form_id ) {1562 $get_form_option = get_option( “pg_rm_change_form_type_$form_id", ‘’ );1563 if ( $get_form_option != ‘’ ) {1564 $name = get_option( “pg_rm_change_form_type_group_name_$form_id", ‘’ );1565 ?>1566 <div class="notice notice-info is-dismissible pgrm-dismissible” id="pg_rm_change_form_type_<?php echo esc_attr( $form_id ); ?>” data-rmid="<?php echo esc_attr( $form_id ); ?>">1567 <p><?php echo sprintf( wp_kses_post( '%s registration form has been reverted to default ProfileGrid form since the associated RegistrationMagic form was deleted or its type was changed.’, ‘profilegrid-user-profiles-groups-and-communities’ ), esc_html( $name ) ); ?></p>1568 </div>1569 <?php1570 }1571 }1572 }1573 }15741575 public function rm_user_deactivated( $uid ) {1576 $pmrequests = new PM_request();1577 $pmemails = new PM_Emails();1578 $ugids = get_user_meta( $uid, 'pm_group’, true );1579 $ugid = $pmrequests->pg_filter_users_group_ids( $ugids );1580 $primary_group = $pmrequests->pg_get_primary_group_id( $ugid );1581 $pmemails->pm_send_group_based_notification( $primary_group, $uid, ‘on_user_deactivate’ );1582 }158315841585 public function rm_form_deleted_fun( $form_id ) {1586 $this->rm_form_type_changed_fun( $form_id, '2’, ‘1’ );1587 }15881589 public function pm_get_rm_helptext() {1590 $pm_sanitizer = new PM_sanitizer();1591 $nonce = filter_input( INPUT_POST, ‘nonce’ );1592 if ( ! isset( $nonce ) || ! wp_verify_nonce( $nonce, ‘ajax-nonce’ ) ) {1593 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1594 }1595 $post = $pm_sanitizer->sanitize( $_POST );1596 $dbhandler = new PM_DBhandler();1597 if ( isset( $post[‘id’] ) ) {1598 $form_id = $post[‘id’];1599 } else {1600 $form_id = ‘0’;1601 }1602 if ( $form_id == ‘0’ ) {1603 echo "’Default’ sets up the group registration form using this group’s profile fields";1604 } else {1605 $form_name = $dbhandler->get_value( 'FORMS’, ‘form_name’, $form_id );1606 echo "This sets up the RegistrationMagic form <a target=’_blank’ href=’admin.php?page=rm_form_sett_manage&rm_form_id=" . esc_attr( $form_id ) . “’>” . esc_html( $form_name ) . “</a> as this group’s registration form";1607 }1608 die;1609 }1610 public function profilegrid_user_blogs_widgets() {1611 register_widget( ‘Profilegrid_User_Blogs’ );1612 }16131614 public function profilegrid_user_login_widgets() {1615 register_widget( ‘Profilegrid_User_login’ );1616 }1617 // register our meta box for our links1618 public function individual_user_group_add_meta_box() {1619 add_meta_box(1620 'group_pages_menu_metabox’,1621 __( 'Individual User Group’, ‘individual-user-group-to-menu’ ),1622 array( $this, ‘individual_user_group_display_meta_box’ ),1623 'nav-menus’,1624 'side’,1625 'low’1626 );1627 add_meta_box(1628 'user_profile_pages_menu_metabox’,1629 __( 'Individual User Profile’, ‘individual-user-profile-to-menu’ ),1630 array( $this, ‘individual_user_profile_display_meta_box’ ),1631 'nav-menus’,1632 'side’,1633 'low’1634 );16351636 }16371638 public function individual_user_group_display_meta_box() {1639 $dbhandler = new PM_DBhandler();1640 $pmrequests = new PM_request();1641 $groups = $dbhandler->get_all_result( ‘GROUPS’ );16421643 ?>1644 1645 <div id="posttype-group-pages” class="posttypediv">1646 <div id="tabs-panel-group-pages" class="tabs-panel tabs-panel-active">1647 1648 <ul id="group-pages" class="categorychecklist form-no-clear">1649 <!–Custom -->1650 <?php1651 // loop through all registered content types that have ‘has-group’ enabled16521653 if ( ! empty( $groups ) ) {1654 $counter = -1;1655 foreach ( $groups as $group ) {1656 $group_name = $group->group_name;1657 $group_page_link = $pmrequests->profile_magic_get_frontend_url( 'pm_group_page’, '’, $group->id );1658 //$group_page_link = add_query_arg( 'gid’, $group->id, $group_page_link );1659 ?>1660 <li>1661 <label class="menu-item-title">1662 <input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-object-id]" value="-1"/><?php echo esc_html( $group_name ); ?>1663 </label>1664 <input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-type]" value="custom"/>1665 <input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-title]" value="<?php echo esc_attr( $group_name ); ?>"/>1666 <input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-url]" value="<?php echo esc_url( $group_page_link ); ?>"/>1667 <input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-classes]“/>1668 </li>1669 <?php1670 $counter–;1671 }1672 }1673 ?>1674 1675 </ul>1676 </div>1677 <p class="button-controls">1678 <span class="list-controls">1679 <a href="<?php echo esc_url( admin_url( ‘nav-menus.php?page-tab=all&selectall=1#posttype-group-pages’ ) ); ?>” class="select-all"> <?php esc_html_e( 'Select All’, ‘group-pages-to-menu’ ); ?></a>1680 </span>1681 <span class="add-to-menu">1682 <input type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu’, ‘group-pages-to-menu’ ); ?>" name="add-post-type-menu-item" id="submit-posttype-group-pages">1683 <span class="spinner"></span>1684 </span>1685 </p>1686 </div> 1687 <?php1688 }16891690 public function individual_user_profile_display_meta_box() {1691 $dbhandler = new PM_DBhandler();1692 $pmrequests = new PM_request();1693 $meta_query = $pmrequests->pm_get_user_meta_query( array() );1694 $user_query = $dbhandler->pm_get_all_users_ajax( '’, $meta_query );16951696 $users = $user_query->get_results();16971698 ?>1699 1700 <div id="posttype-user-pages" class="posttypediv">1701 <div id="tabs-panel-user-pages" class="tabs-panel tabs-panel-active">1702 1703 <ul id="user-pages" class="categorychecklist form-no-clear">1704 <!–Custom -->1705 <?php1706 // loop through all registered content types that have ‘has-group’ enabled17071708 if ( ! empty( $users ) ) {1709 $counter = -1;1710 foreach ( $users as $user ) {1711 $group_name = $user->display_name;1712 $uid = $user->ID;1713 $profile_url = $pmrequests->pm_get_user_profile_url( $uid );1714 ?>1715 <li>1716 <label class="menu-item-title">1717 <input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-object-id]" value="-1"/><?php echo esc_html( $group_name ); ?>1718 </label>1719 <input type="hidden" class="menu-item-type" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-type]" value="custom"/>1720 <input type="hidden" class="menu-item-title" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-title]" value="<?php echo esc_attr( $group_name ); ?>"/>1721 <input type="hidden" class="menu-item-url" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-url]" value="<?php echo esc_url( $profile_url ); ?>"/>1722 <input type="hidden" class="menu-item-classes" name="menu-item[<?php echo esc_attr( $counter ); ?>][menu-item-classes]“/>1723 </li>1724 <?php1725 $counter–;1726 }1727 }1728 ?>1729 1730 </ul>1731 </div>1732 <p class="button-controls">1733 <span class="list-controls">1734 <a href="<?php echo esc_url( admin_url( ‘nav-menus.php?page-tab=all&selectall=1#posttype-user-pages’ ) ); ?>” class="select-all"> <?php esc_html_e( 'Select All’, ‘user-pages-to-menu’ ); ?></a>1735 </span>1736 <span class="add-to-menu">1737 <input type="submit" class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu’, ‘user-pages-to-menu’ ); ?>" name="add-post-type-menu-item" id="submit-posttype-user-pages">1738 <span class="spinner"></span>1739 </span>1740 </p>1741 </div> 1742 <?php1743 }17441745 public function pg_create_group_page() {1746 $dbhandler = new PM_DBhandler();1747 $gid = filter_input( INPUT_POST, ‘gid’ );1748 $identifier = 'GROUPS’;1749 $row = $dbhandler->get_row( $identifier, $gid );1750 if ( $row->group_options != ‘’ ) {1751 $group_options = maybe_unserialize( $row->group_options );1752 }17531754 $group_name = 'User Group - ' . $dbhandler->get_value( 'GROUPS’, 'group_name’, $gid );1755 $arg = array(1756 ‘post_type’ => 'page’,1757 ‘post_title’ => $group_name,1758 ‘post_status’ => ‘publish’,1759 ‘post_content’ => '[profilegrid_group gid="’ . $gid . '"]',1760 );1761 $id = wp_insert_post( $arg );17621763 $group_options[‘group_page’] = $id;1764 $options = maybe_serialize( $group_options );1765 $data = array( ‘group_options’ => $options );1766 $args = array( ‘%s’ );1767 $dbhandler->update_row( $identifier, 'id’, $gid, $data, $args, ‘%d’ );17681769 echo esc_html( $id );1770 die;1771 }17721773 public function pg_action_user_edit_form_tag() {1774 echo ' enctype="multipart/form-data"’;1775 }17761777 public function pm_remove_file_attachment() {1778 $key = filter_input( INPUT_POST, ‘key’ );1779 $value = filter_input( INPUT_POST, ‘value’ );1780 $userid = filter_input( INPUT_POST, ‘uid’ );17811782 $user_attachments = get_user_meta( $userid, $key, true );1783 if ( $user_attachments != ‘’ ) {1784 $old_attachments = explode( ',’, $user_attachments );1785 $index = array_search( $value, $old_attachments, true );1786 unset( $old_attachments[ $index ] );1787 }1788 if ( empty( $old_attachments ) ) {1789 $val = delete_user_meta( $userid, $key );1790 } else {1791 $ids = implode( ',’, $old_attachments );1792 $val = update_user_meta( $userid, $key, $ids );17931794 }1795 echo esc_html( $val );1796 die;1797 }17981799 public function profile_magic_premium_setting_option() {1800 include 'partials/premium_setting_option.php’;1801 }18021803 public function pm_change_users_blog_post_types_slug( $args, $post_type ) {1804 $dbhandler = new PM_DBhandler();1805 $newslug = $dbhandler->get_global_option_value( 'pm_blog_base’, ‘profilegrid_blogs’ );1806 $group_wall_base = $dbhandler->get_global_option_value( 'pm_group_wall_base’, ‘pg_groupwalls’ );1807 /*item post type slug*/1808 if ( ‘profilegrid_blogs’ === $post_type && $newslug != ‘profilegrid_blogs’ ) {1809 $args[‘rewrite’][‘slug’] = $newslug;1810 }18111812 if ( class_exists( ‘Profilegrid_Group_Wall’ ) && ‘pg_groupwalls’ === $post_type && $group_wall_base != ‘pg_groupwalls’ ) {1813 $args[‘rewrite’][‘slug’] = $group_wall_base;1814 }1815 return $args;1816 }18171818 public function pm_save_custom_permalink_option() {1819 if ( ! is_admin() ) {1820 return;1821 }1822 $nonce = filter_input( INPUT_POST, ‘pg-permalinks-nonce’ );1823 if ( !isset( $nonce ) || !wp_verify_nonce( $nonce, ‘pg-permalinks’ ) ) {1824 return;1825 }1826 $pm_sanitizer = new PM_sanitizer();1827 $post = $pm_sanitizer->sanitize( $_POST );1828 if ( isset( $post[‘permalink_structure’], $post[‘pm_blog_base’] ) ) {1829 $dbhandler = new PM_DBhandler();1830 $dbhandler->update_global_option_value( 'pm_blog_base’, $post[‘pm_blog_base’] );18311832 if ( isset( $post[‘pm_group_wall_base’] ) ) {1833 $dbhandler->update_global_option_value( 'pm_group_wall_base’, $post[‘pm_group_wall_base’] );1834 }1835 }1836 }18371838 public function pm_custom_permalink_option() {1839 /* Create settings section */18401841 add_settings_section(1842 'profilegrid_permalink_section’, // ID1843 'ProfileGrid User Blogs System Settings ', // Section title1844 array( $this, ‘pg_permalink_html’ ), // Callback for your function1845 ‘permalink’ // Location (Settings > Permalinks)1846 );18471848 /* Create settings field */1849 add_settings_field(1850 'pm_blog_base’, // Field ID1851 'User Blogs Base’, // Field title1852 array( $this, ‘pm_blog_base_callback’ ), // Field callback function1853 'permalink’, // Settings page slug1854 ‘profilegrid_permalink_section’ // Section ID1855 );18561857 if ( class_exists( ‘Profilegrid_Group_Wall’ ) ) {1858 /* Create settings field */1859 add_settings_field(1860 'pm_group_wall_base’, // Field ID1861 'Group Wall Base’, // Field title1862 array( $this, ‘pm_group_wall_base_callback’ ), // Field callback function1863 'permalink’, // Settings page slug1864 ‘profilegrid_permalink_section’ // Section ID1865 );1866 }18671868 }18691870 public function pg_permalink_html() {1871 echo esc_html__( 'You can define the slugs for posts created through ProfileGrid’s native user blogs system and Group Wall extension.’, ‘profilegrid-user-profiles-groups-and-communities’ );1872 }1873187418751876 /* Settings Field Callback */1877 public function pm_blog_base_callback() {18781879 $dbhandler = new PM_DBhandler();1880 $blog_base = $dbhandler->get_global_option_value( 'pm_blog_base’, ‘profilegrid_blogs’ );1881 ?>1882 <label for="pm_blog_base">1883 <input name="pm_blog_base" id="pm_blog_base" type="text" value="<?php echo esc_attr( $blog_base ); ?>" class="regular-text code" autocomplete="off">1884 </label>1885 <?php1886 wp_nonce_field( 'pg-permalinks’, ‘pg-permalinks-nonce’ );1887 }18881889 /* Settings Field Callback */1890 public function pm_group_wall_base_callback() {1891 $dbhandler = new PM_DBhandler();1892 $group_wall_base = $dbhandler->get_global_option_value( 'pm_group_wall_base’, ‘pg_groupwalls’ );1893 ?>1894 <label for="pm_group_wall_base">1895 <input name="pm_group_wall_base" id="pm_group_wall_base" type="text" value="<?php echo esc_attr( $group_wall_base ); ?>" class="regular-text code" autocomplete="off">1896 </label>1897 <?php1898 }18991900 public function pm_wizard_update_group_icon() {1901 $dbhandler = new PM_DBhandler();1902 $gid = filter_input( INPUT_POST, ‘gid’ );1903 $group_icon = filter_input( INPUT_POST, ‘group_icon’ );1904 $data = array( ‘group_icon’ => $group_icon );1905 $dbhandler->update_row( 'GROUPS’, 'id’, $gid, $data );1906 die;1907 }19081909 public function pm_submit_group_wizard_form() {1910 $dbhandler = new PM_DBhandler();1911 $pm_activator = new Profile_Magic_Activator();1912 $pmrequests = new PM_request();1913 $identifier = 'GROUPS’;1914 $retrieved_nonce = filter_input( INPUT_POST, ‘_wpnonce’ );1915 if ( ! wp_verify_nonce( $retrieved_nonce, ‘pm_group_wizard_form’ ) ) {1916 die( esc_html__( 'Failed security check’, ‘profilegrid-user-profiles-groups-and-communities’ ) );1917 }1918 $groupid = filter_input( INPUT_POST, ‘group_id’ );1919 $exclude = array( '_wpnonce’, '_wp_http_referer’, 'submit_group’, 'group_id’, 'pg-switch-two’, ‘action’ );19201921 $post = $pmrequests->sanitize_request( $_POST, $identifier, $exclude );19221923 if ( $post != false ) {1924 foreach ( $post as $key => $value ) {1925 $data[ $key ] = $value;1926 $arg[] = $pm_activator->get_db_table_field_type( $identifier, $key );1927 }1928 }19291930 $gid = $groupid;1931 $dbhandler->update_row( $identifier, 'id’, $groupid, $data, $arg, ‘%d’ );1932 die;1933 }19341935 public function pm_allowed_html_tags( $allowed, $context ) {1936 if ( ‘post’ === $context ) {1937 $allowed[‘a’][‘onclick’] = true;1938 $allowed[‘svg’][‘onclick’] = true;1939 $allowed[‘div’][‘onclick’] = true;1940 $allowed[‘div’][‘id’] = true;1941 $allowed[‘div’][‘class’] = true;1942 $allowed[‘svg’][‘fill’] = true;1943 $allowed[‘svg’][‘heigth’] = true;1944 $allowed[‘svg’][‘width’] = true;1945 $allowed[‘svg’][‘viewBox’] = true;1946 $allowed[‘svg’][‘xmlns’] = true;1947 $allowed[‘path’][‘fill’] = true;1948 $allowed[‘path’][‘d’] = true;19491950 }19511952 return $allowed;1953 }19541955 public function pm_get_groups_details() {1956 $dbhandler = new PM_DBhandler();1957 $identifier = 'GROUPS’;1958 $pmrequests = new PM_request();1959 $pm_sanitizer = new PM_sanitizer();1960 $path = plugin_dir_url( __FILE__ );19611962 1963 $post = $pm_sanitizer->sanitize( $_POST );1964 if ( isset( $post[‘gids’] ) && ! empty( $post[‘gids’] ) ) {1965 foreach ( $post[‘gids’] as $gid ) {1966 $row = $dbhandler->get_row( $identifier, $gid );1967 $meta_query_array = $pmrequests->pm_get_user_meta_query( array( ‘gid’ => $row->id ) );1968 $user_query = $dbhandler->pm_get_all_users_ajax( '’, $meta_query_array, '’, 0, 6, 'DESC’, ‘ID’ );1969 $total_users = $user_query->get_total();1970 echo '<div class="pg-box-row pg-box-center pg-card-mb-16">’;1971 echo ‘<input type="hidden" name="selected[]" value="’ . esc_attr( $row->id ) . '" />’;1972 echo '<div class="pg-group-row-icon pg-box-col-2">’;19731974 if ( ! empty( $row ) && $row->group_icon != 0 ) {1975 echo wp_get_attachment_link( $row->group_icon, array( 50, 50 ), false, true, false );1976 } else {1977 ?>1978 <img src="<?php echo esc_url( $path . ‘partials/images/pg-icon.png’ ); ?>" />1979 <?php1980 }1981 echo '</div>’;1982 echo '<div class="pg-group-row-meta pg-box-col-10">’;1983 echo ‘<div class="pg-group-card-title">’ . esc_html( $row->group_name ) . '</div>’;1984 echo ‘<div class="pg-group-card-subtitle">’ . esc_html( $total_users ) . ' ' . esc_html__( 'members’, ‘profilegrid-user-profiles-groups-and-communities’ ) . '</div>’;1985 echo '</div>’;1986 echo '</div>’;1987 }1988 }1989 die;1990 }1991 1992 public function pg_customization_extension_html()1993 {1994 $path = plugin_dir_url( __FILE__ );1995 ?>1996 <div class="pg-box-col-4 pg-card-mb-16 pg-ext-card “>1997 <div class="pg-box-border pg-box-p-18 pg-box-white-bg pg-box-h-100">1998 <div class="pg-box-row pg-box-h-100">1999 <div class="pg-box-col-8">2000 <div class="pg-ext-box-title"><?php echo esc_html__('Build a custom extension’, ‘profilegrid-user-profiles-groups-and-communities’); ?></div>2001 <div class="pg-ext-installation-status"><span class="pg-ext-not-installed">Request a Quote</span></div>2002 <div class="pg-ext-box-description">2003 <p class="pg-col-desc"><?php echo esc_html__('Have our team build a custom extension for you to meet your specific needs.’, ‘profilegrid-user-profiles-groups-and-communities’); ?></p>2004 <p class="authors” style="display:none"> <cite><?php esc_html_e('By’, ‘profilegrid-user-profiles-groups-and-communities’); ?> <a target="_blank" href="https://profilegrid.co/extensions/"><?php esc_html_e('ProfileGrid’, ‘profilegrid-user-profiles-groups-and-communities’); ?></a></cite></p>2005 </div>2006 <div class="pg-ext-box-button">2007 <a class="pg-install-now-btn pg-more-info" target="_blank" href="https://metagauss.com/customization-help/"> <?php esc_html_e('Get Help Now’, ‘profilegrid-user-profiles-groups-and-communities’); ?></a>2008 </div>2009 </div> 2010 <div class="pg-box-col-4 pg-d-flex pg-d-flex-v-center pg-flex-direction-col">2011 <div class="pg-ext-box-icon"> <img src="<?php echo $path; ?>partials/images/pg-customization-icon.png" class="pg-ext-icon" alt=""></div>2012 </div> 2013 </div>2014 </div>2015 </div> 2016 <?php 2017 }20182019}

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907