Changeset 3123813
- Timestamp:
- 07/23/2024 11:06:18 AM (19 months ago)
- Location:
- wp-user-profile-avatar/trunk
- Files:
-
- 6 added
- 9 deleted
- 23 edited
-
admin/templates/comments-settings-page.php (modified) (1 diff)
-
admin/templates/comments-tools-page.php (modified) (1 diff)
-
admin/templates/wp-user-list.php (deleted)
-
admin/templates/wp-username-change.php (deleted)
-
admin/wp-user-profile-avatar-admin.php (modified) (17 diffs)
-
admin/wp-user-profile-avatar-settings.php (modified) (15 diffs)
-
assets/css/frontend.css (modified) (1 diff)
-
assets/css/frontend.min.css (modified) (1 diff)
-
assets/js/admin-avatar.js (modified) (2 diffs)
-
assets/js/admin-avatar.min.js (modified) (1 diff)
-
assets/js/frontend-avatar.js (modified) (6 diffs)
-
assets/js/frontend-avatar.min.js (modified) (1 diff)
-
assets/js/frontend-custom.js (deleted)
-
disable-comments.php (deleted)
-
external/elementor-widgets/elementor-user-profile-avatar.php (modified) (2 diffs)
-
external/external.php (modified) (1 diff)
-
includes/wp-add-new-avatar.php (added)
-
includes/wp-author-box-social-info.php (added)
-
includes/wp-avatar-social profile-picture.php (added)
-
includes/wp-user-profile-avatar-user.php (modified) (5 diffs)
-
includes/wp-username-change.php (added)
-
readme.txt (modified) (2 diffs)
-
shortcodes/wp-author-social-info-shortcodes.php (modified) (5 diffs)
-
shortcodes/wp-user-display.php (modified) (4 diffs)
-
shortcodes/wp-user-profile-avatar-shortcodes.php (modified) (27 diffs)
-
templates/wp-add-new-avatar.php (deleted)
-
templates/wp-author-box-display.php (modified) (1 diff)
-
templates/wp-author-box-social-info.php (deleted)
-
templates/wp-avatar-social profile-picture.php (deleted)
-
templates/wp-avatar-upload.php (modified) (3 diffs)
-
templates/wp-display-user-avatar-list.php (added)
-
templates/wp-display-user.php (modified) (2 diffs)
-
templates/wp-user-avatar.php (modified) (2 diffs)
-
templates/wp-user-list.php (deleted)
-
templates/wp-username-change.php (deleted)
-
wp-user-profile-avatar-disable-comments.php (added)
-
wp-user-profile-avatar-functions.php (modified) (16 diffs)
-
wp-user-profile-avatar.php (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-user-profile-avatar/trunk/admin/templates/comments-settings-page.php
r3106296 r3123813 8 8 } 9 9 10 function wpupa_update_options( $options ) { 11 update_option( 'disable_comments_options', $options ); 12 } 13 14 $typeargs = array( 'public' => true ); 15 $options = get_option( 'disable_comments_options', array() ); 16 $modified_types = array(); 17 $disabled_post_types = wpupa_get_disabled_post_types(); 18 19 if ( ! empty( $disabled_post_types ) ) { 20 foreach ( $disabled_post_types as $type ) { 21 // we need to know what native support was for later. 22 if ( post_type_supports( $type, 'comments' ) ) { 23 $modified_types[] = $type; 24 remove_post_type_support( $type, 'comments' ); 25 remove_post_type_support( $type, 'trackbacks' ); 26 } 27 } 28 } 29 $types = get_post_types( $typeargs, 'objects' ); 30 // foreach ( array_keys( $types ) as $type ) { 31 // if ( ! in_array( $type, $modified_types ) && ! post_type_supports( $type, 'comments' ) ) { // the type doesn't support comments anyway. 32 // // unset( $types[ $type ] ); 33 // } 34 // } 35 36 if ( isset( $_POST['submit'] ) ) { 37 check_admin_referer( 'disable-comments-admin' ); 38 $options['remove_everywhere'] = ( isset( $_POST['mode'] ) == 'remove_everywhere' ); 39 40 if ( $options['remove_everywhere'] ) { 41 $disabled_post_types = array_keys( $types ); 42 } else { 43 $disabled_post_types = empty( $_POST['disabled_types'] ) ? array() : (array) wp_unslash( sanitize_text_field( $_POST['disabled_types'] ) ); 44 } 45 46 $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) ); 47 48 $options['disabled_post_types'] = $disabled_post_types; 49 50 // Extra custom post types. 51 if ( ! empty( $_POST['extra_post_types'] ) ) { 52 $extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', sanitize_text_field( $_POST['extra_post_types'] ) ) ) ); 53 $options['extra_post_types'] = array_diff( $extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins. 54 } 55 56 wpupa_update_options( $options ); 57 echo '<div id="message" class="updated"><p>' . esc_html__( 'Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'wp-user-profile-avatar' ) . '</p></div>'; 58 } 59 ?> 10 ?> 60 11 <div class="wrap"> 61 12 <h1><?php echo esc_html_x( 'Disable Comments', 'settings page title', 'wp-user-profile-avatar' ); ?></h1> 62 13 <?php 14 if ( isset( $_POST['submit'] ) && isset( $_POST['disable_comments_nonce_field'] ) && wp_verify_nonce( $_POST['disable_comments_nonce_field'], 'disable_comments_nonce' ) ) { 15 16 $mode = sanitize_text_field( $_POST['mode'] ); 17 update_option( 'disable_comments_mode', $mode ); 18 19 if ( 'selected-types' === $mode && isset( $_POST['disabled_post_types'] ) && is_array( $_POST['disabled_post_types'] ) ) { 20 $disabled_post_types = array_map( 'sanitize_text_field', $_POST['disabled_post_types'] ); 21 } else { 22 $disabled_post_types = array(); 23 } 24 update_option( 'disabled_post_types', $disabled_post_types ); 25 } 26 ?> 63 27 <form action="" method="post" id="disable-comments"> 64 28 <ul> 65 <li><label for="remove_everywhere"><input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( isset( $options['remove_everywhere'] ) ); ?> /> <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: <?php esc_html_e( 'Disable all comment-related controls and settings in WordPress.', 'wp-user-profile-avatar' ); ?></label> 66 <p class="indent"><?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/' ); ?></p> 29 <li> 30 <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' ); ?> /> 32 <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: 33 <?php esc_html_e( 'Disable all comment-related controls and settings in WordPress.', 'wp-user-profile-avatar' ); ?> 34 </label> 35 <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/' ); ?> 37 </p> 67 38 </li> 68 <?php $selected = ( empty( $_POST['delete-everywhere'] ) ) ? 'checked="checked"' : ''; ?> 69 <li><label for="selected-types"><input type="radio" id="selected-types" name="mode" value="selected-types" <?php echo esc_attr( $selected ); ?> /> <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>:</label> 70 <p></p> 39 <li> 40 <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' ); ?> /> 42 <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>: 43 </label> 44 <p class="indent"><?php esc_html_e( 'Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts.', 'wp-user-profile-avatar' ); ?></p> 45 71 46 <ul class="indent" id="listoftypes"> 72 47 <?php 73 if ( isset( $options['disabled_post_types'] ) && is_array( $options['disabled_post_types'] ) ) { 74 $disabled_post_types = $options['disabled_post_types']; 75 } else { 76 $disabled_post_types = array(); 77 } 78 foreach ( $types as $k => $v ) { 79 echo "<li><label for='post-type-" . esc_attr( $k ) . "'><input type='checkbox' name='disabled_types[]' value='" . esc_attr( $k ) . "' " . checked( in_array( $k, $disabled_post_types ), true, false ) . " id='post-type-" . esc_attr( $k ) . "'> " . esc_attr( $v->labels->name ) . '</label></li>'; 48 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 49 $disabled_post_types = get_option( 'disabled_post_types', array() ); 50 foreach ( $post_types as $post_type ) { 51 ?> 52 <li> 53 <label for="post-type-<?php echo esc_attr( $post_type->name ); ?>"> 54 <input type="checkbox" name="disabled_post_types[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php checked( in_array( $post_type->name, $disabled_post_types ) ); ?> id="post-type-<?php echo esc_attr( $post_type->name ); ?>"> 55 <?php echo esc_html( $post_type->labels->name ); ?> 56 </label> 57 </li> 58 <?php 80 59 } 81 60 ?> 82 61 </ul> 83 84 <p class="indent"><?php esc_html_e( 'Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts.', 'wp-user-profile-avatar' ); ?></p>85 62 </li> 86 63 </ul> 87 88 <?php wp_nonce_field( 'disable-comments-admin' ); ?> 64 <?php wp_nonce_field( 'disable_comments_nonce', 'disable_comments_nonce_field' ); ?> 89 65 <p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"></p> 90 66 </form> 91 67 </div> 92 <script>93 jQuery(document).ready(function ($) {94 function disable_comments_uihelper() {95 var indiv_bits = $("#listoftypes, #extratypes");96 if ($("#remove_everywhere").is(":checked"))97 indiv_bits.css("color", "#888").find(":input").attr("disabled", true);98 else99 indiv_bits.css("color", "#000").find(":input").attr("disabled", false);100 }101 102 $("#disable-comments :input").change(function () {103 $("#message").slideUp();104 disable_comments_uihelper();105 });106 107 disable_comments_uihelper();108 });109 </script> -
wp-user-profile-avatar/trunk/admin/templates/comments-tools-page.php
r3106296 r3123813 8 8 exit; 9 9 } 10 function wpupa_update_options( $options ) {11 12 update_option( 'delete_comments_options', $options );13 }14 10 ?> 15 11 <div class="wrap"> 16 <h1><?php e sc_html_e( 'Delete Comments', 'wp-user-profile-avatar' ); ?></h1>12 <h1><?php echo esc_html_x( 'Delete Comments', 'settings page title', 'wp-user-profile-avatar' ); ?></h1> 17 13 <?php 18 global $wpdb; 19 $comments_count = $wpdb->get_var( "SELECT count(comment_id) from $wpdb->comments" ); 20 // if ($comments_count <= 0) { 21 ?> 22 <p><strong><?php // _e('No comments available for deletion.', 'disable-comments'); ?></strong></p> 14 if ( isset( $_POST['submit'] ) && isset( $_POST['delete_comments_nonce_field'] ) && wp_verify_nonce( $_POST['delete_comments_nonce_field'], 'delete_comments_nonce' ) ) { 15 16 $mode = sanitize_text_field( $_POST['mode'] ); 17 update_option( 'delete_comments_mode', $mode ); 23 18 24 <?php 25 // return; 26 // } 27 // if ($comments_count <= 0) { 28 ?> 29 <p><strong><?php // _e('No comments available for deletion.', 'disable-comments'); ?></strong></p> 19 if ( 'delete_everywhere' === $mode ) { 30 20 31 <?php 32 // return; 33 // } 34 $options = get_option( 'delete_comments_options', array() ); 35 $typeargs = array( 'public' => true ); 36 37 $modified_types = array(); 38 $disabled_post_types = wpupa_get_disabled_post_types(); 39 if ( ! empty( $disabled_post_types ) ) { 40 foreach ( $disabled_post_types as $type ) { 41 // we need to know what native support was for later. 42 if ( post_type_supports( $type, 'comments' ) ) { 43 $modified_types[] = $type; 44 remove_post_type_support( $type, 'comments' ); 45 remove_post_type_support( $type, 'trackbacks' ); 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() ); 24 25 } elseif ( 'selected-post-types' === $mode ) { 26 27 if ( isset( $_POST['selected_post_types'] ) && is_array( $_POST['selected_post_types'] ) && ! empty( $_POST['selected_post_types'] ) ) { 28 29 $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>'; 33 34 } 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>'; 46 37 } 47 38 } 48 39 } 49 $types = get_post_types( $typeargs, 'objects' );50 51 52 if ( isset( $_POST['delete'] ) && isset( $_POST['delete_mode'] ) ) {53 check_admin_referer( 'delete-comments-admin' );54 $options['remove_everywhere'] = ( $_POST['delete_mode'] == 'remove_everywhere' );55 56 if ( $options['remove_everywhere'] ) {57 $disabled_post_types = array_keys( $types );58 } else {59 $disabled_post_types = empty( sanitize_text_field( $_POST['delete_types'] ) ) ? array() : (array) wp_unslash( sanitize_text_field($_POST['delete_types'] ) );60 }61 62 $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) );63 64 $options['disabled_post_types'] = $disabled_post_types;65 66 // Extra custom post types.67 if ( ! empty( $_POST['extra_post_types'] ) ) {68 $extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['extra_post_types'] ) ) );69 $options['extra_post_types'] = array_diff( $extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins.70 }71 72 wpupa_update_options( $options );73 // echo '<div id="message" class="updated"><p>' . __('Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'disable-comments') . '</p></div>';74 75 if ( $_POST['delete_mode'] == 'delete-everywhere' ) {76 if ( $wpdb->query( "TRUNCATE $wpdb->commentmeta" ) != false ) {77 if ( $wpdb->query( "TRUNCATE $wpdb->comments" ) != false ) {78 $wpdb->query( "UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0" );79 $wpdb->query( "OPTIMIZE TABLE $wpdb->commentmeta" );80 $wpdb->query( "OPTIMIZE TABLE $wpdb->comments" );81 // echo "<p style='color:green'><strong>" . __('All comments have been deleted.', 'disable-comments') . '</strong></p>';82 echo '<div id="message" class="updated"><p>' . esc_html__( 'All comments have been deleted123.', 'wp-user-profile-avatar' ) . '</p></div>';83 } else {84 // echo "<p style='color:red'><strong>" . __('Internal error occured. Please try again later.', 'disable-comments') . '</strong></p>';85 echo '<div id="message" class="updated"><p>' . esc_html__( 'Internal error occured. Please try again later.', 'wp-user-profile-avatar' ) . '</p></div>';86 }87 } else {88 // echo "<p style='color:red'><strong>" . __('Internal error occured. Please try again later.', 'disable-comments') . '</strong></p>';89 echo '<div id="message" class="updated"><p>' . esc_html__( 'Internal error occured. Please try again later.', 'wp-user-profile-avatar' ) . '</p></div>';90 }91 } else {92 $delete_post_types = empty( $_POST['delete_types'] ) ? array() : wp_unslash( sanitize_text_field( $_POST['delete_types'] ) );93 $delete_post_types = array_intersect( $delete_post_types, array_keys( $types ) );94 95 // Extra custom post types.96 if ( ! empty( $_POST['delete_extra_post_types'] ) ) {97 $delete_extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', sanitize_text_field( $_POST['delete_extra_post_types']) ) ) );98 $delete_extra_post_types = array_diff( $delete_extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins.99 $delete_post_types = array_merge( $delete_post_types, $delete_extra_post_types );100 }101 102 if ( ! empty( $delete_post_types ) ) {103 // Loop through post_types and remove comments/meta and set posts comment_count to 0.104 foreach ( $delete_post_types as $delete_post_type ) {105 $wpdb->query( $wpdb->prepare( "DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = %s" , $delete_post_type ));106 $wpdb->query( $wpdb->prepare( "DELETE comments FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = %s", $delete_post_type ) );107 $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = %s", $delete_post_type ) );108 109 $post_type_object = get_post_type_object( $delete_post_type );110 $post_type_label = $post_type_object ? $post_type_object->labels->name : $delete_post_type;111 // echo "<p style='color:green'><strong>" . sprintf(__('All comments have been deleted for %s.', 'disable-comments'), $post_type_label) . '</strong></p>';112 echo '<div id="message" class="updated"><p>' . sprintf( esc_html__( 'All comments have been deleted for %s.', 'wp-user-profile-avatar' ), esc_attr( $post_type_label ) ) . '</p></div>';113 }114 115 $wpdb->query( "OPTIMIZE TABLE $wpdb->commentmeta" );116 $wpdb->query( "OPTIMIZE TABLE $wpdb->comments" );117 118 // echo "<h4 style='color:green'><strong>" . __('Comment Deletion Complete', 'disable-comments') . '</strong></h4>';119 120 }121 }122 123 $comments_count = $wpdb->get_var( "SELECT count(comment_id) from $wpdb->comments" );124 // if ($comments_count <= 0) {125 ?>126 <p><strong><?php// _e('No comments available for deletion.', 'disable-comments'); ?></strong></p>127 128 <?php129 // return;130 // }131 }132 40 ?> 133 <form action="" method="post" id="delete-comments"> 134 <ul> 135 <li> 136 137 <label for="delete_everywhere"><input type="radio" id="delete_everywhere" name="delete_mode" value="<?php echo esc_attr( 'remove_everywhere' ); ?>" <?php checked( isset( $options['remove_everywhere'] ) ); ?> /> <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: <?php esc_html_e( 'Delete all comments in WordPress.', 'wp-user-profile-avatar' ); ?></label> 138 <p class="indent"><?php printf( esc_html__( '%s: This function 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>' ); ?></p> 139 </li> 140 <?php $selected = ( empty( $_POST['delete-everywhere'] ) ) ? 'checked="checked"' : ''; ?> 141 <li><label for="selected_delete_types"><input type="radio" id="selected_delete_types" name="delete_mode" value="selected_delete_types" <?php echo esc_attr( $selected ); ?> /> <strong><?php esc_html_e( 'For certain post types', 'wp-user-profile-avatar' ); ?></strong>:</label> 142 <p></p> 143 <ul class="indent" id="listofdeletetypes"> 144 145 <?php 146 if ( isset( $options['disabled_post_types'] ) && is_array( $options['disabled_post_types'] ) ) { 147 $disabled_post_types = $options['disabled_post_types']; 148 } else { 149 $disabled_post_types = array(); 150 } 151 foreach ( $types as $k => $v ) { 152 echo "<li><label for='post-type-" . esc_attr( $k ) . "'><input type='checkbox' name='delete_types[]' value='" . esc_attr( $k ) . "' " . checked( in_array( $k, $disabled_post_types ), true, false ) . " id='post-type-" . esc_attr( $k ) . "'> " . esc_attr( $v->labels->name ) . '</label></li>'; 153 } 154 ?> 155 </ul> 156 157 <p class="indent"><?php printf( esc_html__( '%s: Deleting comments will remove existing comment entries in the database and cannot be reverted without a database backup.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>' ); ?></p> 158 </li> 159 </ul> 160 161 <?php wp_nonce_field( 'delete-comments-admin' ); ?> 162 <h4><?php esc_html_e( 'Total Comments:', 'wp-user-profile-avatar' ); ?> <?php echo esc_attr( $comments_count ); ?></h4> 163 <p class="submit"><input class="button-primary" type="submit" name="delete" value="<?php esc_html_e( 'Delete Comments', 'wp-user-profile-avatar' ); ?>"></p> 164 </form> 41 <form action="" method="post" id="delete-comments"> 42 <ul> 43 <li> 44 <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' ); ?> /> 46 <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>: 47 <?php esc_html_e( 'Delete all comments across your entire site.', 'wp-user-profile-avatar' ); ?> 48 </label> 49 <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>' ); ?> 51 </p> 52 </li> 53 <li> 54 <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' ); ?> /> 56 <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>: 57 </label> 58 <p class="indent"><?php esc_html_e( 'Deleting comments will permanently remove them from selected post types.', 'wp-user-profile-avatar' ); ?></p> 59 60 <ul class="indent" id="list-of-post-types"> 61 <?php 62 $post_types = get_post_types( array( 'public' => true ), 'objects' ); 63 $selected_post_types = get_option( 'selected_post_types', array() ); 64 foreach ( $post_types as $post_type ) { 65 ?> 66 <li> 67 <label for="post-type-<?php echo esc_attr( $post_type->name ); ?>"> 68 <input type="checkbox" name="selected_post_types[]" value="<?php echo esc_attr( $post_type->name ); ?>" <?php checked( in_array( $post_type->name, $selected_post_types ) ); ?> id="post-type-<?php echo esc_attr( $post_type->name ); ?>"> 69 <?php echo esc_html( $post_type->labels->name ); ?> 70 </label> 71 </li> 72 <?php 73 } 74 ?> 75 </ul> 76 </li> 77 </ul> 78 <?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> 80 </form> 165 81 </div> 166 <script>167 jQuery(document).ready(function ($) {168 function delete_comments_uihelper() {169 var toggle_bits = $("#listofdeletetypes, #extradeletetypes");170 if ($("#delete_everywhere").is(":checked"))171 toggle_bits.css("color", "#888").find(":input").attr("disabled", true);172 else173 toggle_bits.css("color", "#000").find(":input").attr("disabled", false);174 }175 176 $("#delete-comments :input").change(function () {177 delete_comments_uihelper();178 });179 180 delete_comments_uihelper();181 });182 </script> -
wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-admin.php
r3106296 r3123813 11 11 class WPUPA_Admin { 12 12 13 public $settings_page; 14 13 15 /** 14 16 * Constructor - get the plugin hooked in and ready … … 24 26 } 25 27 26 include_once 'templates/wp-username-change.php'; 27 add_action( 'admin_menu', array( $this, 'admin_menu' ), 12 ); 28 29 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 28 include_once plugin_dir_path(__FILE__) . '../includes/wp-username-change.php'; 29 30 add_action( 'admin_menu', array( $this, 'wpupa_admin_menu' ), 12 ); 31 32 add_action( 'admin_enqueue_scripts', array( $this, 'wpupa_admin_enqueue_scripts' ) ); 30 33 31 34 add_action( 'show_user_profile', array( $this, 'wpupa_add_fields' ) ); … … 35 38 add_action( 'edit_user_profile_update', array( $this, 'wpupa_save_fields' ) ); 36 39 37 add_action( 'admin_init', array( $this, ' allow_contributor_subscriber_uploads' ) );38 39 add_action( 'init', array( $this, ' thickbox_model_init' ) );40 add_action( 'admin_init', array( $this, 'wpupa_allow_contributor_subscriber_uploads' ) ); 41 42 add_action( 'init', array( $this, 'wpupa_thickbox_model_init' ) ); 40 43 add_action( 'wp_ajax_thickbox_model_view', array( $this, 'thickbox_model_view' ) ); 41 44 add_action( 'wp_ajax_nopriv_thickbox_model_view', array( $this, 'thickbox_model_view' ) ); 42 45 43 add_action( 'admin_init', array( $this, 'init_size' ) ); 44 } 45 46 /** 47 * admin_menu function. 48 * 49 * @access public 50 * @param 51 * @return 52 * @since 1.0 53 */ 54 public function admin_menu() { 46 add_action( 'admin_init', array( $this, 'wpupa_init_size' ) ); 47 add_action( 'admin_init', array( $this, 'wpem_enable_event_comments' ) ); 48 } 49 50 /** 51 * add admin menu page function. 52 * 53 * @access public 54 * @param 55 * @return 56 * @since 1.0 57 */ 58 public function wpupa_admin_menu() { 55 59 add_menu_page( 56 60 __( 'Profile Avatar Settings', 'wp-user-profile-avatar' ), 57 __( 'WP User Profile Av tar', 'wp-user-profile-avatar' ),61 __( 'WP User Profile Avatar', 'wp-user-profile-avatar' ), 58 62 'manage_options', 59 63 'wp-user-profile-avatar', … … 89 93 90 94 /** 91 * admin_enqueue_scriptsfunction.95 * enqueue script and style function. 92 96 * enqueue style and script for admin 93 97 * … … 97 101 * @since 1.0.0 98 102 */ 99 public function admin_enqueue_scripts() {103 public function wpupa_admin_enqueue_scripts() { 100 104 global $pagenow; 101 105 … … 122 126 123 127 /** 124 * wpupa_add_fields function.128 * add fields function. 125 129 * 126 130 * @access public … … 164 168 165 169 /** 166 * wpupa_save_fields function.170 * save the added fields function. 167 171 * 168 172 * @access public … … 205 209 206 210 $wpupa_disable_gravatar = ! empty( $_POST['wpupa-disable-gravatar'] ) ? sanitize_text_field( $_POST['wpupa-disable-gravatar'] ) : ''; 207 208 update_option( 'wpupa_tinymce', $wpupa_tinymce );209 update_option( 'wpupa_allow_upload', $wpupa_allow_upload );210 update_option( 'wpupa_disable_gravatar', $wpupa_disable_gravatar );211 211 212 212 if ( ! empty( $wpupaattachmentid ) || ! empty( $wpupa_url ) ) { … … 221 221 } 222 222 223 224 225 /** 226 * wpupa_add_buttons function. 223 /** 224 * add button function. 227 225 * 228 226 * @access public … … 240 238 241 239 /** 242 * wpupa_register_button function.240 * set register button function. 243 241 * 244 242 * @access public … … 253 251 254 252 /** 255 * wpupa_add_tinymce_plugin function.253 * add tinymice plugin function. 256 254 * 257 255 * @access public … … 266 264 267 265 /** 268 * thickbox_model_initfunction.269 * 270 * @access public 271 * @param 272 * @return 273 * @since 1.0 274 */ 275 public function thickbox_model_init() {266 * add thickbox model function. 267 * 268 * @access public 269 * @param 270 * @return 271 * @since 1.0 272 */ 273 public function wpupa_thickbox_model_init() { 276 274 add_thickbox(); 277 275 } 278 276 279 277 /** 280 * thickbox_model_viewfunction.278 * view thickbox model function. 281 279 * 282 280 * @access public … … 292 290 293 291 /** 294 * allow _contributor_uploads function.292 * allow contributors uploads function. 295 293 * ` 296 294 * … … 300 298 * @since 1.0 301 299 */ 302 public function allow_contributor_subscriber_uploads() {300 public function wpupa_allow_contributor_subscriber_uploads() { 303 301 $contributor = get_role( 'contributor' ); 304 302 $subscriber = get_role( 'subscriber' ); … … 321 319 } 322 320 } 323 324 321 } 325 322 … … 337 334 } 338 335 339 public function init_size() {336 public function wpupa_init_size() { 340 337 if ( isset( $_POST['wpem-upload-max-file-size-field'] ) ) { 341 338 … … 346 343 add_filter( 'upload_size_limit', array( $this, 'wpem_upload_max_increase_upload' ) ); 347 344 } 345 /** 346 * enable comments function. 347 * 348 * @access public 349 * @param 350 * @return 351 */ 352 public function wpem_enable_event_comments() { 353 354 $post_type = array( 'event_listing', 'event_zoom' ); 355 foreach( $post_type as $post ){ 356 add_post_type_support($post, 'comments'); 357 } 358 } 348 359 349 360 /** -
wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-settings.php
r3106296 r3123813 14 14 */ 15 15 public function __construct() { 16 add_action( 'wp_loaded', array( $this, ' edit_handler' ) );16 add_action( 'wp_loaded', array( $this, 'wpupa_edit_handler' ) ); 17 17 } 18 18 … … 41 41 $wpupa_default = get_option( 'wpupa_default' ); 42 42 $wpupa_attachment_id = get_option( 'wpupa_attachment_id' ); 43 $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')); 44 44 $wpupa_size = get_option( 'wpupa_size' ); 45 45 $avatar_size = get_option( 'avatar_size' ); … … 54 54 <td> 55 55 <form method="post" action="<?php echo esc_url( admin_url( 'admin.php' ) ) . '?page=wp-user-profile-avatar'; ?>"> 56 57 56 <table class="form-table"> 58 59 57 <tr valign="top"> 60 58 <th scope="row"><?php esc_html_e( 'Avatar Visibility', 'wp-user-profile-avatar' ); ?></th> … … 68 66 </td> 69 67 </tr> 70 71 68 <tr valign="top"> 72 69 <th scope="row"><?php esc_html_e( 'Settings', 'wp-user-profile-avatar' ); ?></th> … … 91 88 </td> 92 89 </tr> 93 94 90 <tr valign="top"> 95 91 <th scope="row"><?php esc_html_e( 'Avatar Rating', 'wp-user-profile-avatar' ); ?></th> … … 104 100 </td> 105 101 </tr> 106 107 102 <tr> 108 103 <th scope="row"> … … 148 143 </td> 149 144 </tr> 150 151 145 <tr valign="top"> 152 146 <th scope="row"><?php esc_html_e( 'Default Avatar', 'wp-user-profile-avatar' ); ?></th> … … 184 178 $avatar = get_avatar( '', 32, $name ); 185 179 $avatar_url = wpupa_get_selected_avatar_url( $name ); 186 187 180 $selected = ( $wpupa_default == $name ) ? 'checked="checked"' : ''; 188 181 ?> … … 199 192 </fieldset> 200 193 </td> 201 202 </tr> 203 194 </tr> 204 195 <tr> 205 196 <td> … … 211 202 </td> 212 203 </tr> 213 214 204 </table> 215 216 205 </form> 217 206 </td> … … 219 208 </table> 220 209 </div> 221 222 210 <?php 223 211 } 224 212 225 213 /** 226 * edit _handler function.214 * edit fields handler function. 227 215 * 228 216 * @access public … … 231 219 * @since 1.0 232 220 */ 233 public function edit_handler() {221 public function wpupa_edit_handler() { 234 222 if ( ! empty( $_POST['wp_user_profile_avatar_settings'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['_wpnonce'] ) ), 'user_profile_avatar_settings' ) ) { 235 223 $user_id = get_current_user_id(); … … 249 237 $wpupa_default = ! empty( $_POST['wpupa_default'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_default'] ) ) : ''; 250 238 251 $wpupa_attachment_id = ! empty( $_POST['wpupaattachmentid'] ) ? sanitize_text_field( $_POST['wpupaattachmentid'] ) : ''; 239 if ( ! empty( $_POST['wpupaattachmentid'] ) ) { 240 $wpupa_attachment_id = sanitize_text_field( $_POST['wpupaattachmentid'] ); 241 $wpupa_attachment_url = esc_url( wp_get_attachment_url( $wpupa_attachment_id ) ); 242 } else { 243 $wpupa_attachment_id = ''; 244 $wpupa_attachment_url = esc_url( WPUPA_PLUGIN_URL . '/assets/images/wp-user-thumbnail.png' ); 245 } 252 246 253 247 $wpupa_size = ! empty( $_POST['wpupa_size'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_size'] ) ) : ''; … … 276 270 update_option( 'wpupa_default', $wpupa_default ); 277 271 update_option( 'wpupa_attachment_id', $wpupa_attachment_id ); 272 update_option( 'wpupa_attachment_url', $wpupa_attachment_url); 278 273 update_option( 'wpupa_size', $wpupa_size ); 279 274 update_option( 'avatar_size', $avatar_size ); … … 281 276 } 282 277 } 283 284 278 } 285 279 -
wp-user-profile-avatar/trunk/assets/css/frontend.css
r3041275 r3123813 197 197 margin-bottom: 5px; 198 198 } 199 .update-user-profile-avatar#wp-user-profile-avatar-undo-button{ 200 margin-top:10px; 201 } 202 .size-large{ 203 width:1024px; 204 } 205 .size-medium{ 206 width:300px; 207 } 208 .size-thumbnail{ 209 width:150px; 210 } -
wp-user-profile-avatar/trunk/assets/css/frontend.min.css
r3041275 r3123813 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} 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;} -
wp-user-profile-avatar/trunk/assets/js/admin-avatar.js
r3041275 r3123813 5 5 init: function () 6 6 { 7 jQuery( '#wp-user-profile-avatar-add').on('click', AdminAvatar.actions.chooseAvatar);8 jQuery( '#wp-user-profile-avatar-remove').on('click', AdminAvatar.actions.removeAvatar);9 jQuery( '#wp-user-profile-avatar-undo').on('click', AdminAvatar.actions.undoAvatar);10 11 jQuery( 'body').on('click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a', AdminAvatar.actions.showShortcodeAvatarTab);12 13 jQuery( 'body').on('change', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to', AdminAvatar.actions.imageLinkTo);14 15 jQuery( 'body').on('click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn', AdminAvatar.actions.addUserAvatarShortcode);16 17 jQuery( 'body').on('click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn', AdminAvatar.actions.addUploadAvatarShortcode);18 19 if ( typeof (tinymce) != "undefined")20 { 21 tinymce.PluginManager.add( 'wp_user_profile_avatar_shortcodes', function (editor, url) {22 editor.addButton( 'wp_user_profile_avatar_shortcodes', {7 jQuery( '#wp-user-profile-avatar-add' ).off( "click" ).on( 'click', AdminAvatar.actions.chooseAvatar ); 8 jQuery( '#wp-user-profile-avatar-remove' ).off( "click" ).on( 'click', AdminAvatar.actions.removeAvatar ); 9 jQuery( '#wp-user-profile-avatar-undo' ).off( "click" ).on( 'click', AdminAvatar.actions.undoAvatar ); 10 11 jQuery( 'body' ).off("click", "#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a" ).on( 'click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a', AdminAvatar.actions.showShortcodeAvatarTab ); 12 13 jQuery( 'body' ).off( "change", "#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to" ).on( 'change', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to', AdminAvatar.actions.imageLinkTo ); 14 15 jQuery( 'body' ).off( "click", "#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn" ).on( 'click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn', AdminAvatar.actions.addUserAvatarShortcode ); 16 17 jQuery( 'body' ).off( "click", "#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn" ).on( 'click', '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn', AdminAvatar.actions.addUploadAvatarShortcode ); 18 19 if ( typeof ( tinymce ) != "undefined" ) 20 { 21 tinymce.PluginManager.add( 'wp_user_profile_avatar_shortcodes', function ( editor, url ) { 22 editor.addButton( 'wp_user_profile_avatar_shortcodes', { 23 23 title: wp_user_profile_avatar_admin_avatar.icon_title, 24 24 classes: 'thickbox', … … 31 31 }); 32 32 33 setTimeout( function () {34 jQuery( '.mce-thickbox button').remove();35 jQuery( '.mce-thickbox').html('<a href="' + wp_user_profile_avatar_admin_avatar.thinkbox_ajax_url + '" class="thickbox mce-toolbar" title="' + wp_user_profile_avatar_admin_avatar.thinkbox_title + '"><img class="mce-ico" src="' + wp_user_profile_avatar_admin_avatar.default_avatar + '"></a>');36 }, 1500 );33 setTimeout( function () { 34 jQuery( '.mce-thickbox button' ).remove(); 35 jQuery( '.mce-thickbox' ).html( '<a href="' + wp_user_profile_avatar_admin_avatar.thinkbox_ajax_url + '" class="thickbox mce-toolbar" title="' + wp_user_profile_avatar_admin_avatar.thinkbox_title + '"><img class="mce-ico" src="' + wp_user_profile_avatar_admin_avatar.default_avatar + '"></a>' ); 36 }, 1500 ); 37 37 } 38 39 38 }, 40 41 39 actions: 40 { 41 /** 42 * showShortcodeAvatarTab function. 43 * 44 * @access public 45 * @param 46 * @return 47 * @since 1.0 48 */ 49 showShortcodeAvatarTab: function ( event ) 50 { 51 jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left .settings-panel' ).hide(); 52 53 var id = jQuery(event.target).attr('href'); 54 55 jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left ' + id ).show(); 56 }, 57 58 /** 59 * imageLinkTo function. 60 * 61 * @access public 62 * @param 63 * @return 64 * @since 1.0 65 */ 66 imageLinkTo: function ( event ) 67 { 68 var link_to = jQuery( event.target ).val(); 69 70 if ( link_to == 'custom' ) 42 71 { 43 /** 44 * showShortcodeAvatarTab function. 45 * 46 * @access public 47 * @param 48 * @return 49 * @since 1.0 50 */ 51 showShortcodeAvatarTab: function (event) 52 { 53 jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left .settings-panel').hide(); 54 55 var id = jQuery(event.target).attr('href'); 56 57 jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left ' + id).show(); 72 jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to' ).attr( 'type', 'text' ); 73 } else 74 { 75 jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to' ).attr( 'type', 'hidden' ); 76 } 77 }, 78 79 /** 80 * addUserAvatarShortcode function. 81 * 82 * @access public 83 * @param 84 * @return 85 * @since 1.0 86 */ 87 addUserAvatarShortcode: function ( event ) 88 { 89 var user_id = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-user-id' ).val(); 90 91 var size = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-size' ).val(); 92 93 var align = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-alignment' ).val(); 94 95 var link = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to' ).val(); 96 97 var custom_link = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to' ).val(); 98 99 var target = ''; 100 if (jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window' ).prop( "checked" ) == true ) 101 { 102 target = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window' ).val(); 103 } 104 105 var caption = jQuery( 'body' ).find( '#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-caption').val(); 106 107 var user_tag = ( user_id != "" ) ? ' user_id="' + user_id + '"' : ""; 108 109 var size_tag = ( size != "" ) ? ' size="' + size + '"' : ""; 110 111 var align_tag = ( align != "" ) ? ' align="' + align + '"' : ""; 112 113 var link_tag = ( link != "" && link != 'custom' && custom_link == "" ) ? ' link="' + link + '"' : ""; 114 link_tag = ( custom_link != "" ) ? ' link="' + custom_link + '"' : link_tag; 115 116 var target_tag = ( target != "" ) ? ' target="' + target + '"' : ""; 117 118 var shortcode = "<p>[user_profile_avatar" + user_tag + size_tag + align_tag + link_tag + target_tag + "] " + caption + " [/user_profile_avatar]</p>"; 119 120 tinymce.activeEditor.insertContent( shortcode ); 121 122 jQuery( 'body' ).find( '#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton' ).trigger( "click" ); 123 }, 124 125 /** 126 * addUploadAvatarShortcode function. 127 * 128 * @access public 129 * @param 130 * @return 131 * @since 1.0 132 */ 133 addUploadAvatarShortcode: function ( event ) 134 { 135 var shortcode = "<p>[user_profile_avatar_upload]</p>"; 136 137 tinymce.activeEditor.insertContent( shortcode ); 138 139 jQuery( 'body' ).find( '#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton' ).trigger("click"); 140 }, 141 142 /** 143 * chooseAvatar function. 144 * 145 * @access public 146 * @param 147 * @return 148 * @since 1.0 149 */ 150 chooseAvatar: function ( event ) 151 { 152 var upload = wp.media({ 153 library: { 154 type: 'image' 58 155 }, 59 60 /** 61 * imageLinkTo function. 62 * 63 * @access public 64 * @param 65 * @return 66 * @since 1.0 67 */ 68 imageLinkTo: function (event) 69 { 70 var link_to = jQuery(event.target).val(); 71 72 if (link_to == 'custom') 156 title: wp_user_profile_avatar_admin_avatar.media_box_title, 157 multiple: false 158 }) 159 .on( 'select', function () 73 160 { 74 jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to').attr('type', 'text'); 75 } else 76 { 77 jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to').attr('type', 'hidden'); 78 } 79 }, 80 81 /** 82 * addUserAvatarShortcode function. 83 * 84 * @access public 85 * @param 86 * @return 87 * @since 1.0 88 */ 89 addUserAvatarShortcode: function (event) 90 { 91 var user_id = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-user-id').val(); 92 93 var size = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-size').val(); 94 95 var align = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-alignment').val(); 96 97 var link = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to').val(); 98 99 var custom_link = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to').val(); 100 101 var target = ''; 102 if (jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window').prop("checked") == true) 103 { 104 target = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window').val(); 105 } 106 107 var caption = jQuery('body').find('#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-caption').val(); 108 109 var user_tag = (user_id != "") ? ' user_id="' + user_id + '"' : ""; 110 111 var size_tag = (size != "") ? ' size="' + size + '"' : ""; 112 113 var align_tag = (align != "") ? ' align="' + align + '"' : ""; 114 115 var link_tag = (link != "" && link != 'custom' && custom_link == "") ? ' link="' + link + '"' : ""; 116 link_tag = (custom_link != "") ? ' link="' + custom_link + '"' : link_tag; 117 118 var target_tag = (target != "") ? ' target="' + target + '"' : ""; 119 120 var shortcode = "<p>[user_profile_avatar" + user_tag + size_tag + align_tag + link_tag + target_tag + "] " + caption + " [/user_profile_avatar]</p>"; 121 122 tinymce.activeEditor.insertContent(shortcode); 123 //editor.insertContent('[wdm_shortcode]'); 124 125 jQuery('body').find('#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton').trigger("click"); 126 }, 127 128 /** 129 * addUploadAvatarShortcode function. 130 * 131 * @access public 132 * @param 133 * @return 134 * @since 1.0 135 */ 136 addUploadAvatarShortcode: function (event) 137 { 138 var shortcode = "<p>[user_profile_avatar_upload]</p>"; 139 140 tinymce.activeEditor.insertContent(shortcode); 141 //editor.insertContent('[wdm_shortcode]'); 142 143 jQuery('body').find('#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton').trigger("click"); 144 }, 145 146 /** 147 * chooseAvatar function. 148 * 149 * @access public 150 * @param 151 * @return 152 * @since 1.0 153 */ 154 chooseAvatar: function (event) 155 { 156 var upload = wp.media({ 157 library: { 158 type: 'image' 159 }, 160 title: wp_user_profile_avatar_admin_avatar.media_box_title, /*Title for Media Box*/ 161 multiple: false /*For limiting multiple image*/ 161 var select = upload.state().get( 'selection' ); 162 var attach = select.first().toJSON(); 163 164 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', attach.url ); 165 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', attach.url ); 166 jQuery( '#wpupaattachmentid' ).attr( 'value', attach.id ); 167 jQuery( '#wp_user_profile_avatar_radio' ).trigger( 'click' ); 168 jQuery( '#wp-user-profile-avatar-undo-button' ).show(); 162 169 }) 163 .on('select', function () 164 { 165 var select = upload.state().get('selection'); 166 var attach = select.first().toJSON(); 167 168 jQuery('#wp-user-profile-avatar-preview img').attr('src', attach.url); 169 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', attach.url); 170 jQuery('#wpupaattachmentid').attr('value', attach.id); 171 jQuery('#wp_user_profile_avatar_radio').trigger('click'); 172 jQuery('#wp-user-profile-avatar-undo-button').show(); 173 }) 174 .open(); 175 }, 176 177 /** 178 * removeAvatar function. 179 * 180 * @access public 181 * @param 182 * @return 183 * @since 1.0 184 */ 185 removeAvatar: function (event) 186 { 187 jQuery('#wp-user-profile-avatar-preview img').attr('src', wp_user_profile_avatar_admin_avatar.default_avatar); 188 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', wp_user_profile_avatar_admin_avatar.default_avatar); 189 jQuery('#wpupaattachmentid').attr('value', ''); 190 jQuery('#wpupa-url').attr('value', ''); 191 192 jQuery('#wp-user-profile-avatar-remove').hide(); 193 }, 194 195 /** 196 * undoAvatar function. 197 * 198 * @access public 199 * @param 200 * @return 201 * @since 1.0 202 */ 203 undoAvatar: function (event) 204 { 205 jQuery('#wp-user-profile-avatar-preview img').attr('src', wp_user_profile_avatar_admin_avatar.default_avatar); 206 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', wp_user_profile_avatar_admin_avatar.default_avatar); 207 jQuery('#wpupaattachmentid').attr('value', ''); 208 209 jQuery('#wp-user-profile-avatar-undo-button').hide(); 210 }, 211 212 } /* end of action */ 213 170 .open(); 171 }, 172 173 /** 174 * removeAvatar function. 175 * 176 * @access public 177 * @param 178 * @return 179 * @since 1.0 180 */ 181 removeAvatar: function ( event ) 182 { 183 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', wp_user_profile_avatar_admin_avatar.default_avatar ); 184 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', wp_user_profile_avatar_admin_avatar.default_avatar ); 185 jQuery( '#wpupaattachmentid' ).attr( 'value', '' ); 186 jQuery( '#wpupa-url' ).attr( 'value', '' ); 187 188 jQuery( '#wp-user-profile-avatar-remove' ).hide(); 189 }, 190 191 /** 192 * undoAvatar function. 193 * 194 * @access public 195 * @param 196 * @return 197 * @since 1.0 198 */ 199 undoAvatar: function ( event ) 200 { 201 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', wp_user_profile_avatar_admin_avatar.default_avatar ); 202 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', wp_user_profile_avatar_admin_avatar.default_avatar ); 203 jQuery( '#wpupaattachmentid' ).attr( 'value', '' ); 204 205 jQuery( '#wp-user-profile-avatar-undo-button' ).hide(); 206 }, 207 208 } /* end of action */ 214 209 }; /* enf of return */ 215 216 210 }; /* end of class */ 217 211 218 212 AdminAvatar = AdminAvatar(); 219 213 220 jQuery( document).ready(function ($)214 jQuery( document ).ready( function ($) 221 215 { 222 216 AdminAvatar.init(); -
wp-user-profile-avatar/trunk/assets/js/admin-avatar.min.js
r3012437 r3123813 1 var AdminAvatar=(AdminAvatar=function(){return{init:function(){jQuery("#wp-user-profile-avatar-add").o n("click",AdminAvatar.actions.chooseAvatar),jQuery("#wp-user-profile-avatar-remove").on("click",AdminAvatar.actions.removeAvatar),jQuery("#wp-user-profile-avatar-undo").on("click",AdminAvatar.actions.undoAvatar),jQuery("body").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a",AdminAvatar.actions.showShortcodeAvatarTab),jQuery("body").on("change","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to",AdminAvatar.actions.imageLinkTo),jQuery("body").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn",AdminAvatar.actions.addUserAvatarShortcode),jQuery("body").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn",AdminAvatar.actions.addUploadAvatarShortcode),"undefined"!=typeof tinymce&&(tinymce.PluginManager.add("wp_user_profile_avatar_shortcodes",function(a,r){a.addButton("wp_user_profile_avatar_shortcodes",{title:wp_user_profile_avatar_admin_avatar.icon_title,classes:"thickbox",image:wp_user_profile_avatar_admin_avatar.default_avatar,icon:!1,onclick:function(){}})}),setTimeout(function(){jQuery(".mce-thickbox button").remove(),jQuery(".mce-thickbox").html('<a href="'+wp_user_profile_avatar_admin_avatar.thinkbox_ajax_url+'" class="thickbox mce-toolbar" title="'+wp_user_profile_avatar_admin_avatar.thinkbox_title+'"><img class="mce-ico" src="'+wp_user_profile_avatar_admin_avatar.default_avatar+'"></a>')},1500))},actions:{showShortcodeAvatarTab:function(a){jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left .settings-panel").hide();a=jQuery(a.target).attr("href");jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left "+a).show()},imageLinkTo:function(a){"custom"==jQuery(a.target).val()?jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").attr("type","text"):jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").attr("type","hidden")},addUserAvatarShortcode:function(a){var r=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-user-id").val(),t=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp_image_size").val(),e=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-alignment").val(),o=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to").val(),i=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").val(),_="";1==jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window").prop("checked")&&(_=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window").val());o=""!=o&&"custom"!=o&&""==i?' link="'+o+'"':"",_="<p>[user_profile_avatar"+(""!=r?' user_id="'+r+'"':"")+(""!=t?' size="'+t+'"':"")+(""!=e?' align="'+e+'"':"")+(o=""!=i?' link="'+i+'"':o)+(""!=_?' target="'+_+'"':"")+"] "+jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-caption").val()+" [/user_profile_avatar]</p>";tinymce.activeEditor.insertContent(_),jQuery("body").find("#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton").trigger("click")},addUploadAvatarShortcode:function(a){tinymce.activeEditor.insertContent("<p>[user_profile_avatar_upload]</p>"),jQuery("body").find("#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton").trigger("click")},chooseAvatar:function(a){var r=wp.media({library:{type:"image"},title:wp_user_profile_avatar_admin_avatar.media_box_title,multiple:!1}).on("select",function(){var a=r.state().get("selection").first().toJSON();jQuery("#wp_user_profile_avatar_preview img").attr("src",a.url),jQuery("#wp_user_profile_avatar_thumbnail img").attr("src",a.url),jQuery("#wpupaattachmentid").attr("value",a.id),jQuery("#wp_user_profile_avatar_radio").trigger("click"),jQuery("#wp-user-profile-avatar-undo-button").show()}).open()},removeAvatar:function(a){jQuery("#wp_user_profile_avatar_preview img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wp_user_profile_avatar_thumbnail img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wpupaattachmentid").attr("value",""),jQuery("#wpupa_url").attr("value",""),jQuery("#wp-user-profile-avatar-remove").hide()},undoAvatar:function(a){jQuery("#wp_user_profile_avatar_preview img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wp_user_profile_avatar_thumbnail img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wpupaattachmentid").attr("value",""),jQuery("#wp-user-profile-avatar-undo-button").hide()}}}})();jQuery(document).ready(function(a){AdminAvatar.init()});1 var AdminAvatar=(AdminAvatar=function(){return{init:function(){jQuery("#wp-user-profile-avatar-add").off("click").on("click",AdminAvatar.actions.chooseAvatar),jQuery("#wp-user-profile-avatar-remove").off("click").on("click",AdminAvatar.actions.removeAvatar),jQuery("#wp-user-profile-avatar-undo").off("click").on("click",AdminAvatar.actions.undoAvatar),jQuery("body").off("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .nav-tab-wrapper a",AdminAvatar.actions.showShortcodeAvatarTab),jQuery("body").off("change","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to").on("change","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to",AdminAvatar.actions.imageLinkTo),jQuery("body").off("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #user-avatar-form-btn",AdminAvatar.actions.addUserAvatarShortcode),jQuery("body").off("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn").on("click","#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-upload-avatar #upload-avatar-form-btn",AdminAvatar.actions.addUploadAvatarShortcode),"undefined"!=typeof tinymce&&(tinymce.PluginManager.add("wp_user_profile_avatar_shortcodes",function(a,r){a.addButton("wp_user_profile_avatar_shortcodes",{title:wp_user_profile_avatar_admin_avatar.icon_title,classes:"thickbox",image:wp_user_profile_avatar_admin_avatar.default_avatar,icon:!1,onclick:function(){}})}),setTimeout(function(){jQuery(".mce-thickbox button").remove(),jQuery(".mce-thickbox").html('<a href="'+wp_user_profile_avatar_admin_avatar.thinkbox_ajax_url+'" class="thickbox mce-toolbar" title="'+wp_user_profile_avatar_admin_avatar.thinkbox_title+'"><img class="mce-ico" src="'+wp_user_profile_avatar_admin_avatar.default_avatar+'"></a>')},1500))},actions:{showShortcodeAvatarTab:function(a){jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left .settings-panel").hide();a=jQuery(a.target).attr("href");jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap .admin-setting-left "+a).show()},imageLinkTo:function(a){"custom"==jQuery(a.target).val()?jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").attr("type","text"):jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").attr("type","hidden")},addUserAvatarShortcode:function(a){var r=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-user-id").val(),t=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-size").val(),e=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-alignment").val(),o=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-link-to").val(),i=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-custom-link-to").val(),_="";1==jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window").prop("checked")&&(_=jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-open-new-window").val());o=""!=o&&"custom"!=o&&""==i?' link="'+o+'"':"",_="<p>[user_profile_avatar"+(""!=r?' user_id="'+r+'"':"")+(""!=t?' size="'+t+'"':"")+(""!=e?' align="'+e+'"':"")+(o=""!=i?' link="'+i+'"':o)+(""!=_?' target="'+_+'"':"")+"] "+jQuery("body").find("#TB_window #TB_ajaxContent .wp-user-profile-avatar-shortcode-wrap #settings-user-avatar #wp-image-caption").val()+" [/user_profile_avatar]</p>";tinymce.activeEditor.insertContent(_),console.log(_),jQuery("body").find("#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton").trigger("click")},addUploadAvatarShortcode:function(a){tinymce.activeEditor.insertContent("<p>[user_profile_avatar_upload]</p>"),jQuery("body").find("#TB_window #TB_title #TB_closeAjaxWindow #TB_closeWindowButton").trigger("click")},chooseAvatar:function(a){var r=wp.media({library:{type:"image"},title:wp_user_profile_avatar_admin_avatar.media_box_title,multiple:!1}).on("select",function(){var a=r.state().get("selection").first().toJSON();jQuery("#wp-user-profile-avatar-preview img").attr("src",a.url),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",a.url),console.log(a),jQuery("#wpupaattachmentid").attr("value",a.id),jQuery("#wp_user_profile_avatar_radio").trigger("click"),jQuery("#wp-user-profile-avatar-undo-button").show()}).open()},removeAvatar:function(a){jQuery("#wp-user-profile-avatar-preview img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wpupaattachmentid").attr("value",""),jQuery("#wpupa_url").attr("value",""),jQuery("#wp-user-profile-avatar-remove").hide()},undoAvatar:function(a){jQuery("#wp-user-profile-avatar-preview img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",wp_user_profile_avatar_admin_avatar.default_avatar),jQuery("#wpupaattachmentid").attr("value",""),jQuery("#wp-user-profile-avatar-undo-button").hide()}}}})();jQuery(document).ready(function(a){AdminAvatar.init()}); -
wp-user-profile-avatar/trunk/assets/js/frontend-avatar.js
r3106296 r3123813 5 5 init: function () 6 6 { 7 jQuery('#wp-user-profile-avatar-add').o n('click', FrontendAvatar.actions.chooseAvatar);8 jQuery('#wp-user-profile-avatar-remove').o n('click', FrontendAvatar.actions.removeAvatar);9 jQuery('#wp-user-profile-avatar-undo').o n('click', FrontendAvatar.actions.undoAvatar);10 jQuery('#wp-user-profile-avatar-update-profile').o n('click', FrontendAvatar.actions.updateAvatar);7 jQuery('#wp-user-profile-avatar-add').off("click").on('click', FrontendAvatar.actions.chooseAvatar); 8 jQuery('#wp-user-profile-avatar-remove').off("click").on('click', FrontendAvatar.actions.removeAvatar); 9 jQuery('#wp-user-profile-avatar-undo').off("click").on('click', FrontendAvatar.actions.undoAvatar); 10 jQuery('#wp-user-profile-avatar-update-profile').off("click").on('click', FrontendAvatar.actions.updateAvatar); 11 11 }, 12 12 … … 23 23 chooseAvatar: function (event) 24 24 { 25 var file_frame; 26 event.preventDefault(); 27 // if the file_frame has already been created, just reuse it 28 if (file_frame) { 29 file_frame.open(); 30 return; 31 } 25 var upload = wp.media({ 26 library: { 27 type: 'image' 28 }, 29 title: wp_user_profile_avatar_frontend_avatar.media_box_title, 30 multiple: false 31 }) 32 .on( 'select', function () 33 { 34 var select = upload.state().get( 'selection' ); 35 var attach = select.first().toJSON(); 32 36 33 file_frame = wp.media.frames.file_frame = wp.media({ 34 title: jQuery(this).data('uploader_title'), 35 button: { 36 text: jQuery(this).data('uploader_button_text'), 37 }, 38 multiple: false // set this to true for multiple file selection 39 }); 40 file_frame.on('select', function () { 41 attachment = file_frame.state().get('selection').first().toJSON(); 42 console.log(attachment); 43 // do something with the file here 44 jQuery('#wpupaattachmentid').attr('value', attachment.id); 45 jQuery('#wp-user-profile-avatar-preview img').attr('src', attachment.sizes['full']['url']); 46 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', attachment.sizes['thumbnail']['url']); 47 }); 48 file_frame.open(); 37 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', attach.url ); 38 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', attach.url ); 39 jQuery( '#wpupaattachmentid' ).attr( 'value', attach.id ); 40 jQuery( '#wp_user_profile_avatar_radio' ).trigger( 'click' ); 41 jQuery( '#wp-user-profile-avatar-undo-button' ).show(); 42 }) 43 .open(); 49 44 }, 50 45 /** … … 58 53 removeAvatar: function (event) 59 54 { 60 jQuery('#upload-avatar-responce').removeClass('wp-user-profile-avatar-error'); 61 jQuery('#upload-avatar-responce').removeClass('wp-user-profile-avatar-success'); 62 jQuery('#upload-avatar-responce').html(''); 55 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 56 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 57 jQuery( '#wpupaattachmentid' ).attr( 'value', '' ); 58 jQuery( '#wpupa-url' ).attr( 'value', '' ); 63 59 64 var form_data = jQuery('.update-user-profile-avatar').serialize(); 65 66 var fd = new FormData(); 67 fd.append("action", 'remove_user_avatar'); 68 fd.append("form_data", form_data); 69 fd.append("security", wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security); 70 71 jQuery.ajax({ 72 url: wp_user_profile_avatar_frontend_avatar.ajax_url, 73 type: 'post', 74 dataType: 'JSON', 75 data: fd, 76 processData: false, 77 contentType: false, 78 success: function (responce) 79 { 80 jQuery('#upload-avatar-responce').addClass(responce.class); 81 //jQuery('#upload-avatar-responce').html(responce.message); 82 83 if (responce.class == 'wp-user-profile-avatar-success') 84 { 85 jQuery('#wp-user-profile-avatar-preview img').attr('src', responce.avatar_original); 86 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', responce.avatar_thumbnail); 87 88 jQuery('.update-user-profile-avatar #wpupa-url').val(''); 89 jQuery('.update-user-profile-avatar #wpupaattachmentid').val(''); 90 jQuery('#wp-user-profile-avatar-remove-button').hide(); 91 } 92 } 93 }); 60 jQuery( '#wp-user-profile-avatar-remove' ).hide(); 94 61 }, 95 62 … … 104 71 undoAvatar: function (event) 105 72 { 106 jQuery( '#upload-avatar-responce').removeClass('wp-user-profile-avatar-error');107 jQuery( '#upload-avatar-responce').removeClass('wp-user-profile-avatar-success');108 jQuery( '#upload-avatar-responce').html('');73 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 74 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 75 jQuery( '#wpupaattachmentid' ).attr( 'value', '' ); 109 76 110 var form_data = jQuery('.update-user-profile-avatar').serialize(); 111 112 var fd = new FormData(); 113 fd.append("action", 'undo_user_avatar'); 114 fd.append("form_data", form_data); 115 fd.append("security", wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security); 116 117 jQuery.ajax({ 118 url: wp_user_profile_avatar_frontend_avatar.ajax_url, 119 type: 'post', 120 dataType: 'JSON', 121 data: fd, 122 processData: false, 123 contentType: false, 124 success: function (responce) 125 { 126 jQuery('#upload-avatar-responce').addClass(responce.class); 127 jQuery('#upload-avatar-responce').html(responce.message); 128 129 if (responce.class == 'wp-user-profile-avatar-success') 130 { 131 jQuery('#wp-user-profile-avatar-preview img').attr('src', responce.avatar_original); 132 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', responce.avatar_thumbnail); 133 134 jQuery('#wp-user-profile-avatar-undo-button').hide(); 135 } 136 } 137 }); 77 jQuery( '#wp-user-profile-avatar-undo-button' ).hide(); 78 jQuery('#update-user-profile-avatar').trigger('reset'); 138 79 }, 139 80 … … 169 110 success: function (responce) 170 111 { 171 console.log(responce);172 112 jQuery('#upload-avatar-responce').addClass(responce.class); 173 113 jQuery('#upload-avatar-responce').html(responce.message); … … 178 118 jQuery('#wp-user-profile-avatar-thumbnail img').attr('src', responce.avatar_thumbnail); 179 119 jQuery('#update-user-profile-avatar').trigger('reset'); 180 //jQuery('#wp-user-profile-avatar-undo-button').show(); 120 jQuery('#wpupaattachmentid').val(response.form_wpupaattachmentid); 121 122 if (response.form_wpupaattachmentid == '0') { 123 jQuery('#wp-user-profile-avatar-remove-button').hide(); 124 jQuery( '#wp-user-profile-avatar-preview img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 125 jQuery( '#wp-user-profile-avatar-thumbnail img' ).attr( 'src', wp_user_profile_avatar_frontend_avatar.default_avatar ); 126 127 } else { 128 jQuery('#wp-user-profile-avatar-remove-button').show(); 129 } 181 130 } 182 183 131 location.reload(); 184 132 } 185 133 }); 186 187 134 }, 188 189 135 } /* end of action */ 190 191 136 }; /* enf of return */ 192 193 137 }; /* end of class */ 194 138 -
wp-user-profile-avatar/trunk/assets/js/frontend-avatar.min.js
r3106296 r3123813 1 var FrontendAvatar=function(){return{init:function(){jQuery( "#wp-user-profile-avatar-add").on("click",FrontendAvatar.actions.chooseAvatar),jQuery("#wp-user-profile-avatar-remove").on("click",FrontendAvatar.actions.removeAvatar),jQuery("#wp-user-profile-avatar-undo").on("click",FrontendAvatar.actions.undoAvatar),jQuery("#wp-user-profile-avatar-update-profile").on("click",FrontendAvatar.actions.updateAvatar)},actions:{chooseAvatar:function(a){var r;if(a.preventDefault(),r){r.open();return}(r=wp.media.frames.file_frame=wp.media({title:jQuery(this).data("uploader_title"),button:{text:jQuery(this).data("uploader_button_text")},multiple:!1})).on("select",function(){attachment=r.state().get("selection").first().toJSON(),console.log(attachment),jQuery("#wpupaattachmentid").attr("value",attachment.id),jQuery("#wp-user-profile-avatar-preview img").attr("src",attachment.sizes.full.url),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",attachment.sizes.thumbnail.url)}),r.open()},removeAvatar:function(a){jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-error"),jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-success"),jQuery("#upload-avatar-responce").html("");var r=jQuery(".update-user-profile-avatar").serialize(),e=new FormData;e.append("action","remove_user_avatar"),e.append("form_data",r),e.append("security",wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security),jQuery.ajax({url:wp_user_profile_avatar_frontend_avatar.ajax_url,type:"post",dataType:"JSON",data:e,processData:!1,contentType:!1,success:function(a){jQuery("#upload-avatar-responce").addClass(a.class),"wp-user-profile-avatar-success"==a.class&&(jQuery("#wp-user-profile-avatar-preview img").attr("src",a.avatar_original),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",a.avatar_thumbnail),jQuery(".update-user-profile-avatar #wpupa-url").val(""),jQuery(".update-user-profile-avatar #wpupaattachmentid").val(""),jQuery("#wp-user-profile-avatar-remove-button").hide())}})},undoAvatar:function(a){jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-error"),jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-success"),jQuery("#upload-avatar-responce").html("");var r=jQuery(".update-user-profile-avatar").serialize(),e=new FormData;e.append("action","undo_user_avatar"),e.append("form_data",r),e.append("security",wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security),jQuery.ajax({url:wp_user_profile_avatar_frontend_avatar.ajax_url,type:"post",dataType:"JSON",data:e,processData:!1,contentType:!1,success:function(a){jQuery("#upload-avatar-responce").addClass(a.class),jQuery("#upload-avatar-responce").html(a.message),"wp-user-profile-avatar-success"==a.class&&(jQuery("#wp-user-profile-avatar-preview img").attr("src",a.avatar_original),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",a.avatar_thumbnail),jQuery("#wp-user-profile-avatar-undo-button").hide())}})},updateAvatar:function(a){jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-error"),jQuery("#upload-avatar-responce").removeClass("wp-user-profile-avatar-success"),jQuery("#upload-avatar-responce").html("");var r=jQuery(".update-user-profile-avatar").serialize(),e=new FormData;e.append("user-avatar",jQuery("#wp-user-profile-avatar-add")),e.append("action","update_user_avatar"),e.append("form_data",r),e.append("security",wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security),jQuery.ajax({url:wp_user_profile_avatar_frontend_avatar.ajax_url,type:"post",dataType:"JSON",data:e,processData:!1,contentType:!1,success:function(a){console.log(a),jQuery("#upload-avatar-responce").addClass(a.class),jQuery("#upload-avatar-responce").html(a.message),"wp-user-profile-avatar-success"==a.class&&(jQuery("#wp-user-profile-avatar-preview img").attr("src",a.avatar_original),jQuery("#wp-user-profile-avatar-thumbnail img").attr("src",a.avatar_thumbnail),jQuery("#update-user-profile-avatar").trigger("reset")),location.reload()}})}}}};FrontendAvatar=FrontendAvatar(),jQuery(document).ready(function(a){FrontendAvatar.init()});1 var FrontendAvatar=function(){return{init:function(){jQuery('#wp-user-profile-avatar-add').off("click").on('click',FrontendAvatar.actions.chooseAvatar);jQuery('#wp-user-profile-avatar-remove').off("click").on('click',FrontendAvatar.actions.removeAvatar);jQuery('#wp-user-profile-avatar-undo').off("click").on('click',FrontendAvatar.actions.undoAvatar);jQuery('#wp-user-profile-avatar-update-profile').off("click").on('click',FrontendAvatar.actions.updateAvatar)},actions:{chooseAvatar:function(event){var upload=wp.media({library:{type:'image'},title:wp_user_profile_avatar_frontend_avatar.media_box_title,multiple:false}).on('select',function(){var select=upload.state().get('selection');var attach=select.first().toJSON();jQuery('#wp-user-profile-avatar-preview img').attr('src',attach.url);jQuery('#wp-user-profile-avatar-thumbnail img').attr('src',attach.url);jQuery('#wpupaattachmentid').attr('value',attach.id);jQuery('#wp_user_profile_avatar_radio').trigger('click');jQuery('#wp-user-profile-avatar-undo-button').show()}).open()},removeAvatar:function(event){jQuery('#wp-user-profile-avatar-preview img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar);jQuery('#wp-user-profile-avatar-thumbnail img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar);jQuery('#wpupaattachmentid').attr('value','');jQuery('#wpupa-url').attr('value','');jQuery('#wp-user-profile-avatar-remove').hide()},undoAvatar:function(event){jQuery('#wp-user-profile-avatar-preview img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar);jQuery('#wp-user-profile-avatar-thumbnail img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar);jQuery('#wpupaattachmentid').attr('value','');jQuery('#wp-user-profile-avatar-undo-button').hide();jQuery('#update-user-profile-avatar').trigger('reset')},updateAvatar:function(event){jQuery('#upload-avatar-responce').removeClass('wp-user-profile-avatar-error');jQuery('#upload-avatar-responce').removeClass('wp-user-profile-avatar-success');jQuery('#upload-avatar-responce').html('');var form_data=jQuery('.update-user-profile-avatar').serialize();var fd=new FormData();fd.append("user-avatar",jQuery('#wp-user-profile-avatar-add'));fd.append("action",'update_user_avatar');fd.append("form_data",form_data);fd.append("security",wp_user_profile_avatar_frontend_avatar.wp_user_profile_avatar_security);jQuery.ajax({url:wp_user_profile_avatar_frontend_avatar.ajax_url,type:'post',dataType:'JSON',data:fd,processData:false,contentType:false,success:function(responce){jQuery('#upload-avatar-responce').addClass(responce.class);jQuery('#upload-avatar-responce').html(responce.message);if(responce.class=='wp-user-profile-avatar-success'){jQuery('#wp-user-profile-avatar-preview img').attr('src',responce.avatar_original);jQuery('#wp-user-profile-avatar-thumbnail img').attr('src',responce.avatar_thumbnail);jQuery('#update-user-profile-avatar').trigger('reset');jQuery('#wpupaattachmentid').val(response.form_wpupaattachmentid);if(response.form_wpupaattachmentid=='0'){jQuery('#wp-user-profile-avatar-remove-button').hide();jQuery('#wp-user-profile-avatar-preview img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar);jQuery('#wp-user-profile-avatar-thumbnail img').attr('src',wp_user_profile_avatar_frontend_avatar.default_avatar)}else{jQuery('#wp-user-profile-avatar-remove-button').show()}}location.reload()}})}}}};FrontendAvatar=FrontendAvatar();jQuery(document).ready(function($){FrontendAvatar.init()}); -
wp-user-profile-avatar/trunk/external/elementor-widgets/elementor-user-profile-avatar.php
r3106296 r3123813 148 148 149 149 $this->add_control( 150 'custom_link', 151 array( 152 'label' => esc_html__( 'Custom URL', 'wp-user-profile-avatar' ), 153 'type' => Controls_Manager::TEXT, 154 'default' => '', 155 'condition' => array( 156 'link' => 'custom', 157 ), 158 ) 159 ); 160 161 $this->add_control( 150 162 'target', 151 163 array( … … 186 198 $target = '_self'; 187 199 } 188 200 if ( $settings['link'] == 'custom' ){ 201 $settings['link'] = $settings['custom_link']; 202 } 189 203 echo '<div class="elementor-user-profile-avatar-widget">'; 190 204 echo do_shortcode( '[user_profile_avatar user_id="' . $settings['user_id'] . '" size="' . $settings['size'] . '" align="' . $settings['align'] . '" link="' . $settings['link'] . '" target="' . $target . '"]' . $settings['content'] . '[/user_profile_avatar]' ); -
wp-user-profile-avatar/trunk/external/external.php
r3106296 r3123813 7 7 8 8 // check Elementor Plugin istallation. 9 if ( ! function_exists( ' _is_elementor_installed' ) ) {9 if ( ! function_exists( 'wpupa_is_elementor_installed' ) ) { 10 10 11 function _is_elementor_installed() {11 function wpupa_is_elementor_installed() { 12 12 $file_path = 'elementor/elementor.php'; 13 13 $installed_plugins = get_plugins(); -
wp-user-profile-avatar/trunk/includes/wp-user-profile-avatar-user.php
r3106296 r3123813 5 5 exit; 6 6 } 7 8 7 /** 9 * WPUPA_User class. 8 * WPUPA_User class. 10 9 */ 11 10 class WPUPA_User { 12 13 11 /** 14 12 * Constructor - get the plugin hooked in and ready … … 16 14 public function __construct() { 17 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); 18 17 } 19 20 18 /** 21 19 * wpupa_get_user_avatar_url function. … … 36 34 return false; 37 35 } 38 39 36 $user_id = null; 40 37 if ( is_object( $id_or_email ) ) { … … 54 51 55 52 // First checking custom avatar. 56 if ( check_wpupa_url( $user_id ) ) {53 if ( wpupa_check_wpupa_url( $user_id ) ) { 57 54 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 58 55 } elseif ( $wpupa_disable_gravatar ) { 59 56 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); 60 57 } else { 61 $has_valid_url = check_wpupa_gravatar( $id_or_email );58 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email ); 62 59 if ( ! $has_valid_url ) { 63 60 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); … … 68 65 } 69 66 } 70 71 67 return esc_url( $url ); 72 68 } 69 /** 70 * wpupa_integrate_user_avatar_to_bbpress_profile function. 71 * 72 * @access public 73 * @param $avatar, $id_or_email, $size, $default, $alt 74 * @return 75 * @since 1.0 76 */ 77 public function wpupa_integrate_user_avatar_to_bbpress_profile($avatar, $id_or_email, $size, $default, $alt) { 78 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)) { 83 $user_id = $id_or_email->user_id; 84 } else { 85 $user = get_user_by('email', $id_or_email); 86 $user_id = $user ? $user->ID : 0; 87 } 73 88 89 // Get the user avatar profile picture URL 90 $attachment_id = esc_attr( get_user_meta( $user_id, '_wpupa_attachment_id', true ) ); 91 $image_source = wp_get_attachment_image_src( $attachment_id ); 92 93 if ($image_source) { 94 $avatar = "<img alt='{$alt}' src='{$image_source[0]}' class='avatar avatar-{$size} photo' height='{$image_source[2]}' width='{$image_source[1]}' />"; 95 } 96 97 return $avatar; 98 } 74 99 } 75 76 100 new WPUPA_User(); -
wp-user-profile-avatar/trunk/readme.txt
r3106296 r3123813 6 6 Requires at least: 5.8 7 7 Tested up to: 6.5.4 8 Stable tag: 1.0. 38 Stable tag: 1.0.4 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.4 [July 19th, 2024] = 331 332 Fixed: The Avatar spelling is rectified. 333 Fixed : Deprecated code error is fixed. 334 Fixed : Check marked again visible in the box. 335 Fixed: Profile image remains the same when changing user name. 336 Fixed: Issue related to the “Avatar link to” option is resolved. 337 Fixed: Adding shortcode-related problem is resolved. 338 Fixed: New profile image is no more visible after refreshing the page. 339 Fixed: No undefined text is visible in the size attribute value. 340 Fixed: Shortcode attribute-related issue is resolved. 341 Fixed: Proper user image is now displayed in each user profile avatar. 342 Fixed: Issue related to the option “open link in a new window” is resolved. 343 Fixed: Space is added between the two buttons. 344 Fixed: User role is now saved properly. 345 Fixed: The issue related to the appearance of a new image when the update button is pressed is resolved. 346 Fixed: The image button is not visible after removing an image. 347 Fixed: The Undo button is now visible on the shortcode page. 348 Fixed: The blue default user icon is now visible. 349 Fixed : Comment enable/disable issue is fixed. 329 350 330 351 = 1.0.3 [June 11th, 2024] = -
wp-user-profile-avatar/trunk/shortcodes/wp-author-social-info-shortcodes.php
r3106296 r3123813 6 6 * Class to define author box social info by using shortcode 7 7 */ 8 9 class WPUPA_authorbox_socialinfo_Shortcodes { 8 class WPUPA_Authorbox_Socialinfo_Shortcodes { 10 9 11 10 /** … … 13 12 */ 14 13 public function __construct() { 15 add_shortcode( 'authorbox_social_link', array( $this, ' authorbox_social_link' ) );14 add_shortcode( 'authorbox_social_link', array( $this, 'wpupa_authorbox_social_link' ) ); 16 15 } 17 16 18 17 /** 19 * authorbox_social_link function18 * wpupa_authorbox_social_link function 20 19 * 21 20 * @access public … … 23 22 * @since 1.0 24 23 */ 25 public function authorbox_social_link() {24 public function wpupa_authorbox_social_link() { 26 25 27 26 $id = get_current_user_id(); … … 31 30 ob_start(); 32 31 33 include_once WPUPA_PLUGIN_DIR . '/ templates/wp-author-box-social-info.php';32 include_once WPUPA_PLUGIN_DIR . '/includes/wp-author-box-social-info.php'; 34 33 35 34 return ob_get_clean(); … … 38 37 } 39 38 40 new WPUPA_ authorbox_socialinfo_Shortcodes();39 new WPUPA_Authorbox_Socialinfo_Shortcodes(); -
wp-user-profile-avatar/trunk/shortcodes/wp-user-display.php
r3106296 r3123813 6 6 * Class to define user details by using shortcode 7 7 */ 8 9 8 class WPUPA_User_Shortcodes { 10 9 … … 13 12 */ 14 13 public function __construct() { 15 add_shortcode( 'user_display', array( $this, ' user_display' ) );14 add_shortcode( 'user_display', array( $this, 'wpupa_user_display' ) ); 16 15 } 17 16 18 17 /** 19 * user_displayfunction18 * display user profile avatar function 20 19 * 21 20 * @access public … … 24 23 * @since 1.0 25 24 */ 26 public function user_display() {25 public function wpupa_user_display( $atts ) { 27 26 28 $id = get_current_user_id(); 27 $atts = shortcode_atts( 28 array( 29 'id' => '', 30 'email' => '', 31 'avatar_size' => '', 32 'avatar_align' => 'center', 33 ), 34 $atts, 35 'user_display' 36 ); 37 38 // Ensure either 'id' or 'email' is provided 39 if ( empty( $atts['id'] ) && empty( $atts['email'] ) ) { 40 return 'Error: Please provide either a user ID or email.'; 41 } 42 43 // Determine user ID 44 if ( ! empty( $atts['id'] ) ) { 45 $id = intval( $atts['id'] ); 46 } elseif ( ! empty( $atts['email'] ) ) { 47 $user = get_user_by( 'email', $atts['email'] ); 48 $id = $user ? $user->ID : 0; 49 } 50 51 // If no user found, return an error message 52 if ( $id == 0 ) { 53 return 'Error: User not found.'; 54 } 55 56 // Fetch user profile image 57 $attachment = get_user_meta( $id, '_wpupa_attachment_id', true ); 58 $image_source = wp_get_attachment_image_src( $attachment ); 59 60 if ( $details['avatar_size'] != '' && $image_source ) { 61 $size = $details['avatar_size']; 62 $image_source[1] = $size; 63 } 29 64 30 65 $details = array( … … 35 70 'sabox_social_links' => get_the_author_meta( 'sabox_social_links', $id ), 36 71 'sabox-profile-image' => esc_url( get_the_author_meta( 'sabox-profile-image', $id ) ), 72 'avatar_size' => $atts['avatar_size'], 73 'avatar_align' => esc_attr( $atts['avatar_align'] ), 37 74 ); 38 75 -
wp-user-profile-avatar/trunk/shortcodes/wp-user-profile-avatar-shortcodes.php
r3106296 r3123813 2 2 3 3 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 4 5 4 class WPUPA_Shortcodes { 6 5 … … 8 7 * Constructor - get the plugin hooked in and ready 9 8 */ 10 public function __construct() { 11 12 add_shortcode( 'authorbox_social_info', array( $this, 'authorbox_social_info' ) ); 13 add_shortcode( 'authorbox_social_link', array( $this, 'authorbox_social_link' ) ); 14 add_shortcode( 'user_display', array( $this, 'user_display' ) ); 15 add_shortcode( 'user_profile_avatar', array( $this, 'user_profile_avatar' ) ); 16 add_shortcode( 'user_profile_avatar_upload', array( $this, 'user_profile_avatar_upload' ) ); 9 public function __construct() { 10 11 add_shortcode( 'authorbox_social_info', array( $this, 'wpupa_authorbox_social_info' ) ); 12 add_shortcode( 'authorbox_social_link', array( $this, 'wpupa_authorbox_social_link' ) ); 13 add_shortcode( 'user_display', array( $this, 'wpupa_user_display' ) ); 14 add_shortcode( 'user_profile_avatar', array( $this, 'wpupa_user_profile_avatar' ) ); 15 add_shortcode( 'user_profile_avatar_upload', array( $this, 'wpupa_user_profile_avatar_upload' ) ); 16 add_shortcode( 'all_user_avatars', array( $this, 'wpupa_all_user_avatars' ) ); 17 17 18 18 add_action( 'wp_ajax_update_user_avatar', array( $this, 'update_user_avatar' ) ); … … 33 33 * @since 1.0 34 34 */ 35 public function authorbox_social_info( $atts = array(), $content = null ) {35 public function wpupa_authorbox_social_info( $atts = array(), $content = null ) { 36 36 global $blog_id, $post, $wpdb; 37 37 … … 51 51 ob_start(); 52 52 53 include_once WPUPA_PLUGIN_DIR . '/ templates/wp-author-box-display.php';53 include_once WPUPA_PLUGIN_DIR . '/includes/wp-author-box-display.php'; 54 54 55 55 return ob_get_clean(); … … 57 57 58 58 /** 59 * authorbox_social_link function59 * wpupa_authorbox_social_link function 60 60 * 61 61 * @access public … … 64 64 * @since 1.0 65 65 */ 66 public function authorbox_social_link() {66 public function wpupa_authorbox_social_link() { 67 67 68 68 $id = get_current_user_id(); … … 78 78 79 79 /** 80 * user_display function80 * wpupa_user_display function 81 81 * 82 82 * @access public … … 85 85 * @since 1.0 86 86 */ 87 public function user_display() {87 public function wpupa_user_display() { 88 88 89 89 $id = get_current_user_id(); … … 106 106 107 107 /** 108 * user_profile_avatar function. 108 * wpupa_all_user_avatars function 109 * 110 * @access public 111 * @param $atts 112 * @return 113 * 114 */ 115 public function wpupa_all_user_avatars( $atts ) { 116 $atts = shortcode_atts( array( 117 'roles' => '', 118 'avatar_size' => 100, 119 'border_radius' => 0, 120 'align' => '', 121 'limit' => '', 122 'max_bio_length' => -1, 123 'min_post_count' => 0, 124 'page_size' => 10, 125 'order' => 'ID', 126 'sort_direction' => 'asc', 127 'render_as_list' => 'false', 128 'hiddenusers' => '', 129 'link_to_authorpage'=> '', 130 'user_link' => '', 131 'show_name' => '', 132 'show_biography' => '', 133 'show_postcount' => '', 134 'blogs' => '', 135 ), $atts, 'all_user_avatars'); 136 137 $roles = !empty( $atts['roles'] ) ? array_map( 'trim', explode( ',', $atts['roles'] ) ) : array(); 138 139 $hidden_users = !empty( $atts['hiddenusers'] ) ? array_map( 'trim', explode( ',', $atts['hiddenusers'] ) ) : array(); 140 141 $order = !empty( $atts['order'] ) ? esc_attr( $atts['order'] ) : 'ID'; 142 $sort_direction = in_array( strtolower( $atts['sort_direction'] ), array( 'desc', 'descending' ) ) ? 'DESC' : 'ASC'; 143 144 $paged = max( 1, get_query_var( 'paged', 1 ) ); 145 $offset = ( $paged - 1 ) * $atts['page_size']; 146 147 $user_avatars = array(); 148 149 // Check if blogs attribute is specified for WPMU mode 150 if ( !empty( $atts['blogs'] ) && is_multisite() ) { 151 $blog_ids = array_map( 'trim', explode( ',', $atts['blogs'] ) ); 152 153 foreach ( $blog_ids as $blog_id ) { 154 155 switch_to_blog( $blog_id ); 156 157 $args = array( 158 'role__in' => $roles, 159 'exclude' => $hidden_users, 160 'fields' => array( 'ID', 'display_name', 'description' ), 161 'number' => $atts['limit'], 162 'orderby' => $order, 163 'order' => $sort_direction, 164 'count_total' => false, 165 ); 166 167 $user_query = new WP_User_Query( $args ); 168 $users = $user_query->get_results(); 169 170 if ( !empty( $atts['min_post_count'] ) ) { 171 $min_post_count = ( int ) $atts['min_post_count']; 172 if ( $min_post_count > 0 ) { 173 $users = array_filter( $users, function( $user ) use ( $min_post_count ) { 174 return count_user_posts( $user->ID ) >= $min_post_count; 175 }); 176 } 177 } 178 179 foreach ( $users as $user ) { 180 $avatar_url = get_avatar_url( $user->ID, array( 'size' => $atts['avatar_size'] ) ); 181 $user_data = array( 182 'display_name' => esc_html( $user->display_name ), 183 'avatar_url' => esc_url( $avatar_url ), 184 'ID' => $user->ID, 185 ); 186 187 if ( !empty( $atts['show_name'] ) && $atts['show_name'] === 'true' ) { 188 $user_data['show_name'] = true; 189 } 190 191 if ( !empty( $atts['show_biography'] ) && $atts['show_biography'] === 'true' ) { 192 if ( $atts['max_bio_length'] > 0 ) { 193 194 $user_data['biography'] = substr(get_the_author_meta( 'description', $user->ID ), 0, $atts['max_bio_length']); 195 } else { 196 $user_data['biography'] = get_the_author_meta( 'description', $user->ID ); 197 } 198 } 199 200 if ( !empty($atts['show_postcount'] ) && $atts['show_postcount'] === 'true' ) { 201 $user_data['post_count'] = count_user_posts( $user->ID ); 202 } 203 204 if ( !empty($atts['user_link'] ) ) { 205 $user_data['user_link'] = sanitize_key($atts['user_link']); 206 } 207 if ( ! empty( $atts['align'] ) ) { 208 $this->userlist->align = esc_attr( $atts['align'] ); 209 } 210 211 $user_avatars[] = $user_data; 212 } 213 214 // Restore the original blog context 215 restore_current_blog(); 216 } 217 } else { 218 // No specific blogs provided 219 $args = array( 220 'role__in' => $roles, 221 'exclude' => $hidden_users, 222 'fields' => array( 'ID', 'display_name', 'description' ), 223 'number' => $atts['limit'], 224 'orderby' => $order, 225 'order' => $sort_direction, 226 'count_total'=> false, 227 ); 228 229 $user_query = new WP_User_Query( $args ); 230 $users = $user_query->get_results(); 231 232 if ( !empty( $atts['min_post_count'] ) ) { 233 $min_post_count = ( int ) $atts['min_post_count']; 234 if ( $min_post_count > 0 ) { 235 $users = array_filter( $users, function( $user ) use ( $min_post_count ) { 236 return count_user_posts( $user->ID ) >= $min_post_count; 237 } ); 238 } 239 } 240 241 $total_users = count( $users ); 242 $total_pages = ceil( $total_users / $atts['page_size'] ); 243 $users = array_slice( $users, $offset, $atts['page_size'] ); 244 245 foreach ( $users as $user ) { 246 $avatar_url = get_avatar_url( $user->ID, array( 'size' => $atts['avatar_size'] ) ); 247 $user_data = array( 248 'display_name' => esc_html( $user->display_name ), 249 'avatar_url' => esc_url( $avatar_url ), 250 'ID' => $user->ID, 251 ); 252 253 if ( !empty( $atts['show_name'] ) && $atts['show_name'] === 'true' ) { 254 $user_data['show_name'] = true; 255 } 256 257 if ( !empty( $atts['show_biography'] ) && $atts['show_biography'] === 'true' ) { 258 if ( $atts['max_bio_length'] > 0 ) { 259 260 $user_data['biography'] = substr(get_the_author_meta( 'description', $user->ID ), 0, $atts['max_bio_length']); 261 } else { 262 $user_data['biography'] = get_the_author_meta( 'description', $user->ID ); 263 } 264 } 265 266 if ( !empty($atts['show_postcount'] ) && $atts['show_postcount'] === 'true' ) { 267 $user_data['post_count'] = count_user_posts( $user->ID ); 268 } 269 270 if ( !empty( $atts['user_link'] ) ) { 271 $user_data['user_link'] = sanitize_key( $atts['user_link'] ); 272 } 273 274 $user_avatars[] = $user_data; 275 } 276 } 277 278 ob_start(); 279 280 include_once WPUPA_PLUGIN_DIR . '/templates/wp-display-user-avatar-list.php'; 281 282 return ob_get_clean(); 283 } 284 /** 285 * wpupa_user_profile_avatar function. 109 286 * 110 287 * @access public … … 113 290 * @since 1.0 114 291 */ 115 public function user_profile_avatar( $atts = array(), $content = null ) {292 public function wpupa_user_profile_avatar( $atts = array(), $content = null ) { 116 293 global $blog_id, $post, $wpdb; 117 294 … … 126 303 'size' => esc_attr( 'thumbnail' ), 127 304 'align' => esc_attr( 'alignnone' ), 128 'link' => esc_ url( '#' ),305 'link' => esc_attr( '#' ), 129 306 'target' => esc_attr( '_self' ), 307 'url' => esc_attr( '' ), 130 308 ), 131 309 $atts … … 133 311 ); 134 312 135 if ( $admin_avatar_size ) { 136 $size = $admin_avatar_size; 137 } 313 $user_id = !empty( $user_id ) ? esc_attr( $user_id ) : $current_user_id; 314 $size = !empty( $atts['size'] ) ? sanitize_text_field( $atts['size'] ) : sanitize_text_field( $admin_avatar_size ); 315 $align = sanitize_text_field( $atts['align'] ); 316 $link = !empty($atts['link']) ? sanitize_text_field($atts['link']) : '#' ; 317 $target = !empty($atts['target']) ? sanitize_text_field($atts['target']) : '_self'; 318 $url = !empty($atts['url']) ? sanitize_text_field($atts['url']) : ''; 319 320 if( !empty( $atts['size'] ) ){ 321 $size = esc_attr( $atts['size'] ); 322 }else{ 323 $size = esc_attr( $admin_avatar_size ); 324 } 325 326 if ($link === 'custom' && empty($url)) { 327 return '<div class="error-message" style="color:red;">Error: You must provide a URL when using the "custom" link option. Please include the "url" attribute in your shortcode.</div>'; 328 } 138 329 139 330 ob_start(); 140 $image_url = esc_url( wpupa_get_url( $current_user_id, array( 'size' => esc_attr( $size ) ) ) ); 331 332 $image_url = esc_url( wpupa_get_url( $user_id, array( 'size' => esc_attr( $size ) ) ) ); 141 333 if ( $link == 'image' ) { 142 334 // Get image src 143 $link = wpupa_get_url( $current_user_id, array( 'size' => 'original') );335 $link = esc_url( wpupa_get_url( $user_id, array( 'size' => 'original' ) ) ); 144 336 } elseif ( $link == 'attachment' ) { 145 337 // Get attachment URL 146 $link = get_attachment_link( get_the_author_meta( $wpdb->get_blog_prefix( esc_attr( $blog_id ) ) . 'user_avatar', esc_attr( $user_id ) ) ); 147 } 338 $link = esc_url( get_attachment_link( get_the_author_meta( $wpdb->get_blog_prefix( esc_attr( $blog_id ) ) . 'user_avatar', esc_attr( $user_id ) ) ) ); 339 } elseif ( $link == 'custom' ){ 340 $link = $url; 341 } elseif ( $link == 'none' ){ 342 $link = '#'; 343 } 148 344 149 345 include_once WPUPA_PLUGIN_DIR . '/templates/wp-user-avatar.php'; … … 151 347 return ob_get_clean(); 152 348 } 153 154 /** 155 * user_profile_avatar_upload function. 349 /** 350 * wpupa_user_profile_avatar_upload function. 156 351 * 157 352 * @access public … … 160 355 * @since 1.0 161 356 */ 162 public function user_profile_avatar_upload( $atts = array(), $content = null ) {357 public function wpupa_user_profile_avatar_upload( $atts = array(), $content = null ) { 163 358 extract( 164 359 shortcode_atts( … … 211 406 $wpupa_thumbnail = esc_url( wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ) ); 212 407 213 $wpupaattachmentid = esc_attr( get_user_meta( $user_id, '_wpupa attachmentid', true ) );408 $wpupaattachmentid = esc_attr( get_user_meta( $user_id, '_wpupa_attachment_id', true ) ); 214 409 $wpupa_url = esc_url( get_user_meta( $user_id, '_wpupa_url', true ) ); 215 410 … … 253 448 // Upload file 254 449 $overrides = array( 'test_form' => false ); 255 $uploaded_file = $this-> handle_upload( $file, $overrides );450 $uploaded_file = $this->wpupa_handle_upload( $file, $overrides ); 256 451 257 452 $attachment = array( … … 288 483 } 289 484 290 /* 291 $wpupaattachmentid = get_user_meta($user_id, '_wpupa_attachment_id', true); 292 $wpupa_url = get_user_meta($user_id, '_wpupa_url', true); 293 294 if (empty($wpupaattachmentid) && empty($wpupa_url)) { 295 $wpupa_original = ''; 296 $wpupa_thumbnail = ''; 297 $message = __('Error! Select Image', 'wp-user-profile-avatar'); 298 $class = 'wp-user-profile-avatar-error'; 299 } else {*/ 300 $wpupa_original = wpupa_get_url( $user_id, array( 'size' => 'original' ) ); 301 $wpupa_thumbnail = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 302 $message = __( 'Successfully Updated Avatar', 'wp-user-profile-avatar' ); 303 $class = 'wp-user-profile-avatar-success'; 304 /*}*/ 485 $wpupa_original = wpupa_get_url( $user_id, array( 'size' => 'original' ) ); 486 $wpupa_thumbnail = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 487 $message = __( 'Successfully Updated Avatar', 'wp-user-profile-avatar' ); 488 $class = 'wp-user-profile-avatar-success'; 489 490 echo wp_json_encode( 491 array( 492 'avatar_original' => $wpupa_original, 493 'avatar_thumbnail' => $wpupa_thumbnail, 494 'message' => esc_attr( $message ), 495 'class' => esc_attr( $class ), 496 'form_wpupaattachmentid' => esc_attr( $form_wpupaattachmentid ), 497 ) 498 ); 499 else : 500 $message = __( 'Permission Denied', 'wp-user-profile-avatar' ); 501 $class = 'wp-user-profile-avatar-errors'; 502 echo wp_json_encode( 503 array( 504 'message' => $message, 505 'class' => $class, 506 ) 507 ); 508 endif; 509 wp_die(); 510 } 511 512 /** 513 * remove_user_avatar function. 514 * 515 * @access public 516 * @param 517 * @return 518 * @since 1.0 519 */ 520 public function remove_user_avatar() { 521 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 522 523 parse_str( sanitize_text_field($_POST['form_data']), $form_data ); 524 525 // sanitize each of the values of form data 526 $wpupa_url = esc_url_raw( $form_data['wpupa-url'] ); 527 $wpupaattachmentid = absint( $form_data['wpupaattachmentid'] ); 528 $user_id = absint( $form_data['user_id'] ); 529 $current_user_id = get_current_user_id(); 530 531 if ( $current_user_id == $user_id ) : 532 if ( isset( $user_id ) ) { 533 update_user_meta( $user_id, '_wpupaattachmentid', '' ); 534 update_user_meta( $user_id, '_wpupa_url', '' ); 535 update_user_meta( $user_id, '_wpupa_default', '' ); 536 537 // delete also attachment 538 wp_delete_attachment( $wpupaattachmentid, true ); 539 } 540 541 $wpupa_original = wpupa_get_url( $user_id, array( 'size' => 'original' ) ); 542 $wpupa_thumbnail = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 543 544 $message = __( 'Successfully Removed Avatar', 'wp-user-profile-avatar' ); 545 $class = 'wp-user-profile-avatar-success'; 305 546 306 547 echo wp_json_encode( … … 317 558 echo wp_json_encode( 318 559 array( 319 'message' => $message,320 'class' => $class,560 'message' => esc_attr( $message ), 561 'class' => esc_attr( $class ), 321 562 ) 322 563 ); … … 326 567 327 568 /** 328 * remove_user_avatar function.569 * undo_user_avatar function. 329 570 * 330 571 * @access public … … 333 574 * @since 1.0 334 575 */ 335 public function remove_user_avatar() {576 public function undo_user_avatar() { 336 577 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 337 578 … … 349 590 update_user_meta( $user_id, '_wpupa_url', '' ); 350 591 update_user_meta( $user_id, '_wpupa_default', '' ); 351 352 // delete also attachment353 wp_delete_attachment( $wpupaattachmentid, true );354 592 } 355 593 … … 357 595 $wpupa_thumbnail = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 358 596 359 $message = __( 'Successfully RemovedAvatar', 'wp-user-profile-avatar' );597 $message = __( 'Successfully Undo Avatar', 'wp-user-profile-avatar' ); 360 598 $class = 'wp-user-profile-avatar-success'; 361 599 … … 380 618 wp_die(); 381 619 } 382 383 /** 384 * undo_user_avatar function. 385 * 386 * @access public 387 * @param 388 * @return 389 * @since 1.0 390 */ 391 public function undo_user_avatar() { 392 check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' ); 393 394 parse_str( sanitize_text_field($_POST['form_data']), $form_data ); 395 396 // sanitize each of the values of form data 397 $wpupa_url = esc_url_raw( $form_data['wpupa-url'] ); 398 $wpupaattachmentid = absint( $form_data['wpupaattachmentid'] ); 399 $user_id = absint( $form_data['user_id'] ); 400 $current_user_id = get_current_user_id(); 401 402 if ( $current_user_id == $user_id ) : 403 if ( isset( $user_id ) ) { 404 update_user_meta( $user_id, '_wpupaattachmentid', '' ); 405 update_user_meta( $user_id, '_wpupa_url', '' ); 406 update_user_meta( $user_id, '_wpupa_default', '' ); 407 } 408 409 $wpupa_original = wpupa_get_url( $user_id, array( 'size' => 'original' ) ); 410 $wpupa_thumbnail = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 411 412 $message = __( 'Successfully Undo Avatar', 'wp-user-profile-avatar' ); 413 $class = 'wp-user-profile-avatar-success'; 414 415 echo wp_json_encode( 416 array( 417 'avatar_original' => $wpupa_original, 418 'avatar_thumbnail' => $wpupa_thumbnail, 419 'message' => esc_attr( $message ), 420 'class' => esc_attr( $class ), 421 ) 422 ); 423 else : 424 $message = __( 'Permission Denied', 'wp-user-profile-avatar' ); 425 $class = 'wp-user-profile-avatar-errors'; 426 echo wp_json_encode( 427 array( 428 'message' => esc_attr( $message ), 429 'class' => esc_attr( $class ), 430 ) 431 ); 432 endif; 433 wp_die(); 434 } 435 436 /** 437 * handle_upload function. 620 /** 621 * wpupa_handle_upload function. 438 622 * 439 623 * @access public … … 442 626 * @since 1.0 443 627 */ 444 public function handle_upload( $file_handler, $overrides ) {628 public function wpupa_handle_upload( $file_handler, $overrides ) { 445 629 require_once ABSPATH . 'wp-admin/includes/image.php'; 446 630 require_once ABSPATH . 'wp-admin/includes/file.php'; 447 631 require_once ABSPATH . 'wp-admin/includes/media.php'; 448 449 632 $upload = wp_handle_upload( $file_handler, $overrides ); 450 451 633 return $upload; 452 634 } 453 454 635 /** 455 636 * wpupa_get_user_avatar_url function. … … 471 652 return false; 472 653 } 473 474 654 $user_id = null; 475 655 if ( is_object( $id_or_email ) ) { 476 if ( ! empty( $id_or_email->comment_author_email ) ) { 656 if ( ! empty( $id_or_email->comment_author_email ) ) { 477 657 $user_id = $id_or_email->user_id; 478 658 } … … 490 670 // First checking custom avatar. 491 671 if ( get_current_user_id() == $user_id || is_admin() ) { 492 if ( check_wpupa_url( $user_id ) ) {672 if ( wpupa_check_wpupa_url( $user_id ) ) { 493 673 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) ); 494 674 } elseif ( $wpupa_disable_gravatar ) { 495 675 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); 496 676 } else { 497 $has_valid_url = check_wpupa_gravatar( $id_or_email );677 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email ); 498 678 if ( ! $has_valid_url ) { 499 679 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) ); … … 505 685 } 506 686 } 507 508 687 return $url; 509 688 } 510 511 689 } 512 690 new WPUPA_Shortcodes(); -
wp-user-profile-avatar/trunk/templates/wp-author-box-display.php
r3106296 r3123813 18 18 </div> 19 19 </div> 20 <?php21 /**22 * authorbox_social_link function23 *24 * @access public25 * @param $atts26 * @return27 * @since 1.028 */29 ?>30 20 31 21 <!-- Display social link to the author page--> -
wp-user-profile-avatar/trunk/templates/wp-avatar-upload.php
r3106296 r3123813 21 21 <button type="button" class="button" id="wp-user-profile-avatar-add" ><?php esc_html_e( 'Choose Image', 'wp-user-profile-avatar' ); ?></button> 22 22 23 <input type="hidden" name="wpupaattachmentid" id="wpupaattachmentid" >23 <input type="hidden" name="wpupaattachmentid" id="wpupaattachmentid" value="<?php echo esc_attr( $wpupaattachmentid ); ?>"> 24 24 <input type="hidden" name="user_id" id="wp-user-id" value="<?php echo esc_attr( $user_id ); ?>"> 25 26 25 </p> 27 26 </td> … … 29 28 30 29 <?php 31 //$class_hide = 'wp-user-profile-avatar-hide';30 $class_hide = 'wp-user-profile-avatar-hide'; 32 31 if ( ! empty( $wpupaattachmentid ) || ! empty( $wpupa_url ) ) { 33 32 $class_hide = ''; … … 44 43 <span class="description"><?php esc_html_e( 'Thumbnail', 'wp-user-profile-avatar' ); ?></span> 45 44 </p> 46 <p id="wp-user-profile-avatar-remove-button" class="<?php //echo esc_attr($class_hide); ?>">45 <p id="wp-user-profile-avatar-remove-button" class="<?php echo esc_attr($class_hide); ?>"> 47 46 <button type="button" class="button" id="wp-user-profile-avatar-remove"><?php esc_html_e( 'Remove Image', 'wp-user-profile-avatar' ); ?></button> 48 47 </p> -
wp-user-profile-avatar/trunk/templates/wp-display-user.php
r3106296 r3123813 8 8 ?> 9 9 10 <div class="author-details" >10 <div class="author-details" style="text-align: <?php echo esc_attr( $details['avatar_align'] ); ?>;"> 11 11 <p class="caption-text"><?php echo isset( $details['first_name'] ) ? esc_attr( $details['first_name'] ) : ''; ?></p> 12 12 <p class="caption-text"><?php echo isset( $details['last_name'] ) ? esc_attr( $details['last_name'] ) : ''; ?></p> … … 22 22 } 23 23 24 if ( '' != esc_attr( $details['sabox-profile-image'] )) {24 if ( isset( $image_source ) && $image_source ) { 25 25 ?> 26 <img src="<?php echo esc_attr( $details['sabox-profile-image'] ); ?>" /> 27 <?php } ?> 26 <img src="<?php echo esc_url( $image_source[0] ); ?>" width="<?php echo esc_attr( $image_source[1] ); ?>" /> 27 <?php 28 } 29 ?> 28 30 29 31 </div> -
wp-user-profile-avatar/trunk/templates/wp-user-avatar.php
r3106296 r3123813 4 4 */ 5 5 if ( ! defined( 'ABSPATH' ) ) { 6 exit; 6 exit; 7 7 } 8 8 ?> … … 11 11 <a href="<?php echo esc_url( $link ); ?>" target="<?php echo esc_attr( $target ); ?>" class="wp-user-profile-avatar-link"> 12 12 <?php if ( is_array( $image_url ) ) { ?> 13 <img src="<?php echo esc_url( $image_url[0] ); ?>" class="size-<?php echo esc_attr( $size ); ?> <?php echo esc_attr( $align ); ?>" width="<?php echo esc_attr( $image_url[1] ); ?>" height="<?php echo esc_attr( $image_url[2] ); ?>" alt="<?php echo esc_attr( $content ); ?>" />13 <img src="<?php echo esc_url( $image_url[0] ); ?>" class="size-<?php echo esc_attr( $size ); ?> <?php echo esc_attr( $align ); ?>" width="<?php echo esc_attr( $image_url[1] ); ?>" height="<?php echo esc_attr( $image_url[2] ); ?>" alt="<?php echo esc_attr( $content ); ?>" target="<?php echo esc_url( $target ); ?>"/> 14 14 <?php } else { ?> 15 <img src="<?php echo esc_url( $image_url ); ?>" class="size-<?php echo esc_attr( $size ); ?> <?php echo esc_attr( $align ); ?>" alt="<?php echo esc_attr( $content ); ?>" />15 <img src="<?php echo esc_url( $image_url ); ?>" class="size-<?php echo esc_attr( $size ); ?> <?php echo esc_attr( $align ); ?>" alt="<?php echo esc_attr( $content ); ?>" target="<?php echo esc_url( $target ); ?>"/> 16 16 <?php } ?> 17 17 </a> -
wp-user-profile-avatar/trunk/wp-user-profile-avatar-functions.php
r3106296 r3123813 3 3 4 4 /** 5 * wpupa_get_rating function.5 * get user avatar rating function. 6 6 * 7 7 * @access public … … 26 26 27 27 /** 28 * wpupa_get_file_size function.28 * get file size function. 29 29 * 30 30 * @access public … … 56 56 57 57 /** 58 * wpupa_get_default_avatar function.58 * get default user avatar function. 59 59 * 60 60 * @access public … … 110 110 111 111 /** 112 * wpupa_get_default_avatar_urlfunction.112 * get default avatar urlS function. 113 113 * 114 114 * @access public … … 173 173 174 174 /** 175 * wpupa_get_urlfunction.175 * get url fro usser profile avatar function. 176 176 * 177 177 * @access public … … 221 221 ); 222 222 } 223 224 } 225 } 226 227 if ( ! function_exists( 'check_wpupa_url' ) ) { 228 229 /** 230 * check_wpupa_url function. 223 } 224 } 225 226 if ( ! function_exists( 'wpupa_check_wpupa_url' ) ) { 227 228 /** 229 * check if profile avatar url or not function. 231 230 * 232 231 * @access public … … 235 234 * @since 1.0 236 235 */ 237 function check_wpupa_url( $user_id = '' ) {236 function wpupa_check_wpupa_url( $user_id = '' ) { 238 237 $attachment_url = esc_url( get_user_meta( $user_id, '_wpupa_url', true ) ); 239 238 … … 250 249 } 251 250 252 if ( ! function_exists( ' check_wpupa_gravatar' ) ) {253 254 /** 255 * check _wpupa_gravatarfunction.251 if ( ! function_exists( 'wpupa_check_wpupa_gravatar' ) ) { 252 253 /** 254 * check it is gratavatar or not function. 256 255 * 257 256 * @access public … … 260 259 * @since 1.0 261 260 */ 262 function check_wpupa_gravatar( $id_or_email = '', $check_gravatar = 0, $user = '', $email = '' ) {261 function wpupa_check_wpupa_gravatar( $id_or_email = '', $check_gravatar = 0, $user = '', $email = '' ) { 263 262 $wp_user_hash_gravatar = get_option( 'wp_user_hash_gravatar' ); 264 263 … … 336 335 $check_gravatar = false; 337 336 } 338 339 // Check if Gravatar image returns 200 (OK) or 404 (Not Found) 337 // Check if Gravatar image returns 200 (OK) or 404 (Not Found) 340 338 return (bool) $check_gravatar; 341 339 } … … 345 343 346 344 /** 347 * wpupa_get_image_sizesfunction.345 * get profile image size function. 348 346 * 349 347 * @access public … … 368 366 369 367 /** 370 * wpupa_get_image_alignment function.368 * get profile image alignment function. 371 369 * 372 370 * @access public … … 390 388 391 389 /** 392 * wpupa_get_image_link_tofunction.390 * get profile image link function. 393 391 * 394 392 * @access public … … 416 414 417 415 /** 418 * wpb_show_current_user_attachments function.416 * show current user attachments function. 419 417 * 420 418 * @access public … … 438 436 439 437 /** 440 * wpupa_file_size_limit function.438 * get file size limit function. 441 439 * 442 440 * Limit upload size for non-admins. Admins get the default limit … … 457 455 add_filter( 'upload_size_limit', 'wpupa_file_size_limit' ); 458 456 } 457 if ( ! function_exists( 'delete_comments_everywhere' ) ) { 458 459 /** 460 * delete comments from entire website function. 461 * 462 * delete comment on entire website 463 * 464 * @access public 465 * @param 466 * @return array 467 * @since 1.0 468 */ 469 function delete_comments_everywhere() { 470 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' ) ) { 476 477 /** 478 * delete comments from selected post types in website function. 479 * 480 * delete comment on selected places on website 481 * 482 * @access public 483 * @param 484 * @return array 485 * @since 1.0 486 */ 487 function delete_comments_by_post_types( $post_types ) { 488 global $wpdb; 489 $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 ) ); 491 } 492 } 493 use \WPUPA_WpUserNameChange\WPUPA_WpUserNameChange; 494 495 if ( ! function_exists( 'wpupa_username_edit' ) ) { 496 /** 497 * edit user name function. 498 * 499 * edit username from backend side 500 * 501 * @access public 502 * @param 503 * @return array 504 * @since 1.0 505 */ 506 function wpupa_username_edit() { ?> 507 <div class="wrap userupdater"> 508 <p> 509 <h1> 510 <?php esc_html_e( 'Wp Users List', 'wp-user-profile-avatar' ); ?> 511 </h1> 512 </p> 513 <?php 514 $wpuser = new WPUPA_WpUserNameChange(); 515 $records = $wpuser->wpuser_select(); 516 517 if ( $records ) { 518 ?> 519 <table class="wp-list-table widefat fixed striped users" cellpadding="3" cellspacing="3" width="100%"> 520 <thead> 521 <tr> 522 <th> 523 <strong> 524 <?php esc_html_e( 'User ID', 'wp-user-profile-avatar' ); ?> 525 </strong> 526 </th> 527 <th> 528 <strong> 529 <?php esc_html_e( 'User Name', 'wp-user-profile-avatar' ); ?> 530 </strong> 531 </th> 532 <th> 533 <strong> 534 <?php esc_html_e( 'Role', 'wp-user-profile-avatar' ); ?> 535 </strong> 536 </th> 537 <th> 538 <strong> 539 <?php esc_html_e( 'Update', 'wp-user-profile-avatar' ); ?> 540 </strong> 541 </th> 542 </tr> 543 </thead> 544 <tbody> 545 <?php 546 foreach ( $records as $user ) { 547 $user_info = get_userdata( $user->ID ); 548 ?> 549 <tr> 550 <td><?php echo esc_attr( $user->ID ); ?></td> 551 <td><?php echo esc_attr( $user->user_login ); ?></td> 552 <td><?php echo esc_html( implode( ', ', ( $user_info->roles ) ) ); ?></td> 553 <td> 554 <a href="<?php echo esc_url( wp_nonce_url( admin_url( 'admin.php?page=wpupa_username_update&update=' . $user->ID ) ) ); ?>"> 555 <?php esc_html_e( 'update', 'wp-user-profile-avatar' ); ?> 556 </a> 557 </td> 558 </tr> 559 <?php } ?> 560 </tbody> 561 </table> 562 <?php } ?> 563 </div> 564 <?php 565 } 566 } 567 568 if ( ! function_exists( 'wpupa_user_update' ) ) { 569 /** 570 * update username function. 571 * 572 * update username from backend side 573 * 574 * @access public 575 * @param 576 * @return array 577 * @since 1.0 578 */ 579 function wpupa_user_update() { 580 if ( isset( $_REQUEST['update'] ) ) { 581 if(!current_user_can('manage_options' ) || wp_verify_nonce( 'update','_wpnonce' ) ){ 582 return; 583 } 584 $wpuser = new WPUPA_WpUserNameChange(); 585 global $wpdb; 586 $id = trim( sanitize_text_field( $_REQUEST['update'] ) ); 587 $user_info = get_userdata( $id ); 588 $result = $wpdb->get_results( $wpdb->prepare( "SELECT * from $wpdb->users WHERE ID = %d", $id ) ); 589 foreach ( $result as $user ) { 590 $username = $user->user_login; 591 } 592 if ( ! empty( $_REQUEST['submit'] ) ) { 593 $name = sanitize_user( $_POST['user_login'] ); 594 if ( empty( $name ) ) { 595 $errorMsg = 'Error : Please do not enter empty username.'; 596 } elseif ( username_exists( $name ) ) { 597 $errorMsg = 'Error: This username(<i>' . esc_attr( $name ) . '</i>) is already exist.'; 598 } else { 599 $wpuser->wpuser_update( $id, $name ); 600 echo '<div class="updated"><p><strong>Username Updated</strong></p></div>'; 601 } 602 } 603 ?> 604 <div class="wrap"> 605 <h1><?php esc_html_e( 'Update WP Username', 'wp-user-profile-avatar' ); ?></h1> 606 <?php 607 if ( isset( $errorMsg ) ) { 608 echo "<div class='error'><p><strong>" . esc_attr( $errorMsg ) . '</strong></p></div>'; 609 } 610 ?> 611 </div> 612 <form method="post" id="user-udate" action="<?php echo esc_url( sanitize_url( $_SERVER['REQUEST_URI'] ) ); ?>"> 613 <table class="form-table"> 614 <tr> 615 <th><label for="olduser-login"><?php esc_html_e( 'Old Username', 'wp-user-profile-avatar' ); ?></label></th> 616 <td><strong><?php echo esc_attr( $username ); ?></strong></td> 617 </tr> 618 <tr> 619 <th><label for="user-login"><?php esc_html_e( 'New Username', 'wp-user-profile-avatar' ); ?></label></th> 620 <td><input type="text" name="user_login" class="regular-text" id="user_login" value=" 621 <?php 622 if ( ! empty( $_POST['user-login'] ) ) { 623 echo esc_attr( $name ); 624 } 625 ?> 626 "/></td> 627 </tr> 628 </table> 629 <input type="submit" name="submit" id="submit" class="button button-primary" value="Update WP Username"> 630 </form> 631 <?php } else { ?> 632 <script> 633 window.location = '<?php echo esc_url( admin_url( 'admin.php?page=wpupa_username_change' ) ); ?>' 634 </script> 635 <?php 636 } 637 } 638 } -
wp-user-profile-avatar/trunk/wp-user-profile-avatar.php
r3106296 r3123813 8 8 * Text Domain: wp-user-profile-avatar 9 9 * Domain Path: /languages 10 * Version: 1.0. 310 * Version: 1.0.4 11 11 * Since: 1.0.0 12 12 * Requires WordPress Version at least: 5.8 … … 23 23 24 24 /** 25 * WP _User_Profile_Avatar class.25 * WPUPA_User_Profile_Avatar class. 26 26 */ 27 class WP _User_Profile_Avatar {27 class WPUPA_User_Profile_Avatar { 28 28 29 29 /** … … 58 58 59 59 // Define constants 60 define( 'WPUPA_VERSION', '1.0. 3' );60 define( 'WPUPA_VERSION', '1.0.4' ); 61 61 define( 'WPUPA_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) ); 62 62 define( 'WPUPA_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) ); … … 64 64 // Includes 65 65 include 'includes/wp-user-profile-avatar-install.php'; 66 // include( 'includes/wp-user-profile-avatar-user.php' );67 66 include 'wp-user-profile-avatar-functions.php'; 68 include_once ' admin/templates/wp-username-change.php';69 include_once ' disable-comments.php';70 include_once ' templates/wp-author-box-social-info.php';71 include_once ' templates/wp-add-new-avatar.php';72 include_once ' templates/wp-avatar-social profile-picture.php';67 include_once 'includes/wp-username-change.php'; 68 include_once 'wp-user-profile-avatar-disable-comments.php'; 69 include_once 'includes/wp-author-box-social-info.php'; 70 include_once 'includes/wp-add-new-avatar.php'; 71 include_once 'includes/wp-avatar-social profile-picture.php'; 73 72 74 73 // shortcodes … … 80 79 include 'external/external.php'; 81 80 82 include_once 'templates/wp-author-box-social-info.php';83 84 81 // Activation / deactivation - works with symlinks 85 register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), array( $this, ' activate' ) );82 register_activation_hook( basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ), array( $this, 'wpupa_activate' ) ); 86 83 87 84 // Actions 88 add_action( 'after_setup_theme', array( $this, ' load_plugin_textdomain' ) );85 add_action( 'after_setup_theme', array( $this, 'wpupa_load_plugin_textdomain' ) ); 89 86 90 add_action( 'wp_enqueue_scripts', array( $this, ' frontend_scripts' ) );87 add_action( 'wp_enqueue_scripts', array( $this, 'wpupa_frontend_scripts' ) ); 91 88 92 89 if ( is_admin() ) { … … 96 93 // Filters 97 94 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'wpupa_settings_link' ) ); 98 99 95 } 100 96 101 97 /** 102 * activatefunction.98 * plugin activation function. 103 99 * 104 100 * @access public … … 107 103 * @since 1.0.0 108 104 */ 109 public function activate() {105 public function wpupa_activate() { 110 106 // installation process after activating 111 107 WPUPA_Install::install(); … … 113 109 114 110 /** 115 * load _plugin_textdomain function.111 * load plugin text domain function. 116 112 * 117 113 * @access public … … 120 116 * @since 1.0.0 121 117 */ 122 public function load_plugin_textdomain() {118 public function wpupa_load_plugin_textdomain() { 123 119 124 120 $domain = 'wp-user-profile-avatar'; … … 132 128 133 129 /** 134 * frontend_scriptsfunction.130 * enqueue script and style function. 135 131 * 136 132 * @access public … … 139 135 * @since 1.0 140 136 */ 141 public function frontend_scripts() {137 public function wpupa_frontend_scripts() { 142 138 143 139 wp_enqueue_media(); … … 146 142 147 143 wp_register_script( 'wp-user-profile-avatar-frontend-avatar', WPUPA_PLUGIN_URL . '/assets/js/frontend-avatar.min.js', array( 'jquery' ), WPUPA_VERSION, true ); 148 wp_enqueue_script( 'wp-user-profile-avatar-frontend-avatar-custom', WPUPA_PLUGIN_URL . '/assets/js/frontend-custom.js', array( 'jquery' ), WPUPA_VERSION, true );144 149 145 wp_localize_script( 150 146 'wp-user-profile-avatar-frontend-avatar', … … 160 156 161 157 /** 162 * wpupa_settings_link function.158 * set the setting page link function. 163 159 * 164 160 * Create link on plugin page for wp user profile avatar plugin settings. … … 185 181 function WPUPA() { 186 182 // phpcs:ignore WordPress.NamingConventions.ValidFunctionName 187 return WP _User_Profile_Avatar::instance();183 return WPUPA_User_Profile_Avatar::instance(); 188 184 } 189 185 $GLOBALS['wp_user_profile_avatar'] = WPUPA();
Note: See TracChangeset
for help on using the changeset viewer.