Changeset 3149247
- Timestamp:
- 09/10/2024 12:44:56 PM (18 months ago)
- Location:
- wp-user-profile-avatar/trunk
- Files:
-
- 17 edited
-
admin/templates/comments-settings-page.php (modified) (5 diffs)
-
admin/templates/comments-tools-page.php (modified) (5 diffs)
-
admin/wp-user-profile-avatar-admin.php (modified) (8 diffs)
-
admin/wp-user-profile-avatar-settings.php (modified) (6 diffs)
-
assets/css/frontend.css (modified) (1 diff)
-
assets/css/frontend.min.css (modified) (1 diff)
-
includes/wp-author-box-social-info.php (modified) (6 diffs)
-
includes/wp-avatar-social profile-picture.php (modified) (5 diffs)
-
includes/wp-user-profile-avatar-install.php (modified) (2 diffs)
-
includes/wp-user-profile-avatar-user.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
shortcodes/wp-author-social-info-shortcodes.php (modified) (1 diff)
-
shortcodes/wp-user-profile-avatar-shortcodes.php (modified) (12 diffs)
-
templates/wp-display-user-avatar-list.php (modified) (1 diff)
-
wp-user-profile-avatar-disable-comments.php (modified) (4 diffs)
-
wp-user-profile-avatar-functions.php (modified) (11 diffs)
-
wp-user-profile-avatar.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-user-profile-avatar/trunk/admin/templates/comments-settings-page.php
r3123813 r3149247 15 15 16 16 $mode = sanitize_text_field( $_POST['mode'] ); 17 update_option( ' disable_comments_mode', $mode );17 update_option( 'wpupa_disable_comments_mode', $mode ); 18 18 19 19 if ( 'selected-types' === $mode && isset( $_POST['disabled_post_types'] ) && is_array( $_POST['disabled_post_types'] ) ) { … … 22 22 $disabled_post_types = array(); 23 23 } 24 update_option( ' disabled_post_types', $disabled_post_types );24 update_option( 'wpupa_disabled_post_types', $disabled_post_types ); 25 25 } 26 27 // Handle reset action 28 if ( isset( $_POST['reset'] ) && isset( $_POST['disable_comments_nonce_field'] ) && wp_verify_nonce( $_POST['disable_comments_nonce_field'], 'disable_comments_nonce' ) ) { 29 delete_option( 'wpupa_disable_comments_mode' ); 30 delete_option( 'wpupa_disabled_post_types' ); 31 } 32 26 33 ?> 27 34 <form action="" method="post" id="disable-comments"> … … 29 36 <li> 30 37 <label for="remove_everywhere"> 31 <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( get_option(' disable_comments_mode'), 'remove_everywhere' ); ?> />38 <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( get_option('wpupa_disable_comments_mode'), 'remove_everywhere' ); ?> /> 32 39 <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: 33 40 <?php esc_html_e( 'Disable all comment-related controls and settings in WordPress.', 'wp-user-profile-avatar' ); ?> 34 41 </label> 35 42 <p class="indent"> 36 <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href="%2$s" target="_blank">available here</a>.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>', 'https://wordpress.org/plugins/disable-comments/other_notes/' ); ?> 43 <?php printf( 44 /* translators: 1: Warning label, 2: URL link */ 45 esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to disable comments everywhere. A complete description of what this option does is %2$s.', 'wp-user-profile-avatar' ), 46 '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>', 47 '<a href="' . esc_url( 'https://wordpress.org/plugins/disable-comments/other_notes/' ) . '" target="_blank">' . esc_html__( 'available here', 'wp-user-profile-avatar' ) . '</a>' 48 ); ?> 37 49 </p> 38 50 </li> 39 51 <li> 40 52 <label for="selected-types"> 41 <input type="radio" id="selected-types" name="mode" value="selected-types" <?php checked( get_option(' disable_comments_mode'), 'selected-types' ); ?> />53 <input type="radio" id="selected-types" name="mode" value="selected-types" <?php checked( get_option('wpupa_disable_comments_mode'), 'selected-types' ); ?> /> 42 54 <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>: 43 55 </label> … … 47 59 <?php 48 60 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 49 $disabled_post_types = get_option( ' disabled_post_types', array() );61 $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() ); 50 62 foreach ( $post_types as $post_type ) { 51 63 ?> … … 63 75 </ul> 64 76 <?php wp_nonce_field( 'disable_comments_nonce', 'disable_comments_nonce_field' ); ?> 65 <p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"></p> 77 <p class="submit"> 78 <input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"> 79 <input class="button-secondary" type="submit" name="reset" value="<?php esc_html_e( 'Reset Settings', 'wp-user-profile-avatar' ); ?>"> 80 </p> 66 81 </form> 67 82 </div> -
wp-user-profile-avatar/trunk/admin/templates/comments-tools-page.php
r3123813 r3149247 15 15 16 16 $mode = sanitize_text_field( $_POST['mode'] ); 17 update_option( ' delete_comments_mode', $mode );17 update_option( 'wpupa_delete_comments_mode', $mode ); 18 18 19 19 if ( 'delete_everywhere' === $mode ) { 20 20 21 $deleted_count = delete_comments_everywhere(); 22 echo '<div class="notice notice-success"><p>' . sprintf( esc_html__( '%d comments have been deleted from your site.', 'wp-user-profile-avatar' ), $deleted_count ) . '</p></div>'; 23 update_option( 'selected_post_types', array() ); 21 $deleted_count = wpupa_delete_comments_everywhere(); 22 echo '<div class="notice notice-success"><p>'; 23 printf( 24 /* translators: %d: Number of deleted comments */ 25 esc_html__( '%d comments have been deleted from your site.', 'wp-user-profile-avatar' ), 26 intval( $deleted_count ) 27 ); 28 echo '</p></div>'; 29 update_option( 'wpupa_selected_post_types', array() ); 24 30 25 31 } elseif ( 'selected-post-types' === $mode ) { … … 28 34 29 35 $selected_post_types = array_map( 'sanitize_text_field', $_POST['selected_post_types'] ); 30 update_option( 'selected_post_types', $selected_post_types ); // Save selected post types 31 $deleted_count = delete_comments_by_post_types( $selected_post_types ); 32 echo '<div class="notice notice-success"><p>' . sprintf( esc_html__( '%d comments have been deleted from selected post types.', 'wp-user-profile-avatar' ), $deleted_count ) . '</p></div>'; 36 update_option( 'wpupa_selected_post_types', $selected_post_types ); // Save selected post types 37 $deleted_count = wpupa_delete_comments_by_post_types( $selected_post_types ); 38 echo '<div class="notice notice-success"><p>'; 39 printf( 40 /* translators: %d: Number of deleted comments */ 41 esc_html__( '%d comments have been deleted from selected post types.', 'wp-user-profile-avatar' ), 42 intval( $deleted_count ) 43 ); 44 echo '</p></div>'; 33 45 34 46 } else { 35 update_option( 'selected_post_types', array() ); 36 // echo '<div class="notice notice-error"><p>' . esc_html__( 'Please select at least one post type to delete comments from.', 'wp-user-profile-avatar' ) . '</p></div>'; 47 update_option( 'wpupa_selected_post_types', array() ); 37 48 } 38 49 } 39 50 } 51 52 // Handle reset action 53 if ( isset( $_POST['reset'] ) && isset( $_POST['delete_comments_nonce_field'] ) && wp_verify_nonce( $_POST['delete_comments_nonce_field'], 'delete_comments_nonce' ) ) { 54 delete_option( 'wpupa_delete_comments_mode' ); 55 delete_option( 'wpupa_selected_post_types' ); 56 } 57 40 58 ?> 41 59 <form action="" method="post" id="delete-comments"> … … 43 61 <li> 44 62 <label for="delete_everywhere"> 45 <input type="radio" id="delete_everywhere" name="mode" value="delete_everywhere" <?php checked( get_option(' delete_comments_mode'), 'delete_everywhere' ); ?> />63 <input type="radio" id="delete_everywhere" name="mode" value="delete_everywhere" <?php checked( get_option('wpupa_delete_comments_mode'), 'delete_everywhere' ); ?> /> 46 64 <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: 47 65 <?php esc_html_e( 'Delete all comments across your entire site.', 'wp-user-profile-avatar' ); ?> 48 66 </label> 49 67 <p class="indent"> 50 <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to delete comments <em>everywhere</em>.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>' ); ?>68 <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to delete comments everywhere.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>' ); ?> 51 69 </p> 52 70 </li> 53 71 <li> 54 72 <label for="selected-post-types"> 55 <input type="radio" id="selected-post-types" name="mode" value="selected-post-types" <?php checked( get_option(' delete_comments_mode'), 'selected-post-types' ); ?> />73 <input type="radio" id="selected-post-types" name="mode" value="selected-post-types" <?php checked( get_option('wpupa_delete_comments_mode'), 'selected-post-types' ); ?> /> 56 74 <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>: 57 75 </label> … … 61 79 <?php 62 80 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 63 $selected_post_types = get_option( ' selected_post_types', array() );81 $selected_post_types = get_option( 'wpupa_selected_post_types', array() ); 64 82 foreach ( $post_types as $post_type ) { 65 83 ?> … … 77 95 </ul> 78 96 <?php wp_nonce_field( 'delete_comments_nonce', 'delete_comments_nonce_field' ); ?> 79 <p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"></p> 97 <p class="submit"> 98 <input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"> 99 <input class="button-secondary" type="submit" name="reset" value="<?php esc_html_e( 'Reset Settings', 'wp-user-profile-avatar' ); ?>"> 100 </p> 80 101 </form> 81 102 </div> -
wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-admin.php
r3123813 r3149247 41 41 42 42 add_action( 'init', array( $this, 'wpupa_thickbox_model_init' ) ); 43 add_action( 'wp_ajax_thickbox_model_view', array( $this, ' thickbox_model_view' ) );44 add_action( 'wp_ajax_nopriv_thickbox_model_view', array( $this, ' thickbox_model_view' ) );43 add_action( 'wp_ajax_thickbox_model_view', array( $this, 'wpupa_thickbox_model_view' ) ); 44 add_action( 'wp_ajax_nopriv_thickbox_model_view', array( $this, 'wpupa_thickbox_model_view' ) ); 45 45 46 46 add_action( 'admin_init', array( $this, 'wpupa_init_size' ) ); … … 68 68 add_submenu_page( 'wp-user-profile-avatar', __( 'WP Username Change', 'wp-user-profile-avatar' ), __( 'WP Username Change ', 'wp-user-profile-avatar' ), 'manage_options', 'wpupa_username_change', 'wpupa_username_edit' ); 69 69 add_submenu_page( null, '', '', 'manage_options', 'wpupa_username_update', 'wpupa_user_update' ); 70 add_submenu_page( 'wp-user-profile-avatar', 'WP Avatar User Role Settings', 'WP Avatar User Role Settings', 'activate_plugins', 'avatar-social-picture', 'wpupa_user_admin' ); 71 add_submenu_page( 'wp-user-profile-avatar', 'Disable Comments', 'Disable Comments', 'manage_options', 'disable_comments_settings', array( $this, 'comments_settings_page' ) ); 72 add_submenu_page( 'wp-user-profile-avatar', 'Delete Comments', 'Delete Comments', 'manage_options', 'disable_comments_tools', array( $this, 'comments_tools_page' ) ); 73 } 70 add_submenu_page( 'wp-user-profile-avatar', 'WP Avatar User Role Settings', 'WP Avatar User Role Settings', 'activate_plugins', 'avatar-social-picture', array( $this, 'wpupa_user_admin' ) ) ; 71 add_submenu_page( 'wp-user-profile-avatar', 'Disable Comments', 'Disable Comments', 'manage_options', 'disable_comments_settings', array( $this, 'wpupa_comments_settings_page' ) ); 72 add_submenu_page( 'wp-user-profile-avatar', 'Delete Comments', 'Delete Comments', 'manage_options', 'disable_comments_tools', array( $this, 'wpupa_comments_tools_page' ) ); 73 } 74 } 75 76 /** 77 * Render the settings form for Avatar Social Picture. 78 */ 79 public function wpupa_user_admin() { 80 if( isset( $_POST['wp-avatar-add-social-picture'] ) ){ 81 $user_role = sanitize_text_field( $_POST['wp-avatar-add-social-picture'] ); 82 update_option( 'wpupa_user_role', $user_role ); 83 } 84 $user_role = get_option( 'wpupa_user_role' ); 85 86 ?> 87 <form id="wp-avatar-settings" method="post" action=""> 88 <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3> 89 <table class="form-table"> 90 <tr> 91 <th> 92 <label for="wp-avatar-capabilty">Role Required</label> 93 </th> 94 <td> 95 <select id="wp-avatar-add-social-picture" name="wp-avatar-add-social-picture"> 96 <option value="read" <?php selected( $user_role, 'read' ); ?> >Subscriber</option> 97 <option value="edit-posts" <?php selected( $user_role, 'edit-posts' ); ?> >Contributor</option> 98 <option value="edit-published-posts" <?php selected( $user_role, 'edit-published-posts' ); ?> >Author</option> 99 <option value="moderate-comments" <?php selected( $user_role, 'moderate-comments' ); ?> >Editor</option> 100 <option value="activate-plugins" <?php selected( $user_role, 'activate-plugins' ); ?> >Administrator</option> 101 </select> 102 </td> 103 </tr> 104 </table> 105 <p class="submit"> 106 <?php wp_nonce_field( 'submit', 'wp-user-profile-avatar-social' ); ?> 107 <input type="submit" class="button button-primary" id="submit" value="Save Changes"> 108 </p> 109 </form> 110 <?php 74 111 } 75 112 … … 79 116 * @since 1.0.2 80 117 */ 81 public function comments_settings_page() {118 public function wpupa_comments_settings_page() { 82 119 include 'templates/comments-settings-page.php'; 83 120 } … … 88 125 * @since 1.0.2 89 126 */ 90 function comments_tools_page() {127 function wpupa_comments_tools_page() { 91 128 include 'templates/comments-tools-page.php'; 92 129 } … … 155 192 156 193 // Custom uplaod file size 157 $wpupa_max_size = get_option( 'wp em_max_file_size' );194 $wpupa_max_size = get_option( 'wpupa_max_file_size' ); 158 195 if ( ! $wpupa_max_size ) { 159 196 $wpupa_max_size = 64 * 1024 * 1024; … … 283 320 * @since 1.0 284 321 */ 285 public function thickbox_model_view() {322 public function wpupa_thickbox_model_view() { 286 323 include_once WPUPA_PLUGIN_DIR . '/admin/templates/shortcode-popup.php'; 287 324 … … 338 375 339 376 $wpupa_max_size = (int) $_POST['wpem-upload-max-file-size-field'] * 1024 * 1024; 340 update_option( 'wp em_max_file_size', sanitize_text_field( $wpupa_max_size ) );377 update_option( 'wpupa_max_file_size', sanitize_text_field( $wpupa_max_size ) ); 341 378 wp_safe_redirect( admin_url( 'upload.php?page=wpem_upload_max_file_size&max-size-updated=true' ) ); 342 379 } … … 359 396 360 397 /** 361 * Increase max_file_size398 * return upload max file size 362 399 */ 363 400 public function wpem_upload_max_increase_upload() { 364 $wpupa_max_size = (int) get_option( 'wp em_max_file_size' );401 $wpupa_max_size = (int) get_option( 'wpupa_max_file_size' ); 365 402 366 403 if ( ! $wpupa_max_size ) { -
wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-settings.php
r3123813 r3149247 6 6 7 7 /** 8 * WPUPA_Settings class.8 * Class with User Profile Settings functions. 9 9 */ 10 10 class WPUPA_Settings { … … 39 39 $wpupa_rating = get_option( 'wpupa_rating' ); 40 40 $wpupa_file_size = get_option( 'wpupa_file_size' ); 41 $wpupa_default = get_option( ' wpupa_default' );41 $wpupa_default = get_option( 'avatar_default' ); 42 42 $wpupa_attachment_id = get_option( 'wpupa_attachment_id' ); 43 $wpupa_attachment_url = get_option('wpupa_attachment_url') ? get_option('wpupa_attachment_url') : wpupa_get_default_avatar_url(array('size' => 'admin') );43 $wpupa_attachment_url = get_option('wpupa_attachment_url') ? get_option('wpupa_attachment_url') : wpupa_get_default_avatar_url(array('size' => 'admin'), array(), ''); 44 44 $wpupa_size = get_option( 'wpupa_size' ); 45 45 $avatar_size = get_option( 'avatar_size' ); 46 46 $wpupa_hide_post_option = get_option( 'wpupa_hide_post_option' ); 47 // Get the current logged-in user object 48 $current_user = wp_get_current_user(); 49 50 // Retrieve the email of the logged-in user 51 $user_email = $current_user->user_email; 47 52 ?> 48 53 <div class="wrap"> … … 152 157 <?php $selected = ( $wpupa_default == 'wp_user_profile_avatar' ) ? 'checked="checked"' : ''; ?> 153 158 <label> 154 <input type="radio" name=" wpupa_default" id="wp_user_profile_avatar_radio" value="wp_user_profile_avatar" <?php echo esc_attr( $selected ); ?> />159 <input type="radio" name="avatar_default" id="wp_user_profile_avatar_radio" value="wp_user_profile_avatar" <?php echo esc_attr( $selected ); ?> /> 155 160 <div id="wp_user_profile_avatar_preview"> 156 161 <img src="<?php echo esc_url( $wpupa_attachment_url ); ?>" width="32" /> … … 172 177 <input type="hidden" name="wpupaattachmentid" id="wpupaattachmentid" value="<?php echo esc_attr( $wpupa_attachment_id ); ?>"> 173 178 </p> 174 179 175 180 <?php 176 181 if ( empty( $wpupa_disable_gravatar ) ) : 177 182 foreach ( wpupa_get_default_avatar() as $name => $label ) : 178 $avatar = get_avatar( '', 32, $name ); 179 $avatar_url = wpupa_get_selected_avatar_url( $name ); 180 $selected = ( $wpupa_default == $name ) ? 'checked="checked"' : ''; 181 ?> 182 <label><input type="radio" name="wpupa_default" value="<?php echo esc_attr( $name ); ?>" <?php echo esc_attr( $selected ); ?> /> 183 <img alt='' src='<?php echo esc_attr( $avatar_url ); ?>' srcset='<?php echo esc_attr( $avatar_url ); ?>' class='avatar avatar-32 photo avatar-default' height='32' width='32' loading='lazy' decoding='async'/> 184 185 <?php echo esc_attr( $label ); ?> 183 $selected = ( $wpupa_default == $name ) ? 'checked="checked"' : ''; ?> 184 <label><input type="radio" name="avatar_default" value="<?php echo esc_attr( $name ); ?>" <?php echo esc_attr( $selected ); ?> /> 185 <?php echo get_avatar( $user_email, 32, $name ); 186 echo esc_attr( $label ); ?> 186 187 </label><br /> 187 188 <?php … … 235 236 $wpupa_file_size = ! empty( $_POST['wpupa_file_size'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_file_size'] ) ) : ''; 236 237 237 $wpupa_default = ! empty( $_POST[' wpupa_default'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_default'] ) ) : '';238 $wpupa_default = ! empty( $_POST['avatar_default'] ) ? sanitize_text_field( wp_unslash( $_POST['avatar_default'] ) ) : ''; 238 239 239 240 if ( ! empty( $_POST['wpupaattachmentid'] ) ) { … … 268 269 update_option( 'wpupa_rating', $wpupa_rating ); 269 270 update_option( 'wpupa_file_size', $wpupa_file_size ); 270 update_option( ' wpupa_default', $wpupa_default );271 update_option( 'avatar_default', $wpupa_default ); 271 272 update_option( 'wpupa_attachment_id', $wpupa_attachment_id ); 272 273 update_option( 'wpupa_attachment_url', $wpupa_attachment_url); -
wp-user-profile-avatar/trunk/assets/css/frontend.css
r3123813 r3149247 209 209 width:150px; 210 210 } 211 img.avatar{ 212 width: 100px; 213 height: auto; 214 } -
wp-user-profile-avatar/trunk/assets/css/frontend.min.css
r3123813 r3149247 1 #wp-user-profile-avatar-errors,#wp-user-profile-avatar-readable-size-error,.wp-user-profile-avatar-error{color:#c00!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-success,#wp-user-profile-avatar-success,.wp-user-profile-avatar-success{color:#179a17!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-error,#wp-user-profile-avatar-undo-button,.wp-user-profile-avatar-no-avatars{display:none}#wp-user-profile-avatar-preview,#wp_user_profile_avatar_preview-existing{margin-right:10px}#wp-user-profile-avatar-preview,#wp-user-profile-avatar-thumbnail,#wp_user_profile_avatar_preview-existing,#wp_user_profile_avatar_thumbnail-existing{display:inline-block;text-align:center;vertical-align:top}#wp-user-profile-avatar-preview img,#wp-user-profile-avatar-thumbnail img,#wp_user_profile_avatar_preview-existing img,#wp_user_profile_avatar_thumbnail-existing img{max-height:96px;border:1px solid #dfdfdf;display:block}.widget_wp_user_profile_avatar #wp-user-profile-avatar-preview img,.widget_wp_user_profile_avatar #wp-user-profile-avatar-thumbnail img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_preview-existing img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_thumbnail-existing img{max-height:64px}.defaultavatarpicker #wp-user-profile-avatar-preview,.defaultavatarpicker #wp_user_profile_avatar_preview-existing{width:32px;height:32px;margin-right:0;display:inline-block;overflow:hidden;vertical-align:middle}.defaultavatarpicker #wp-user-profile-avatar-preview img,.defaultavatarpicker #wp_user_profile_avatar_preview-existing img{width:32px;height:auto;border:0}#wp-user-profile-avatar-edit #wp-user-profile-avatar-remove,#wp-user-profile-avatar-edit #wp-user-profile-avatar-undo,#wp-user-profile-avatar-edit-attachment{margin-left:10px!important}#wp-user-profile-avatar-slider{width:22.75em}#wp-user-profile-avatar-upload-messages span{display:block}.wp-user-profile-avatar-hide{display:none!important}.wp-user-profile-avatar .alignleft{float:left;margin:.3rem 2rem 2rem}.wp-user-profile-avatar .alignright{float:right;margin:.3rem 0 2rem 2rem}.wp-user-profile-avatar .aligncenter,.wp-user-profile-avatar .alignnone{margin:4rem auto;text-align:center}.author-bio-section{border:1px solid #111;padding:15px 25px;margin-top:20px}.author-bio-section .author_details{display:flex;align-items:flex-start;margin-bottom:10px}.author-bio-section .author-image{margin:10px 0}.author-bio-section .author-image img{width:100px;margin-right:15px;display:block}.author-bio-section .author-info .author-bio,.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing{margin:0}.author-bio-section .author-flex{display:grid;grid-template-columns:100px auto;align-items:center;margin-bottom:10px}.author-bio-section .author-info{margin-left:20px}.author-bio-section .author-info .author-name{font-weight:500;text-transform:capitalize}.author-bio-section .authorbox-social-icons{border-top:1px solid #111;margin:0 0 10px;padding-top:20px}.update-user-profile-avatar td,.update-user-profile-avatar th{border-color:#eee;padding:20px}.update-user-profile-avatar #wpupa_url{width:100%;max-width:500px;border-color:var(--wpem-gray-border-color);padding:10px}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button{border:1px solid var(--wpem-gray-border-color);background-color:var(--wpem-gray-bg-color);padding:10px 20px;cursor:pointer}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button:hover{background-color:var(--wpem-gray-border-color);color:var(--wpem-dark-color)}.update-user-profile-avatar #wp-user-profile-avatar-remove-button,.update-user-profile-avatar #wp-user-profile-avatar-undo-button,.update-user-profile-avatar #wp_user_profile_avatar_preview,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail{margin-bottom:0}.update-user-profile-avatar #wp_user_profile_avatar_preview img,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail img{margin-bottom:5px}#wp-user-profile-avatar-undo-button{margin-top:10px}.size-large{width:1024px;}.size-medium{width:300px;}.size-thumbnail{width:150px;} 1 #wp-user-profile-avatar-errors,#wp-user-profile-avatar-readable-size-error,.wp-user-profile-avatar-error{color:#c00!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-success,#wp-user-profile-avatar-success,.wp-user-profile-avatar-success{color:#179a17!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-error,#wp-user-profile-avatar-undo-button,.wp-user-profile-avatar-no-avatars{display:none}#wp-user-profile-avatar-preview,#wp_user_profile_avatar_preview-existing{margin-right:10px}#wp-user-profile-avatar-preview,#wp-user-profile-avatar-thumbnail,#wp_user_profile_avatar_preview-existing,#wp_user_profile_avatar_thumbnail-existing{display:inline-block;text-align:center;vertical-align:top}#wp-user-profile-avatar-preview img,#wp-user-profile-avatar-thumbnail img,#wp_user_profile_avatar_preview-existing img,#wp_user_profile_avatar_thumbnail-existing img{max-height:96px;border:1px solid #dfdfdf;display:block}.widget_wp_user_profile_avatar #wp-user-profile-avatar-preview img,.widget_wp_user_profile_avatar #wp-user-profile-avatar-thumbnail img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_preview-existing img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_thumbnail-existing img{max-height:64px}.defaultavatarpicker #wp-user-profile-avatar-preview,.defaultavatarpicker #wp_user_profile_avatar_preview-existing{width:32px;height:32px;margin-right:0;display:inline-block;overflow:hidden;vertical-align:middle}.defaultavatarpicker #wp-user-profile-avatar-preview img,.defaultavatarpicker #wp_user_profile_avatar_preview-existing img{width:32px;height:auto;border:0}#wp-user-profile-avatar-edit #wp-user-profile-avatar-remove,#wp-user-profile-avatar-edit #wp-user-profile-avatar-undo,#wp-user-profile-avatar-edit-attachment{margin-left:10px!important}#wp-user-profile-avatar-slider{width:22.75em}#wp-user-profile-avatar-upload-messages span{display:block}.wp-user-profile-avatar-hide{display:none!important}.wp-user-profile-avatar .alignleft{float:left;margin:.3rem 2rem 2rem}.wp-user-profile-avatar .alignright{float:right;margin:.3rem 0 2rem 2rem}.wp-user-profile-avatar .aligncenter,.wp-user-profile-avatar .alignnone{margin:4rem auto;text-align:center}.author-bio-section{border:1px solid #111;padding:15px 25px;margin-top:20px}.author-bio-section .author_details{display:flex;align-items:flex-start;margin-bottom:10px}.author-bio-section .author-image{margin:10px 0}.author-bio-section .author-image img{width:100px;margin-right:15px;display:block}.author-bio-section .author-info .author-bio,.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing{margin:0}.author-bio-section .author-flex{display:grid;grid-template-columns:100px auto;align-items:center;margin-bottom:10px}.author-bio-section .author-info{margin-left:20px}.author-bio-section .author-info .author-name{font-weight:500;text-transform:capitalize}.author-bio-section .authorbox-social-icons{border-top:1px solid #111;margin:0 0 10px;padding-top:20px}.update-user-profile-avatar td,.update-user-profile-avatar th{border-color:#eee;padding:20px}.update-user-profile-avatar #wpupa_url{width:100%;max-width:500px;border-color:var(--wpem-gray-border-color);padding:10px}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button{border:1px solid var(--wpem-gray-border-color);background-color:var(--wpem-gray-bg-color);padding:10px 20px;cursor:pointer}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button:hover{background-color:var(--wpem-gray-border-color);color:var(--wpem-dark-color)}.update-user-profile-avatar #wp-user-profile-avatar-remove-button,.update-user-profile-avatar #wp-user-profile-avatar-undo-button,.update-user-profile-avatar #wp_user_profile_avatar_preview,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail{margin-bottom:0}.update-user-profile-avatar #wp_user_profile_avatar_preview img,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail img{margin-bottom:5px}#wp-user-profile-avatar-undo-button{margin-top:10px}.size-large{width:1024px;}.size-medium{width:300px;}.size-thumbnail{width:150px;}img.avatar{width: 100px;height: auto;} -
wp-user-profile-avatar/trunk/includes/wp-author-box-social-info.php
r3123813 r3149247 11 11 12 12 /** 13 * Class WPUPA_User_Social_Info13 * Class contain detail of user social info 14 14 * 15 15 * Adds social contact information to user profiles and displays it in the author box. … … 21 21 */ 22 22 public function __construct() { 23 add_filter( 'user_contactmethods', [ $this, ' add_user_social_contact_info' ] );24 add_action( 'wp_enqueue_scripts', [ $this, ' enqueue_fontawesome_styles' ] );25 add_filter( 'the_content', [ $this, ' author_social_info_box' ] );23 add_filter( 'user_contactmethods', [ $this, 'wpupa_add_user_social_contact_info' ] ); 24 add_action( 'wp_enqueue_scripts', [ $this, 'wpupa_enqueue_fontawesome_styles' ] ); 25 add_filter( 'the_content', [ $this, 'wpupa_author_social_info_box' ] ); 26 26 remove_filter( 'pre_user_description', 'wp_filter_kses' ); 27 27 } … … 33 33 * @return array Modified user contact methods array. 34 34 */ 35 public function add_user_social_contact_info( $user_contact ) {35 public function wpupa_add_user_social_contact_info( $user_contact ) { 36 36 $user_contact['facebook'] = esc_html__( 'Facebook URL','wp-user-profile-avatar' ); 37 37 $user_contact['skype'] = esc_html__( 'Skype','wp-user-profile-avatar' ); … … 49 49 * Enqueue Font Awesome styles. 50 50 */ 51 public function enqueue_fontawesome_styles() {51 public function wpupa_enqueue_fontawesome_styles() { 52 52 wp_register_style( 'fontawesome', WPUPA_PLUGIN_URL . '/assets/lib/fontawesome/all.css', '', '4.4.0', 'all' ); 53 53 wp_enqueue_style( 'fontawesome' ); … … 60 60 * @return string Modified post content. 61 61 */ 62 public function author_social_info_box( $content ) {62 public function wpupa_author_social_info_box( $content ) { 63 63 global $post; 64 64 … … 86 86 $user_link_avatar = get_the_author_meta( '_wpupa_url' ); 87 87 $user_option_id = get_option( 'wpupa_attachment_id' ); 88 $user_avatar = get_option( ' wpupa_default' );88 $user_avatar = get_option( 'avatar_default' ); 89 89 90 90 if ( $user_avatar == 'gravatar_default' ) { -
wp-user-profile-avatar/trunk/includes/wp-avatar-social profile-picture.php
r3123813 r3149247 22 22 public function __construct() { 23 23 add_action( 'wp_enqueue_scripts', array( $this, 'wpupa_avatar_social_profile_picture' ) ); 24 add_action( 'admin_menu', array( $this, 'wpupa_avatar_users_menu' ) );25 24 add_action( 'show_user_profile', array( $this, 'wpupa_user_add_extra_profile_picture_fields' ) ); 26 25 add_action( 'edit_user_profile', array( $this, 'wpupa_user_add_extra_profile_picture_fields' ) ); … … 45 44 46 45 /** 47 * Add users page for Avatar Social Picture settings.48 */49 public function wpupa_avatar_users_menu() {50 add_users_page( 'Avatar Social Picture', 'Avatar Social Picture', 'activate_plugins', 'avatar-social-picture', array( $this, 'wpupa_user_admin' ) );51 }52 53 /**54 * Render the settings form for Avatar Social Picture.55 */56 public function wpupa_user_admin() {57 $wp_avatar_add_social_picture = get_option( 'wp_avatar_add_social_picture' );58 ?>59 <form id="wp-avatar-settings" method="post" action="">60 <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3>61 <table class="form-table">62 <tr>63 <th>64 <label for="wp-avatar-capabilty">Role Required</label>65 </th>66 <td>67 <select id="wp-avatar-add-social-picture" name="wp-avatar-add-social-picture">68 <option value="read" <?php selected( $wp_avatar_add_social_picture, 'read' ); ?> >Subscriber</option>69 <option value="edit-posts" <?php selected( $wp_avatar_add_social_picture, 'edit-posts' ); ?> >Contributor</option>70 <option value="edit-published-posts" <?php selected( $wp_avatar_add_social_picture, 'edit-published-posts' ); ?> >Author</option>71 <option value="moderate-comments" <?php selected( $wp_avatar_add_social_picture, 'moderate-comments' ); ?> >Editor</option>72 <option value="activate-plugins" <?php selected( $wp_avatar_add_social_picture, 'activate-plugins' ); ?> >Administrator</option>73 </select>74 </td>75 </tr>76 </table>77 <p class="submit">78 <?php wp_nonce_field( 'submit', 'wp-user-profile-avatar-social' ); ?>79 <input type="submit" class="button button-primary" id="submit" value="Save Changes">80 </p>81 </form>82 <?php83 }84 85 /**86 46 * Save the WP Avatar social profile settings. 87 47 */ … … 93 53 return; 94 54 } 95 update_user_meta( $user_id, 'wp_social_fb_profile', trim( sanitize_text_field( $_POST['fb-profile'] ) ) ); 96 update_user_meta( $user_id, 'wp_social_gplus_profile', trim( sanitize_text_field( $_POST['gplus-profile'] ) ) ); 97 update_user_meta( $user_id, 'wp_user_social_profile', sanitize_text_field( $_POST['wp-user-social-profile'] ) ); 55 // update_user_meta( $user_id, 'wp_social_fb_profile', trim( sanitize_text_field( $_POST['fb-profile'] ) ) ); 56 // update_user_meta( $user_id, 'wp_social_gplus_profile', trim( sanitize_text_field( $_POST['gplus-profile'] ) ) ); 57 // update_user_meta( $user_id, 'wp_user_social_profile', sanitize_text_field( $_POST['wp-user-social-profile'] ) ); 58 // update_user_meta( $user_id, 'wp_user_social_linkedin_profile', sanitize_text_field( $_POST['linkedin-profile'] ) ); 59 // update_user_meta( $user_id, 'wp_social_youtube_profile', sanitize_text_field( $_POST['youtube-profile'] ) ); 60 // update_user_meta( $user_id, 'wp_social_twitter_profile', sanitize_text_field( $_POST['twitter-profile'] ) ); 61 // update_user_meta( $user_id, 'wp_social_github_profile', sanitize_text_field( $_POST['github-profile'] ) ); 62 // update_user_meta( $user_id, 'wp_social_yahoo_profile', sanitize_text_field( $_POST['yahoo-profile'] ) ); 98 63 endif; 99 64 } … … 111 76 $wp_social_fb_profile = get_user_meta( $socialprofile->ID, 'wp_social_fb_profile', true ); 112 77 $wp_social_gplus_profile = get_user_meta( $socialprofile->ID, 'wp_social_gplus_profile', true ); 113 ?> 114 115 <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3> 78 $wp_social_linkedin_profile = get_user_meta( $socialprofile->ID, 'wp_user_social_linkedin_profile', true ); 79 $wp_social_youtube_profile = get_user_meta( $socialprofile->ID, 'wp_social_youtube_profile', true ); 80 $wp_social_twitter_profile = get_user_meta( $socialprofile->ID, 'wp_social_twitter_profile', true ); 81 $wp_social_github_profile = get_user_meta( $socialprofile->ID, 'wp_social_github_profile', true ); 82 $wp_social_yahoo_profile = get_user_meta( $socialprofile->ID, 'wp_social_yahoo_profile', true ); 83 ?> 84 85 <!-- <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3> 116 86 <table class="form-table"> 117 87 <tr> … … 156 126 </td> 157 127 </tr> 158 </table> 128 <tr> 129 <th> 130 <label for="linkedin-profile">LinkedIn Profile URL</label> 131 </th> 132 <td> 133 <input type="text" name="linkedin-profile" id="linkedin-profile" value="<?php echo esc_attr( $wp_social_linkedin_profile ); ?>" class="regular-text" /> 134 <span><a href="https://www.linkedin.com/" target="_blank">Visit LinkedIn</a></span> 135 </td> 136 </tr> 137 <tr> 138 <th> 139 <label for="use-linkedin-profile">Use LinkedIn Profile as Avatar</label> 140 </th> 141 <td> 142 <input type="checkbox" name="wp-user-social-profile" value="wp-linkedin" <?php checked( $wp_user_social_profile, 'wp-linkedin' ); ?> > 143 </td> 144 </tr> 145 <tr> 146 <th> 147 <label for="youtube-profile">YouTube Profile ID</label> 148 </th> 149 <td> 150 <input type="text" name="youtube-profile" id="youtube-profile" value="<?php echo esc_attr( $wp_social_youtube_profile ); ?>" class="regular-text" /> 151 <span><a href="https://www.youtube.com/" target="_blank">Visit YouTube</a></span> 152 </td> 153 </tr> 154 <tr> 155 <th> 156 <label for="use-youtube-profile">Use YouTube Profile as Avatar</label> 157 </th> 158 <td> 159 <input type="checkbox" name="wp-user-social-profile" value="wp-youtube" <?php checked( $wp_user_social_profile, 'wp-youtube' ); ?> > 160 </td> 161 </tr> 162 <tr> 163 <th> 164 <label for="twitter-profile">Twitter Username</label> 165 </th> 166 <td> 167 <input type="text" name="twitter-profile" id="twitter-profile" value="<?php echo esc_attr( $wp_social_twitter_profile ); ?>" class="regular-text" /> 168 <span><a href="https://twitter.com/" target="_blank">Visit Twitter</a></span> 169 </td> 170 </tr> 171 <tr> 172 <th> 173 <label for="use-twitter-profile">Use Twitter Profile as Avatar</label> 174 </th> 175 <td> 176 <input type="checkbox" name="wp-user-social-profile" value="wp-twitter" <?php checked( $wp_user_social_profile, 'wp-twitter' ); ?> > 177 </td> 178 </tr> 179 <tr> 180 <th> 181 <label for="github-profile">GitHub Username</label> 182 </th> 183 <td> 184 <input type="text" name="github-profile" id="github-profile" value="<?php echo esc_attr( $wp_social_github_profile ); ?>" class="regular-text" /> 185 <span><a href="https://github.com/" target="_blank">Visit GitHub</a></span> 186 </td> 187 </tr> 188 <tr> 189 <th> 190 <label for="use-github-profile">Use GitHub Profile as Avatar</label> 191 </th> 192 <td> 193 <input type="checkbox" name="wp-user-social-profile" value="wp-github" <?php checked( $wp_user_social_profile, 'wp-github' ); ?> > 194 </td> 195 </tr> 196 <tr> 197 <th> 198 <label for="yahoo-profile">Yahoo Profile ID</label> 199 </th> 200 <td> 201 <input type="text" name="yahoo-profile" id="yahoo-profile" value="<?php echo esc_attr( $wp_social_yahoo_profile ); ?>" class="regular-text" /> 202 <span><a href="https://www.yahoo.com/" target="_blank">Visit Yahoo</a></span> 203 </td> 204 </tr> 205 <tr> 206 <th> 207 <label for="use-yahoo-profile">Use Yahoo Profile as Avatar</label> 208 </th> 209 <td> 210 <input type="checkbox" name="wp-user-social-profile" value="wp-yahoo" <?php checked( $wp_user_social_profile, 'wp-yahoo' ); ?> > 211 </td> 212 </tr> 213 </table>--> 159 214 <?php 160 215 } -
wp-user-profile-avatar/trunk/includes/wp-user-profile-avatar-install.php
r3106296 r3149247 7 7 8 8 /** 9 * WPUPA_Install class.9 * Class with Installation functions. 10 10 */ 11 11 class WPUPA_Install { … … 21 21 public static function install() { 22 22 23 update_option( 'wpupa_default', esc_attr( 'mystery' ) );23 //update_option( 'avatar_default', esc_attr( 'mystery' ) ); 24 24 update_option( 'wpupa_version', esc_attr( WPUPA_VERSION ) ); 25 25 } -
wp-user-profile-avatar/trunk/includes/wp-user-profile-avatar-user.php
r3123813 r3149247 6 6 } 7 7 /** 8 * WPUPA_User class.8 * Class with User details functions . 9 9 */ 10 10 class WPUPA_User { … … 14 14 public function __construct() { 15 15 add_filter( 'get_avatar_url', array( $this, 'wpupa_get_user_avatar_url' ), 10, 3 ); 16 add_filter( 'get_avatar', array( $this, 'wpupa_integrate_user_avatar_to_bbpress_profile' ), 10, 5);16 add_filter( 'get_avatar', array( $this, 'wpupa_integrate_user_avatar_to_bbpress_profile' ), 10, 5); 17 17 } 18 18 /** 19 * wpupa_get_user_avatar_url function.19 * return user profile avatar url. 20 20 * 21 21 * @access public … … 29 29 $wpupa_show_avatars = esc_attr( get_option( 'wpupa_show_avatars' ) ); 30 30 31 $wpupa_default = esc_attr( get_option( ' wpupa_default' ) );31 $wpupa_default = esc_attr( get_option( 'avatar_default' ) ); 32 32 33 33 if ( ! $wpupa_show_avatars ) { … … 49 49 } 50 50 } 51 51 52 52 // First checking custom avatar. 53 53 if ( wpupa_check_wpupa_url( $user_id ) ) { 54 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );54 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url); 55 55 } elseif ( $wpupa_disable_gravatar ) { 56 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );56 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args , $url); 57 57 } else { 58 58 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email ); 59 59 if ( ! $has_valid_url ) { 60 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );60 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args, $url ); 61 61 } else { 62 62 if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) { 63 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );63 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url); 64 64 } 65 65 } … … 68 68 } 69 69 /** 70 * wpupa_integrate_user_avatar_to_bbpress_profile function.70 * Integrate the user profile avatar with bbpress profile function. 71 71 * 72 72 * @access public … … 75 75 * @since 1.0 76 76 */ 77 public function wpupa_integrate_user_avatar_to_bbpress_profile( $avatar, $id_or_email, $size, $default, $alt) {77 public function wpupa_integrate_user_avatar_to_bbpress_profile( $avatar, $id_or_email, $size, $default, $alt ) { 78 78 79 79 // Get the user ID 80 if ( is_numeric($id_or_email)) {81 $user_id = ( int) $id_or_email;82 } elseif ( is_object($id_or_email)) {80 if ( is_numeric( $id_or_email ) ) { 81 $user_id = ( int ) $id_or_email; 82 } elseif ( is_object( $id_or_email ) ) { 83 83 $user_id = $id_or_email->user_id; 84 84 } else { 85 $user = get_user_by( 'email', $id_or_email);85 $user = get_user_by( 'email', $id_or_email ); 86 86 $user_id = $user ? $user->ID : 0; 87 87 } … … 91 91 $image_source = wp_get_attachment_image_src( $attachment_id ); 92 92 93 if ( $image_source) {93 if ( $image_source ) { 94 94 $avatar = "<img alt='{$alt}' src='{$image_source[0]}' class='avatar avatar-{$size} photo' height='{$image_source[2]}' width='{$image_source[1]}' />"; 95 95 } -
wp-user-profile-avatar/trunk/readme.txt
r3123813 r3149247 1 1 === WP User Profile Avatar === 2 2 3 Contributors: wpeventmanager,ashokdudhat, hiteshmakvana3 Contributors: wpeventmanager,ashokdudhat,krinaydhanani 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=55FRYATTFLA5N 5 5 Tags: avatar, user profile, gravatar,custom profile photo, custom profile picture, profile photo, profile picture, author image, author photo 6 6 Requires at least: 5.8 7 7 Tested up to: 6.5.4 8 Stable tag: 1.0. 48 Stable tag: 1.0.5 9 9 Requires PHP: 8.0.2 10 10 License: GNU General Public License v3.0 … … 327 327 328 328 == Changelog == 329 330 = 1.0.5 [Sept 9th, 2024] = 331 332 Fixed: Admin profile is not display. 333 Fixed: After updating plugin user profile image as set Mystery Man image. 334 Fixed: User Profile is not update from User Profile Avatar Settings Page. 335 Fixed: Correct setting name. 336 Fixed: Delete comment - Post is unable to delete. 337 Fixed: Delete Comment - Check marked again visible in the box. 338 Fixed: Admin profile image is missing from comment. 329 339 330 340 = 1.0.4 [July 19th, 2024] = -
wp-user-profile-avatar/trunk/shortcodes/wp-author-social-info-shortcodes.php
r3123813 r3149247 16 16 17 17 /** 18 * wpupa_authorbox_social_linkfunction18 * return current user's social info authorbox function 19 19 * 20 20 * @access public -
wp-user-profile-avatar/trunk/shortcodes/wp-user-profile-avatar-shortcodes.php
r3123813 r3149247 16 16 add_shortcode( 'all_user_avatars', array( $this, 'wpupa_all_user_avatars' ) ); 17 17 18 add_action( 'wp_ajax_update_user_avatar', array( $this, ' update_user_avatar' ) );19 20 add_action( 'wp_ajax_remove_user_avatar', array( $this, ' remove_user_avatar' ) );21 22 add_action( 'wp_ajax_undo_user_avatar', array( $this, ' undo_user_avatar' ) );18 add_action( 'wp_ajax_update_user_avatar', array( $this, 'wpupa_update_user_avatar' ) ); 19 20 add_action( 'wp_ajax_remove_user_avatar', array( $this, 'wpupa_remove_user_avatar' ) ); 21 22 add_action( 'wp_ajax_undo_user_avatar', array( $this, 'wpupa_undo_user_avatar' ) ); 23 23 24 24 add_filter( 'get_avatar_url', array( $this, 'wpupa_get_user_avatar_url' ), 10, 3 ); … … 415 415 416 416 /** 417 * update_user_avatar function.417 * wpupa_update_user_avatar function. 418 418 * 419 419 * @access public … … 422 422 * @since 1.0 423 423 */ 424 public function update_user_avatar() {424 public function wpupa_update_user_avatar() { 425 425 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 426 426 … … 511 511 512 512 /** 513 * remove_user_avatar function.513 * wpupa_remove_user_avatar function. 514 514 * 515 515 * @access public … … 518 518 * @since 1.0 519 519 */ 520 public function remove_user_avatar() {520 public function wpupa_remove_user_avatar() { 521 521 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 522 522 … … 530 530 531 531 if ( $current_user_id == $user_id ) : 532 if ( isset( $user_id ) ) { 533 update_user_meta( $user_id, '_wpupa attachmentid', '' );532 if ( isset( $user_id ) ) { 533 update_user_meta( $user_id, '_wpupa_attachment_id', '' ); 534 534 update_user_meta( $user_id, '_wpupa_url', '' ); 535 535 update_user_meta( $user_id, '_wpupa_default', '' ); … … 567 567 568 568 /** 569 * undo_user_avatar function.569 * wpupa_undo_user_avatar function. 570 570 * 571 571 * @access public … … 574 574 * @since 1.0 575 575 */ 576 public function undo_user_avatar() {576 public function wpupa_undo_user_avatar() { 577 577 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 578 578 … … 587 587 if ( $current_user_id == $user_id ) : 588 588 if ( isset( $user_id ) ) { 589 update_user_meta( $user_id, '_wpupa attachmentid', '' );589 update_user_meta( $user_id, '_wpupa_attachment_id', '' ); 590 590 update_user_meta( $user_id, '_wpupa_url', '' ); 591 591 update_user_meta( $user_id, '_wpupa_default', '' ); … … 642 642 */ 643 643 public function wpupa_get_user_avatar_url( $url, $id_or_email, $args ) { 644 645 644 $wpupa_disable_gravatar = get_option( 'wpupa_disable_gravatar' ); 646 645 647 646 $wpupa_show_avatars = get_option( 'wpupa_show_avatars' ); 648 647 649 $wpupa_default = get_option( ' wpupa_default' );650 648 $wpupa_default = get_option( 'avatar_default' ); 649 651 650 if ( ! $wpupa_show_avatars ) { 652 651 return false; 653 652 } 654 653 $user_id = null; 654 if ( is_admin() ) { 655 $screen = get_current_screen(); 656 }else{ 657 $screen = array(); 658 } 655 659 if ( is_object( $id_or_email ) ) { 656 660 if ( ! empty( $id_or_email->comment_author_email ) ) { … … 658 662 } 659 663 } else { 660 if ( is_email( $id_or_email ) ) { 661 $user = get_user_by( 'email', $id_or_email ); 662 if ( $user ) { 663 $user_id = $user->ID; 664 if ( is_email( $id_or_email )) { 665 if($screen->base !== 'options-discussion' && ($screen->base !== 'admin.php' && isset($_GET['page']) && $_GET['page'] !== 'wp-user-profile-avatar')){ 666 $user = get_user_by( 'email', $id_or_email ); 667 if ( $user ) { 668 $user_id = $user->ID; 669 } 664 670 } 665 671 } else { … … 667 673 } 668 674 } 669 675 670 676 // First checking custom avatar. 671 if ( get_current_user_id() == $user_id || is_admin() ) { 672 if ( wpupa_check_wpupa_url( $user_id ) ) { 673 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 674 } elseif ( $wpupa_disable_gravatar ) { 675 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); 676 } else { 677 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email ); 678 if ( ! $has_valid_url ) { 679 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); 680 } else { 681 if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) { 682 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 677 if ( wpupa_check_wpupa_url( $user_id ) ) { 678 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url); 679 } elseif ( $wpupa_disable_gravatar ) { 680 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail', $args, $url ) ); 681 } else { 682 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email ); 683 if ( ! $has_valid_url ) { 684 if ( is_object( $screen ) && property_exists( $screen, 'base' ) ) { 685 if($screen->base !== 'profile' && $wpupa_default !== 'wp_user_profile_avatar' ){ 686 return $url; 683 687 } 684 688 } 689 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args, $url ); 690 } else { 691 if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) { 692 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url); 693 } 685 694 } 686 695 } 696 687 697 return $url; 688 698 } -
wp-user-profile-avatar/trunk/templates/wp-display-user-avatar-list.php
r3123813 r3149247 55 55 } 56 56 } else { ?> 57 <p><?php echo esc_html__( 'No avatars available' ); ?></p>57 <p><?php echo esc_html__( 'No avatars available', 'wp-user-profile-avatar' ); ?></p> 58 58 <?php } ?> 59 59 -
wp-user-profile-avatar/trunk/wp-user-profile-avatar-disable-comments.php
r3123813 r3149247 14 14 function wpupa_init_filters() { 15 15 16 $options = get_option( ' disable_comments_mode', false );16 $options = get_option( 'wpupa_disable_comments_mode', false ); 17 17 18 18 if ( is_array( $options ) && isset( $options['remove_everywhere'] ) ) { … … 33 33 function wpupa_init_wploaded_filters() { 34 34 35 $mode = get_option( ' disable_comments_mode', '' );36 $disabled_post_types = get_option( ' disabled_post_types', array() );35 $mode = get_option( 'wpupa_disable_comments_mode', '' ); 36 $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() ); 37 37 38 38 if ( ! empty( $disabled_post_types ) ) { … … 110 110 */ 111 111 function wpupa_is_post_type_disabled( $type ) { 112 $disabled_post_types = get_option( ' disabled_post_types', array() );112 $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() ); 113 113 return in_array( $type, $disabled_post_types ); 114 114 } … … 124 124 125 125 function wpupa_check_comment_template() { 126 $mode = get_option( ' disable_comments_mode', '' );126 $mode = get_option( 'wpupa_disable_comments_mode', '' ); 127 127 if ( is_singular() && ( 'remove_everywhere' === $mode || wpupa_is_post_type_disabled( get_post_type() ) ) ) { 128 128 if ( ! defined( 'DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE' ) || DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE == true ) { -
wp-user-profile-avatar/trunk/wp-user-profile-avatar-functions.php
r3123813 r3149247 74 74 'monsterid' => __( 'MonsterID (Generated)', 'wp-user-profile-avatar' ), 75 75 'retro' => __( 'Retro (Generated)', 'wp-user-profile-avatar' ), 76 'robohash' => __( 'RoboHash (Generated)' ), 76 77 ) 77 78 ); … … 79 80 } 80 81 81 if ( ! function_exists( 'wpupa_get_selected_avatar_url' ) ) {82 83 /**84 * wpupa_get_selected_avatar_url function used to retrive avatr image based on avatar.85 *86 * @access public87 * @param string88 * @return string89 * @since 1.0.290 */91 function wpupa_get_selected_avatar_url( $name ) {92 $avatar_urls = apply_filters(93 'wp_user_default_avatar_urls',94 array(95 'mystery' => 'https://2.gravatar.com/avatar/?s=32&d=mystery&r=g&forcedefault=1',96 'blank' => 'https://2.gravatar.com/avatar/?s=32&d=blank&r=g&forcedefault=1',97 'gravatar_default' => 'https://2.gravatar.com/avatar/?s=32&r=g&forcedefault=1',98 'identicon' => 'https://2.gravatar.com/avatar/?s=32&d=identicon&r=g&forcedefault=1',99 'wavatar' => 'https://2.gravatar.com/avatar/?s=32&d=wavatar&r=g&forcedefault=1',100 'monsterid' => 'https://2.gravatar.com/avatar/?s=32&d=monsterid&r=g&forcedefault=1',101 'retro' => 'https://2.gravatar.com/avatar/?s=32&d=retro&r=g&forcedefault=1',102 )103 );104 105 return $avatar_urls[ $name ];106 }107 }108 109 82 if ( ! function_exists( 'wpupa_get_default_avatar_url' ) ) { 110 83 … … 117 90 * @since 1.0 118 91 */ 119 function wpupa_get_default_avatar_url( $args = array() ) {92 function wpupa_get_default_avatar_url( $args = array(), $avatar_args = array(), $url = '') { 120 93 121 94 $size = ! empty( $args['size'] ) ? $args['size'] : 'thumbnail'; 122 95 $user_id = ! empty( $args['user_id'] ) ? $args['user_id'] : ''; 123 $wpupa_default = get_option( 'wpupa_default' );96 $wpupa_default = isset($avatar_args['default']) ? $avatar_args['default'] : get_option( 'avatar_default' ); 124 97 $avatar_size = get_option( 'avatar_size' ); 125 98 if ( $avatar_size ) { 126 99 $size = get_option( 'avatar_size' ); 127 100 } 101 if($wpupa_default !== 'wp_user_profile_avatar' ) { 102 return $url; 103 } 128 104 if ( $wpupa_default == 'wp_user_profile_avatar' || $size == 'admin' ) { 129 105 $attachment_id = get_option( 'wpupa_attachment_id' ); … … 131 107 if ( ! empty( $attachment_id ) ) { 132 108 $image_attributes = wp_get_attachment_image_src( $attachment_id, $size ); 133 134 109 if ( ! empty( $image_attributes ) ) { 135 110 return $image_attributes[0]; … … 180 155 * @since 1.0 181 156 */ 182 function wpupa_get_url( $user_id, $args = array() ) {157 function wpupa_get_url( $user_id, $args = array(), $avatar_args = array(), $url = '') { 183 158 $size = ! empty( $args['size'] ) ? $args['size'] : 'thumbnail'; 184 159 … … 210 185 'user_id' => $user_id, 211 186 'size' => $size, 212 ) 187 ), $avatar_args, $url 213 188 ); 214 189 } … … 218 193 'user_id' => $user_id, 219 194 'size' => $size, 220 ) 195 ),$avatar_args, $url 221 196 ); 222 197 } … … 262 237 $wp_user_hash_gravatar = get_option( 'wp_user_hash_gravatar' ); 263 238 264 $wpupa_default = get_option( ' wpupa_default' );239 $wpupa_default = get_option( 'avatar_default' ); 265 240 266 241 if ( trim( $wpupa_default ) != 'wp_user_profile_avatar' ) { … … 455 430 add_filter( 'upload_size_limit', 'wpupa_file_size_limit' ); 456 431 } 457 if ( ! function_exists( ' delete_comments_everywhere' ) ) {432 if ( ! function_exists( 'wpupa_delete_comments_everywhere' ) ) { 458 433 459 434 /** … … 467 442 * @since 1.0 468 443 */ 469 function delete_comments_everywhere() {444 function wpupa_delete_comments_everywhere() { 470 445 global $wpdb; 471 return $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE 1=1" ); 472 } 473 } 474 475 if ( ! function_exists( 'delete_comments_by_post_types' ) ) { 446 $result = $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE 1=1" ); 447 448 $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts}" ); 449 foreach ( $post_ids as $post_id ) { 450 wp_update_comment_count_now( $post_id ); 451 } 452 453 return $result; 454 } 455 } 456 457 if ( ! function_exists( 'wpupa_delete_comments_by_post_types' ) ) { 476 458 477 459 /** … … 485 467 * @since 1.0 486 468 */ 487 function delete_comments_by_post_types( $post_types ) {469 function wpupa_delete_comments_by_post_types( $post_types ) { 488 470 global $wpdb; 471 489 472 $post_type_placeholders = implode( "','", $post_types ); 490 return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_post_ID IN (SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s'))", $post_type_placeholders ) ); 473 474 $post_ids = $wpdb->get_col( $wpdb->prepare( 475 "SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s')", 476 $post_type_placeholders 477 )); 478 479 $result = $wpdb->query( 480 $wpdb->prepare( 481 "DELETE FROM {$wpdb->comments} WHERE comment_post_ID IN (SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s'))", 482 $post_type_placeholders 483 ) 484 ); 485 486 foreach ( $post_ids as $post_id ) { 487 wp_update_comment_count_now( $post_id ); 488 } 489 490 return $result; 491 491 } 492 492 } -
wp-user-profile-avatar/trunk/wp-user-profile-avatar.php
r3123813 r3149247 8 8 * Text Domain: wp-user-profile-avatar 9 9 * Domain Path: /languages 10 * Version: 1.0. 410 * Version: 1.0.5 11 11 * Since: 1.0.0 12 12 * Requires WordPress Version at least: 5.8 … … 22 22 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 23 23 24 /**25 * WPUPA_User_Profile_Avatar class.26 */27 24 class WPUPA_User_Profile_Avatar { 28 25 … … 58 55 59 56 // Define constants 60 define( 'WPUPA_VERSION', '1.0. 4' );57 define( 'WPUPA_VERSION', '1.0.5' ); 61 58 define( 'WPUPA_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); 62 59 define( 'WPUPA_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
Note: See TracChangeset
for help on using the changeset viewer.