Plugin Directory

Changeset 3149247


Ignore:
Timestamp:
09/10/2024 12:44:56 PM (18 months ago)
Author:
wpeventmanager
Message:

Released version 1.0.5

Location:
wp-user-profile-avatar/trunk
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • wp-user-profile-avatar/trunk/admin/templates/comments-settings-page.php

    r3123813 r3149247  
    1515           
    1616            $mode = sanitize_text_field( $_POST['mode'] );
    17             update_option( 'disable_comments_mode', $mode );
     17            update_option( 'wpupa_disable_comments_mode', $mode );
    1818           
    1919            if ( 'selected-types' === $mode && isset( $_POST['disabled_post_types'] ) && is_array( $_POST['disabled_post_types'] ) ) {
     
    2222                $disabled_post_types = array();
    2323            }
    24             update_option( 'disabled_post_types', $disabled_post_types );
     24            update_option( 'wpupa_disabled_post_types', $disabled_post_types );
    2525        }
     26
     27        // Handle reset action
     28        if ( isset( $_POST['reset'] ) && isset( $_POST['disable_comments_nonce_field'] ) && wp_verify_nonce( $_POST['disable_comments_nonce_field'], 'disable_comments_nonce' ) ) {
     29            delete_option( 'wpupa_disable_comments_mode' );
     30            delete_option( 'wpupa_disabled_post_types' );
     31        }
     32
    2633    ?>
    2734    <form action="" method="post" id="disable-comments">
     
    2936            <li>
    3037                <label for="remove_everywhere">
    31                     <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( get_option('disable_comments_mode'), 'remove_everywhere' ); ?> />
     38                    <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( get_option('wpupa_disable_comments_mode'), 'remove_everywhere' ); ?> />
    3239                    <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>:
    3340                    <?php esc_html_e( 'Disable all comment-related controls and settings in WordPress.', 'wp-user-profile-avatar' ); ?>
    3441                </label>
    3542                <p class="indent">
    36                     <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href="%2$s" target="_blank">available here</a>.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>', 'https://wordpress.org/plugins/disable-comments/other_notes/' ); ?>
     43                    <?php printf(
     44                            /* translators: 1: Warning label, 2: URL link */
     45                            esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to disable comments everywhere. A complete description of what this option does is %2$s.', 'wp-user-profile-avatar' ),
     46                            '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>',
     47                            '<a href="' . esc_url( 'https://wordpress.org/plugins/disable-comments/other_notes/' ) . '" target="_blank">' . esc_html__( 'available here', 'wp-user-profile-avatar' ) . '</a>'
     48                        ); ?>
    3749                </p>
    3850            </li>
    3951            <li>
    4052                <label for="selected-types">
    41                     <input type="radio" id="selected-types" name="mode" value="selected-types" <?php checked( get_option('disable_comments_mode'), 'selected-types' ); ?> />
     53                    <input type="radio" id="selected-types" name="mode" value="selected-types" <?php checked( get_option('wpupa_disable_comments_mode'), 'selected-types' ); ?> />
    4254                    <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>:
    4355                </label>
     
    4759                    <?php
    4860                    $post_types = get_post_types( array( 'public' => true ), 'objects' );
    49                     $disabled_post_types = get_option( 'disabled_post_types', array() );
     61                    $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() );
    5062                    foreach ( $post_types as $post_type ) {
    5163                        ?>
     
    6375        </ul>
    6476        <?php wp_nonce_field( 'disable_comments_nonce', 'disable_comments_nonce_field' ); ?>
    65         <p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"></p>
     77        <p class="submit">
     78            <input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>">
     79            <input class="button-secondary" type="submit" name="reset" value="<?php esc_html_e( 'Reset Settings', 'wp-user-profile-avatar' ); ?>">
     80        </p>
    6681    </form>
    6782</div>
  • wp-user-profile-avatar/trunk/admin/templates/comments-tools-page.php

    r3123813 r3149247  
    1515       
    1616        $mode = sanitize_text_field( $_POST['mode'] );
    17         update_option( 'delete_comments_mode', $mode );
     17        update_option( 'wpupa_delete_comments_mode', $mode );
    1818
    1919        if ( 'delete_everywhere' === $mode ) {
    2020
    21             $deleted_count = delete_comments_everywhere();
    22             echo '<div class="notice notice-success"><p>' . sprintf( esc_html__( '%d comments have been deleted from your site.', 'wp-user-profile-avatar' ), $deleted_count ) . '</p></div>';
    23             update_option( 'selected_post_types', array() );
     21            $deleted_count = wpupa_delete_comments_everywhere();
     22            echo '<div class="notice notice-success"><p>';
     23            printf(
     24                /* translators: %d: Number of deleted comments */
     25                esc_html__( '%d comments have been deleted from your site.', 'wp-user-profile-avatar' ),
     26                intval( $deleted_count )
     27            );
     28            echo '</p></div>';
     29            update_option( 'wpupa_selected_post_types', array() );
    2430           
    2531        } elseif ( 'selected-post-types' === $mode ) {
     
    2834               
    2935                $selected_post_types = array_map( 'sanitize_text_field', $_POST['selected_post_types'] );
    30                 update_option( 'selected_post_types', $selected_post_types ); // Save selected post types
    31                 $deleted_count = delete_comments_by_post_types( $selected_post_types );
    32                 echo '<div class="notice notice-success"><p>' . sprintf( esc_html__( '%d comments have been deleted from selected post types.', 'wp-user-profile-avatar' ), $deleted_count ) . '</p></div>';
     36                update_option( 'wpupa_selected_post_types', $selected_post_types ); // Save selected post types
     37                $deleted_count = wpupa_delete_comments_by_post_types( $selected_post_types );
     38                echo '<div class="notice notice-success"><p>';
     39                printf(
     40                    /* translators: %d: Number of deleted comments */
     41                    esc_html__( '%d comments have been deleted from selected post types.', 'wp-user-profile-avatar' ),
     42                    intval( $deleted_count )
     43                );
     44                echo '</p></div>';
    3345           
    3446            } else {
    35                 update_option( 'selected_post_types', array() );
    36                 //   echo '<div class="notice notice-error"><p>' . esc_html__( 'Please select at least one post type to delete comments from.', 'wp-user-profile-avatar' ) . '</p></div>';
     47                update_option( 'wpupa_selected_post_types', array() );
    3748            }
    3849        }
    3950    }
     51
     52    // Handle reset action
     53    if ( isset( $_POST['reset'] ) && isset( $_POST['delete_comments_nonce_field'] ) && wp_verify_nonce( $_POST['delete_comments_nonce_field'], 'delete_comments_nonce' ) ) {
     54        delete_option( 'wpupa_delete_comments_mode' );
     55        delete_option( 'wpupa_selected_post_types' );
     56    }
     57
    4058    ?>
    4159    <form action="" method="post" id="delete-comments">
     
    4361            <li>
    4462                <label for="delete_everywhere">
    45                     <input type="radio" id="delete_everywhere" name="mode" value="delete_everywhere" <?php checked( get_option('delete_comments_mode'), 'delete_everywhere' ); ?> />
     63                    <input type="radio" id="delete_everywhere" name="mode" value="delete_everywhere" <?php checked( get_option('wpupa_delete_comments_mode'), 'delete_everywhere' ); ?> />
    4664                    <strong><?php esc_html_e( 'Everywhere', 'wp-user-profile-avatar' ); ?></strong>:
    4765                    <?php esc_html_e( 'Delete all comments across your entire site.', 'wp-user-profile-avatar' ); ?>
    4866                </label>
    4967                <p class="indent">
    50                     <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to delete comments <em>everywhere</em>.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>' ); ?>
     68                    <?php printf( esc_html__( '%1$s: This option is global and will affect your entire site. Use it only if you want to delete comments everywhere.', 'wp-user-profile-avatar' ), '<strong style="color: #900">' . esc_html__( 'Warning', 'wp-user-profile-avatar' ) . '</strong>' ); ?>
    5169                </p>
    5270            </li>
    5371            <li>
    5472                <label for="selected-post-types">
    55                     <input type="radio" id="selected-post-types" name="mode" value="selected-post-types" <?php checked( get_option('delete_comments_mode'), 'selected-post-types' ); ?> />
     73                    <input type="radio" id="selected-post-types" name="mode" value="selected-post-types" <?php checked( get_option('wpupa_delete_comments_mode'), 'selected-post-types' ); ?> />
    5674                    <strong><?php esc_html_e( 'On certain post types', 'wp-user-profile-avatar' ); ?></strong>:
    5775                </label>
     
    6179                    <?php
    6280                    $post_types = get_post_types( array( 'public' => true ), 'objects' );
    63                     $selected_post_types = get_option( 'selected_post_types', array() );
     81                    $selected_post_types = get_option( 'wpupa_selected_post_types', array() );
    6482                    foreach ( $post_types as $post_type ) {
    6583                        ?>
     
    7795        </ul>
    7896        <?php wp_nonce_field( 'delete_comments_nonce', 'delete_comments_nonce_field' ); ?>
    79         <p class="submit"><input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>"></p>
     97        <p class="submit">
     98            <input class="button-primary" type="submit" name="submit" value="<?php esc_html_e( 'Save Changes', 'wp-user-profile-avatar' ); ?>">
     99            <input class="button-secondary" type="submit" name="reset" value="<?php esc_html_e( 'Reset Settings', 'wp-user-profile-avatar' ); ?>">
     100        </p>
    80101    </form>
    81102</div>
  • wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-admin.php

    r3123813 r3149247  
    4141
    4242        add_action( 'init', array( $this, 'wpupa_thickbox_model_init' ) );
    43         add_action( 'wp_ajax_thickbox_model_view', array( $this, 'thickbox_model_view' ) );
    44         add_action( 'wp_ajax_nopriv_thickbox_model_view', array( $this, 'thickbox_model_view' ) );
     43        add_action( 'wp_ajax_thickbox_model_view', array( $this, 'wpupa_thickbox_model_view' ) );
     44        add_action( 'wp_ajax_nopriv_thickbox_model_view', array( $this, 'wpupa_thickbox_model_view' ) );
    4545
    4646        add_action( 'admin_init', array( $this, 'wpupa_init_size' ) );
     
    6868            add_submenu_page( 'wp-user-profile-avatar', __( 'WP Username Change', 'wp-user-profile-avatar' ), __( 'WP Username Change ', 'wp-user-profile-avatar' ), 'manage_options', 'wpupa_username_change', 'wpupa_username_edit' );
    6969            add_submenu_page( null, '', '', 'manage_options', 'wpupa_username_update', 'wpupa_user_update' );
    70             add_submenu_page( 'wp-user-profile-avatar', 'WP Avatar User Role Settings', 'WP Avatar User Role Settings', 'activate_plugins', 'avatar-social-picture', 'wpupa_user_admin' );
    71             add_submenu_page( 'wp-user-profile-avatar', 'Disable Comments', 'Disable Comments', 'manage_options', 'disable_comments_settings', array( $this, 'comments_settings_page' ) );
    72             add_submenu_page( 'wp-user-profile-avatar', 'Delete Comments', 'Delete Comments', 'manage_options', 'disable_comments_tools', array( $this, 'comments_tools_page' ) );
    73         }
     70            add_submenu_page( 'wp-user-profile-avatar', 'WP Avatar User Role Settings', 'WP Avatar User Role Settings', 'activate_plugins', 'avatar-social-picture', array( $this, 'wpupa_user_admin' ) ) ;
     71            add_submenu_page( 'wp-user-profile-avatar', 'Disable Comments', 'Disable Comments', 'manage_options', 'disable_comments_settings', array( $this, 'wpupa_comments_settings_page' ) );
     72            add_submenu_page( 'wp-user-profile-avatar', 'Delete Comments', 'Delete Comments', 'manage_options', 'disable_comments_tools', array( $this, 'wpupa_comments_tools_page' ) );
     73        }
     74    }
     75
     76    /**
     77     * Render the settings form for Avatar Social Picture.
     78     */
     79    public function wpupa_user_admin() {
     80        if( isset( $_POST['wp-avatar-add-social-picture'] ) ){
     81            $user_role = sanitize_text_field( $_POST['wp-avatar-add-social-picture'] );
     82            update_option( 'wpupa_user_role', $user_role );
     83        }
     84        $user_role = get_option( 'wpupa_user_role' );
     85
     86        ?>
     87        <form id="wp-avatar-settings" method="post" action="">
     88            <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3>
     89            <table class="form-table">
     90                <tr>
     91                    <th>
     92                        <label for="wp-avatar-capabilty">Role Required</label>
     93                    </th>
     94                    <td>
     95                        <select id="wp-avatar-add-social-picture" name="wp-avatar-add-social-picture">
     96                            <option value="read" <?php selected( $user_role, 'read' ); ?> >Subscriber</option>
     97                            <option value="edit-posts" <?php selected( $user_role, 'edit-posts' ); ?> >Contributor</option>
     98                            <option value="edit-published-posts" <?php selected( $user_role, 'edit-published-posts' ); ?> >Author</option>
     99                            <option value="moderate-comments" <?php selected( $user_role, 'moderate-comments' ); ?> >Editor</option>
     100                            <option value="activate-plugins" <?php selected( $user_role, 'activate-plugins' ); ?> >Administrator</option>
     101                        </select>
     102                    </td>
     103                </tr>
     104            </table>
     105            <p class="submit">
     106                <?php wp_nonce_field( 'submit', 'wp-user-profile-avatar-social' ); ?>
     107                <input type="submit" class="button button-primary" id="submit" value="Save Changes">
     108            </p>
     109        </form>
     110        <?php
    74111    }
    75112
     
    79116     * @since 1.0.2
    80117     */
    81     public function comments_settings_page() {
     118    public function wpupa_comments_settings_page() {
    82119        include 'templates/comments-settings-page.php';
    83120    }
     
    88125     * @since 1.0.2
    89126     */
    90     function comments_tools_page() {
     127    function wpupa_comments_tools_page() {
    91128        include 'templates/comments-tools-page.php';
    92129    }
     
    155192
    156193        // Custom uplaod file size
    157         $wpupa_max_size = get_option( 'wpem_max_file_size' );
     194        $wpupa_max_size = get_option( 'wpupa_max_file_size' );
    158195        if ( ! $wpupa_max_size ) {
    159196            $wpupa_max_size = 64 * 1024 * 1024;
     
    283320     * @since 1.0
    284321     */
    285     public function thickbox_model_view() {
     322    public function wpupa_thickbox_model_view() {
    286323        include_once WPUPA_PLUGIN_DIR . '/admin/templates/shortcode-popup.php';
    287324
     
    338375           
    339376            $wpupa_max_size = (int) $_POST['wpem-upload-max-file-size-field'] * 1024 * 1024;
    340             update_option( 'wpem_max_file_size', sanitize_text_field( $wpupa_max_size ) );
     377            update_option( 'wpupa_max_file_size', sanitize_text_field( $wpupa_max_size ) );
    341378            wp_safe_redirect( admin_url( 'upload.php?page=wpem_upload_max_file_size&max-size-updated=true' ) );
    342379        }
     
    359396
    360397    /**
    361      * Increase max_file_size
     398     * return upload max file size
    362399     */
    363400    public function wpem_upload_max_increase_upload() {
    364         $wpupa_max_size = (int) get_option( 'wpem_max_file_size' );
     401        $wpupa_max_size = (int) get_option( 'wpupa_max_file_size' );
    365402
    366403        if ( ! $wpupa_max_size ) {
  • wp-user-profile-avatar/trunk/admin/wp-user-profile-avatar-settings.php

    r3123813 r3149247  
    66
    77/**
    8  * WPUPA_Settings class.
     8 * Class with User Profile Settings functions.
    99 */
    1010class WPUPA_Settings {
     
    3939        $wpupa_rating           = get_option( 'wpupa_rating' );
    4040        $wpupa_file_size        = get_option( 'wpupa_file_size' );
    41         $wpupa_default          = get_option( 'wpupa_default' );
     41        $wpupa_default          = get_option( 'avatar_default' );
    4242        $wpupa_attachment_id    = get_option( 'wpupa_attachment_id' );
    43         $wpupa_attachment_url = get_option('wpupa_attachment_url') ? get_option('wpupa_attachment_url') : wpupa_get_default_avatar_url(array('size' => 'admin'));
     43        $wpupa_attachment_url = get_option('wpupa_attachment_url') ? get_option('wpupa_attachment_url') : wpupa_get_default_avatar_url(array('size' => 'admin'), array(), '');
    4444        $wpupa_size             = get_option( 'wpupa_size' );
    4545        $avatar_size            = get_option( 'avatar_size' );
    4646        $wpupa_hide_post_option = get_option( 'wpupa_hide_post_option' );
     47        // Get the current logged-in user object
     48        $current_user = wp_get_current_user();
     49
     50        // Retrieve the email of the logged-in user
     51        $user_email = $current_user->user_email;
    4752        ?>
    4853        <div class="wrap">
     
    152157                                            <?php $selected = ( $wpupa_default == 'wp_user_profile_avatar' ) ? 'checked="checked"' : ''; ?>
    153158                                            <label>
    154                                                 <input type="radio" name="wpupa_default" id="wp_user_profile_avatar_radio" value="wp_user_profile_avatar" <?php echo esc_attr( $selected ); ?> />
     159                                                <input type="radio" name="avatar_default" id="wp_user_profile_avatar_radio" value="wp_user_profile_avatar" <?php echo esc_attr( $selected ); ?> />
    155160                                                <div id="wp_user_profile_avatar_preview">
    156161                                                    <img src="<?php echo esc_url( $wpupa_attachment_url ); ?>" width="32" />
     
    172177                                                <input type="hidden" name="wpupaattachmentid" id="wpupaattachmentid" value="<?php echo esc_attr( $wpupa_attachment_id ); ?>">
    173178                                            </p>
    174 
     179 
    175180                                            <?php
    176181                                            if ( empty( $wpupa_disable_gravatar ) ) :
    177182                                                foreach ( wpupa_get_default_avatar() as $name => $label ) :
    178                                                     $avatar     = get_avatar( '', 32, $name );
    179                                                     $avatar_url = wpupa_get_selected_avatar_url( $name );
    180                                                     $selected = ( $wpupa_default == $name ) ? 'checked="checked"' : '';
    181                                                     ?>
    182                                                     <label><input type="radio" name="wpupa_default" value="<?php echo esc_attr( $name ); ?>" <?php echo esc_attr( $selected ); ?> />
    183                                                         <img alt='' src='<?php echo esc_attr( $avatar_url ); ?>' srcset='<?php echo esc_attr( $avatar_url ); ?>' class='avatar avatar-32 photo avatar-default' height='32' width='32' loading='lazy' decoding='async'/>
    184  
    185                                                         <?php echo esc_attr( $label ); ?>
     183                                                    $selected = ( $wpupa_default == $name ) ? 'checked="checked"' : ''; ?>
     184                                                    <label><input type="radio" name="avatar_default" value="<?php echo esc_attr( $name ); ?>" <?php echo esc_attr( $selected ); ?> />                                 
     185                                                       <?php echo get_avatar( $user_email, 32, $name );
     186                                                        echo esc_attr( $label ); ?>
    186187                                                    </label><br />
    187188                                                    <?php
     
    235236            $wpupa_file_size = ! empty( $_POST['wpupa_file_size'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_file_size'] ) ) : '';
    236237
    237             $wpupa_default = ! empty( $_POST['wpupa_default'] ) ? sanitize_text_field( wp_unslash( $_POST['wpupa_default'] ) ) : '';
     238            $wpupa_default = ! empty( $_POST['avatar_default'] ) ? sanitize_text_field( wp_unslash( $_POST['avatar_default'] ) ) : '';
    238239
    239240           if ( ! empty( $_POST['wpupaattachmentid'] ) ) {
     
    268269            update_option( 'wpupa_rating', $wpupa_rating );
    269270            update_option( 'wpupa_file_size', $wpupa_file_size );
    270             update_option( 'wpupa_default', $wpupa_default );
     271            update_option( 'avatar_default', $wpupa_default );
    271272            update_option( 'wpupa_attachment_id', $wpupa_attachment_id );
    272273            update_option( 'wpupa_attachment_url', $wpupa_attachment_url);
  • wp-user-profile-avatar/trunk/assets/css/frontend.css

    r3123813 r3149247  
    209209    width:150px;
    210210}
     211img.avatar{
     212    width: 100px;
     213    height: auto;
     214}
  • wp-user-profile-avatar/trunk/assets/css/frontend.min.css

    r3123813 r3149247  
    1 #wp-user-profile-avatar-errors,#wp-user-profile-avatar-readable-size-error,.wp-user-profile-avatar-error{color:#c00!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-success,#wp-user-profile-avatar-success,.wp-user-profile-avatar-success{color:#179a17!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-error,#wp-user-profile-avatar-undo-button,.wp-user-profile-avatar-no-avatars{display:none}#wp-user-profile-avatar-preview,#wp_user_profile_avatar_preview-existing{margin-right:10px}#wp-user-profile-avatar-preview,#wp-user-profile-avatar-thumbnail,#wp_user_profile_avatar_preview-existing,#wp_user_profile_avatar_thumbnail-existing{display:inline-block;text-align:center;vertical-align:top}#wp-user-profile-avatar-preview img,#wp-user-profile-avatar-thumbnail img,#wp_user_profile_avatar_preview-existing img,#wp_user_profile_avatar_thumbnail-existing img{max-height:96px;border:1px solid #dfdfdf;display:block}.widget_wp_user_profile_avatar #wp-user-profile-avatar-preview img,.widget_wp_user_profile_avatar #wp-user-profile-avatar-thumbnail img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_preview-existing img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_thumbnail-existing img{max-height:64px}.defaultavatarpicker #wp-user-profile-avatar-preview,.defaultavatarpicker #wp_user_profile_avatar_preview-existing{width:32px;height:32px;margin-right:0;display:inline-block;overflow:hidden;vertical-align:middle}.defaultavatarpicker #wp-user-profile-avatar-preview img,.defaultavatarpicker #wp_user_profile_avatar_preview-existing img{width:32px;height:auto;border:0}#wp-user-profile-avatar-edit #wp-user-profile-avatar-remove,#wp-user-profile-avatar-edit #wp-user-profile-avatar-undo,#wp-user-profile-avatar-edit-attachment{margin-left:10px!important}#wp-user-profile-avatar-slider{width:22.75em}#wp-user-profile-avatar-upload-messages span{display:block}.wp-user-profile-avatar-hide{display:none!important}.wp-user-profile-avatar .alignleft{float:left;margin:.3rem 2rem 2rem}.wp-user-profile-avatar .alignright{float:right;margin:.3rem 0 2rem 2rem}.wp-user-profile-avatar .aligncenter,.wp-user-profile-avatar .alignnone{margin:4rem auto;text-align:center}.author-bio-section{border:1px solid #111;padding:15px 25px;margin-top:20px}.author-bio-section .author_details{display:flex;align-items:flex-start;margin-bottom:10px}.author-bio-section .author-image{margin:10px 0}.author-bio-section .author-image img{width:100px;margin-right:15px;display:block}.author-bio-section .author-info .author-bio,.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing{margin:0}.author-bio-section .author-flex{display:grid;grid-template-columns:100px auto;align-items:center;margin-bottom:10px}.author-bio-section .author-info{margin-left:20px}.author-bio-section .author-info .author-name{font-weight:500;text-transform:capitalize}.author-bio-section .authorbox-social-icons{border-top:1px solid #111;margin:0 0 10px;padding-top:20px}.update-user-profile-avatar td,.update-user-profile-avatar th{border-color:#eee;padding:20px}.update-user-profile-avatar #wpupa_url{width:100%;max-width:500px;border-color:var(--wpem-gray-border-color);padding:10px}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button{border:1px solid var(--wpem-gray-border-color);background-color:var(--wpem-gray-bg-color);padding:10px 20px;cursor:pointer}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button:hover{background-color:var(--wpem-gray-border-color);color:var(--wpem-dark-color)}.update-user-profile-avatar #wp-user-profile-avatar-remove-button,.update-user-profile-avatar #wp-user-profile-avatar-undo-button,.update-user-profile-avatar #wp_user_profile_avatar_preview,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail{margin-bottom:0}.update-user-profile-avatar #wp_user_profile_avatar_preview img,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail img{margin-bottom:5px}#wp-user-profile-avatar-undo-button{margin-top:10px}.size-large{width:1024px;}.size-medium{width:300px;}.size-thumbnail{width:150px;}
     1#wp-user-profile-avatar-errors,#wp-user-profile-avatar-readable-size-error,.wp-user-profile-avatar-error{color:#c00!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-success,#wp-user-profile-avatar-success,.wp-user-profile-avatar-success{color:#179a17!important;font-weight:700!important}#wp-user-profile-avatar-readable-size-error,#wp-user-profile-avatar-undo-button,.wp-user-profile-avatar-no-avatars{display:none}#wp-user-profile-avatar-preview,#wp_user_profile_avatar_preview-existing{margin-right:10px}#wp-user-profile-avatar-preview,#wp-user-profile-avatar-thumbnail,#wp_user_profile_avatar_preview-existing,#wp_user_profile_avatar_thumbnail-existing{display:inline-block;text-align:center;vertical-align:top}#wp-user-profile-avatar-preview img,#wp-user-profile-avatar-thumbnail img,#wp_user_profile_avatar_preview-existing img,#wp_user_profile_avatar_thumbnail-existing img{max-height:96px;border:1px solid #dfdfdf;display:block}.widget_wp_user_profile_avatar #wp-user-profile-avatar-preview img,.widget_wp_user_profile_avatar #wp-user-profile-avatar-thumbnail img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_preview-existing img,.widget_wp_user_profile_avatar #wp_user_profile_avatar_thumbnail-existing img{max-height:64px}.defaultavatarpicker #wp-user-profile-avatar-preview,.defaultavatarpicker #wp_user_profile_avatar_preview-existing{width:32px;height:32px;margin-right:0;display:inline-block;overflow:hidden;vertical-align:middle}.defaultavatarpicker #wp-user-profile-avatar-preview img,.defaultavatarpicker #wp_user_profile_avatar_preview-existing img{width:32px;height:auto;border:0}#wp-user-profile-avatar-edit #wp-user-profile-avatar-remove,#wp-user-profile-avatar-edit #wp-user-profile-avatar-undo,#wp-user-profile-avatar-edit-attachment{margin-left:10px!important}#wp-user-profile-avatar-slider{width:22.75em}#wp-user-profile-avatar-upload-messages span{display:block}.wp-user-profile-avatar-hide{display:none!important}.wp-user-profile-avatar .alignleft{float:left;margin:.3rem 2rem 2rem}.wp-user-profile-avatar .alignright{float:right;margin:.3rem 0 2rem 2rem}.wp-user-profile-avatar .aligncenter,.wp-user-profile-avatar .alignnone{margin:4rem auto;text-align:center}.author-bio-section{border:1px solid #111;padding:15px 25px;margin-top:20px}.author-bio-section .author_details{display:flex;align-items:flex-start;margin-bottom:10px}.author-bio-section .author-image{margin:10px 0}.author-bio-section .author-image img{width:100px;margin-right:15px;display:block}.author-bio-section .author-info .author-bio,.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing{margin:0}.author-bio-section .author-flex{display:grid;grid-template-columns:100px auto;align-items:center;margin-bottom:10px}.author-bio-section .author-info{margin-left:20px}.author-bio-section .author-info .author-name{font-weight:500;text-transform:capitalize}.author-bio-section .authorbox-social-icons{border-top:1px solid #111;margin:0 0 10px;padding-top:20px}.update-user-profile-avatar td,.update-user-profile-avatar th{border-color:#eee;padding:20px}.update-user-profile-avatar #wpupa_url{width:100%;max-width:500px;border-color:var(--wpem-gray-border-color);padding:10px}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button{border:1px solid var(--wpem-gray-border-color);background-color:var(--wpem-gray-bg-color);padding:10px 20px;cursor:pointer}.update-user-profile-avatar #wp-user-profile-avatar-add-button-existing .button:hover{background-color:var(--wpem-gray-border-color);color:var(--wpem-dark-color)}.update-user-profile-avatar #wp-user-profile-avatar-remove-button,.update-user-profile-avatar #wp-user-profile-avatar-undo-button,.update-user-profile-avatar #wp_user_profile_avatar_preview,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail{margin-bottom:0}.update-user-profile-avatar #wp_user_profile_avatar_preview img,.update-user-profile-avatar #wp_user_profile_avatar_thumbnail img{margin-bottom:5px}#wp-user-profile-avatar-undo-button{margin-top:10px}.size-large{width:1024px;}.size-medium{width:300px;}.size-thumbnail{width:150px;}img.avatar{width: 100px;height: auto;}
  • wp-user-profile-avatar/trunk/includes/wp-author-box-social-info.php

    r3123813 r3149247  
    1111
    1212/**
    13  * Class WPUPA_User_Social_Info
     13 * Class contain detail of user social info
    1414 *
    1515 * Adds social contact information to user profiles and displays it in the author box.
     
    2121     */
    2222    public function __construct() {
    23         add_filter( 'user_contactmethods', [ $this, 'add_user_social_contact_info' ] );
    24         add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_fontawesome_styles' ] );
    25         add_filter( 'the_content', [ $this, 'author_social_info_box' ] );
     23        add_filter( 'user_contactmethods', [ $this, 'wpupa_add_user_social_contact_info' ] );
     24        add_action( 'wp_enqueue_scripts', [ $this, 'wpupa_enqueue_fontawesome_styles' ] );
     25        add_filter( 'the_content', [ $this, 'wpupa_author_social_info_box' ] );
    2626        remove_filter( 'pre_user_description', 'wp_filter_kses' );
    2727    }
     
    3333     * @return array Modified user contact methods array.
    3434     */
    35     public function add_user_social_contact_info( $user_contact ) {
     35    public function wpupa_add_user_social_contact_info( $user_contact ) {
    3636        $user_contact['facebook']   = esc_html__( 'Facebook URL','wp-user-profile-avatar' );
    3737        $user_contact['skype']      = esc_html__( 'Skype','wp-user-profile-avatar' );
     
    4949     * Enqueue Font Awesome styles.
    5050     */
    51     public function enqueue_fontawesome_styles() {
     51    public function wpupa_enqueue_fontawesome_styles() {
    5252        wp_register_style( 'fontawesome', WPUPA_PLUGIN_URL . '/assets/lib/fontawesome/all.css', '', '4.4.0', 'all' );
    5353        wp_enqueue_style( 'fontawesome' );
     
    6060     * @return string Modified post content.
    6161     */
    62     public function author_social_info_box( $content ) {
     62    public function wpupa_author_social_info_box( $content ) {
    6363        global $post;
    6464
     
    8686            $user_link_avatar = get_the_author_meta( '_wpupa_url' );
    8787            $user_option_id = get_option( 'wpupa_attachment_id' );
    88             $user_avatar = get_option( 'wpupa_default' );
     88            $user_avatar = get_option( 'avatar_default' );
    8989
    9090            if ( $user_avatar == 'gravatar_default' ) {
  • wp-user-profile-avatar/trunk/includes/wp-avatar-social profile-picture.php

    r3123813 r3149247  
    2222    public function __construct() {
    2323        add_action( 'wp_enqueue_scripts', array( $this, 'wpupa_avatar_social_profile_picture' ) );
    24         add_action( 'admin_menu', array( $this, 'wpupa_avatar_users_menu' ) );
    2524        add_action( 'show_user_profile', array( $this, 'wpupa_user_add_extra_profile_picture_fields' ) );
    2625        add_action( 'edit_user_profile', array( $this, 'wpupa_user_add_extra_profile_picture_fields' ) );
     
    4544
    4645    /**
    47      * Add users page for Avatar Social Picture settings.
    48      */
    49     public function wpupa_avatar_users_menu() {
    50         add_users_page( 'Avatar Social Picture', 'Avatar Social Picture', 'activate_plugins', 'avatar-social-picture', array( $this, 'wpupa_user_admin' ) );
    51     }
    52 
    53     /**
    54      * Render the settings form for Avatar Social Picture.
    55      */
    56     public function wpupa_user_admin() {
    57         $wp_avatar_add_social_picture = get_option( 'wp_avatar_add_social_picture' );
    58         ?>
    59         <form id="wp-avatar-settings" method="post" action="">
    60             <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3>
    61             <table class="form-table">
    62                 <tr>
    63                     <th>
    64                         <label for="wp-avatar-capabilty">Role Required</label>
    65                     </th>
    66                     <td>
    67                         <select id="wp-avatar-add-social-picture" name="wp-avatar-add-social-picture">
    68                             <option value="read" <?php selected( $wp_avatar_add_social_picture, 'read' ); ?> >Subscriber</option>
    69                             <option value="edit-posts" <?php selected( $wp_avatar_add_social_picture, 'edit-posts' ); ?> >Contributor</option>
    70                             <option value="edit-published-posts" <?php selected( $wp_avatar_add_social_picture, 'edit-published-posts' ); ?> >Author</option>
    71                             <option value="moderate-comments" <?php selected( $wp_avatar_add_social_picture, 'moderate-comments' ); ?> >Editor</option>
    72                             <option value="activate-plugins" <?php selected( $wp_avatar_add_social_picture, 'activate-plugins' ); ?> >Administrator</option>
    73                         </select>
    74                     </td>
    75                 </tr>
    76             </table>
    77             <p class="submit">
    78                 <?php wp_nonce_field( 'submit', 'wp-user-profile-avatar-social' ); ?>
    79                 <input type="submit" class="button button-primary" id="submit" value="Save Changes">
    80             </p>
    81         </form>
    82         <?php
    83     }
    84 
    85     /**
    8646     * Save the WP Avatar social profile settings.
    8747     */
     
    9353                return;
    9454            }
    95             update_user_meta( $user_id, 'wp_social_fb_profile', trim( sanitize_text_field( $_POST['fb-profile'] ) ) );
    96             update_user_meta( $user_id, 'wp_social_gplus_profile', trim( sanitize_text_field( $_POST['gplus-profile'] ) ) );
    97             update_user_meta( $user_id, 'wp_user_social_profile', sanitize_text_field( $_POST['wp-user-social-profile'] ) );
     55            // update_user_meta( $user_id, 'wp_social_fb_profile', trim( sanitize_text_field( $_POST['fb-profile'] ) ) );
     56            // update_user_meta( $user_id, 'wp_social_gplus_profile', trim( sanitize_text_field( $_POST['gplus-profile'] ) ) );
     57            // update_user_meta( $user_id, 'wp_user_social_profile', sanitize_text_field( $_POST['wp-user-social-profile'] ) );
     58            // update_user_meta( $user_id, 'wp_user_social_linkedin_profile', sanitize_text_field( $_POST['linkedin-profile'] ) );
     59            // update_user_meta( $user_id, 'wp_social_youtube_profile', sanitize_text_field( $_POST['youtube-profile'] ) );
     60            // update_user_meta( $user_id, 'wp_social_twitter_profile', sanitize_text_field( $_POST['twitter-profile'] ) );
     61            // update_user_meta( $user_id, 'wp_social_github_profile', sanitize_text_field( $_POST['github-profile'] ) );
     62            // update_user_meta( $user_id, 'wp_social_yahoo_profile', sanitize_text_field( $_POST['yahoo-profile'] ) );
    9863        endif;
    9964    }
     
    11176        $wp_social_fb_profile    = get_user_meta( $socialprofile->ID, 'wp_social_fb_profile', true );
    11277        $wp_social_gplus_profile = get_user_meta( $socialprofile->ID, 'wp_social_gplus_profile', true );
    113         ?>
    114 
    115         <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3>
     78        $wp_social_linkedin_profile = get_user_meta( $socialprofile->ID, 'wp_user_social_linkedin_profile', true );
     79        $wp_social_youtube_profile = get_user_meta( $socialprofile->ID, 'wp_social_youtube_profile', true );
     80        $wp_social_twitter_profile   = get_user_meta( $socialprofile->ID, 'wp_social_twitter_profile', true );
     81        $wp_social_github_profile    = get_user_meta( $socialprofile->ID, 'wp_social_github_profile', true );
     82        $wp_social_yahoo_profile     = get_user_meta( $socialprofile->ID, 'wp_social_yahoo_profile', true );
     83       ?>
     84
     85       <!-- <h3><?php esc_html_e( 'WP Avatar User Role Settings', 'wp-user-profile-avatar' ); ?></h3>
    11686        <table class="form-table">
    11787            <tr>
     
    156126                </td>
    157127            </tr>
    158         </table>
     128            <tr>
     129                <th>
     130                    <label for="linkedin-profile">LinkedIn Profile URL</label>
     131                </th>
     132                <td>
     133                    <input type="text" name="linkedin-profile" id="linkedin-profile" value="<?php echo esc_attr( $wp_social_linkedin_profile ); ?>" class="regular-text" />&nbsp;
     134                    <span><a href="https://www.linkedin.com/" target="_blank">Visit LinkedIn</a></span>
     135                </td>
     136            </tr>
     137            <tr>
     138                <th>
     139                    <label for="use-linkedin-profile">Use LinkedIn Profile as Avatar</label>
     140                </th>
     141                <td>
     142                    <input type="checkbox" name="wp-user-social-profile" value="wp-linkedin" <?php checked( $wp_user_social_profile, 'wp-linkedin' ); ?> >
     143                </td>
     144            </tr>
     145            <tr>
     146                <th>
     147                    <label for="youtube-profile">YouTube Profile ID</label>
     148                </th>
     149                <td>
     150                    <input type="text" name="youtube-profile" id="youtube-profile" value="<?php echo esc_attr( $wp_social_youtube_profile ); ?>" class="regular-text" />&nbsp;
     151                    <span><a href="https://www.youtube.com/" target="_blank">Visit YouTube</a></span>
     152                </td>
     153            </tr>
     154            <tr>
     155                <th>
     156                    <label for="use-youtube-profile">Use YouTube Profile as Avatar</label>
     157                </th>
     158                <td>
     159                    <input type="checkbox" name="wp-user-social-profile" value="wp-youtube" <?php checked( $wp_user_social_profile, 'wp-youtube' ); ?> >
     160                </td>
     161            </tr>
     162            <tr>
     163                <th>
     164                    <label for="twitter-profile">Twitter Username</label>
     165                </th>
     166                <td>
     167                    <input type="text" name="twitter-profile" id="twitter-profile" value="<?php echo esc_attr( $wp_social_twitter_profile ); ?>" class="regular-text" />&nbsp;
     168                    <span><a href="https://twitter.com/" target="_blank">Visit Twitter</a></span>
     169                </td>
     170            </tr>
     171            <tr>
     172                <th>
     173                    <label for="use-twitter-profile">Use Twitter Profile as Avatar</label>
     174                </th>
     175                <td>
     176                    <input type="checkbox" name="wp-user-social-profile" value="wp-twitter" <?php checked( $wp_user_social_profile, 'wp-twitter' ); ?> >
     177                </td>
     178            </tr>
     179            <tr>
     180                <th>
     181                    <label for="github-profile">GitHub Username</label>
     182                </th>
     183                <td>
     184                    <input type="text" name="github-profile" id="github-profile" value="<?php echo esc_attr( $wp_social_github_profile ); ?>" class="regular-text" />&nbsp;
     185                    <span><a href="https://github.com/" target="_blank">Visit GitHub</a></span>
     186                </td>
     187            </tr>
     188            <tr>
     189                <th>
     190                    <label for="use-github-profile">Use GitHub Profile as Avatar</label>
     191                </th>
     192                <td>
     193                    <input type="checkbox" name="wp-user-social-profile" value="wp-github" <?php checked( $wp_user_social_profile, 'wp-github' ); ?> >
     194                </td>
     195            </tr>
     196            <tr>
     197                <th>
     198                    <label for="yahoo-profile">Yahoo Profile ID</label>
     199                </th>
     200                <td>
     201                    <input type="text" name="yahoo-profile" id="yahoo-profile" value="<?php echo esc_attr( $wp_social_yahoo_profile ); ?>" class="regular-text" />&nbsp;
     202                    <span><a href="https://www.yahoo.com/" target="_blank">Visit Yahoo</a></span>
     203                </td>
     204            </tr>
     205            <tr>
     206                <th>
     207                    <label for="use-yahoo-profile">Use Yahoo Profile as Avatar</label>
     208                </th>
     209                <td>
     210                    <input type="checkbox" name="wp-user-social-profile" value="wp-yahoo" <?php checked( $wp_user_social_profile, 'wp-yahoo' ); ?> >
     211                </td>
     212            </tr>
     213        </table>-->
    159214        <?php
    160215    }
  • wp-user-profile-avatar/trunk/includes/wp-user-profile-avatar-install.php

    r3106296 r3149247  
    77
    88/**
    9  * WPUPA_Install class.
     9 * Class with Installation functions.
    1010 */
    1111class WPUPA_Install {
     
    2121    public static function install() {
    2222
    23         update_option( 'wpupa_default', esc_attr( 'mystery' ) );
     23        //update_option( 'avatar_default', esc_attr( 'mystery' ) );
    2424        update_option( 'wpupa_version', esc_attr( WPUPA_VERSION ) );
    2525    }
  • wp-user-profile-avatar/trunk/includes/wp-user-profile-avatar-user.php

    r3123813 r3149247  
    66}
    77/**
    8  * WPUPA_User class.
     8 * Class with User details functions .
    99 */
    1010class WPUPA_User {
     
    1414    public function __construct() {
    1515        add_filter( 'get_avatar_url', array( $this, 'wpupa_get_user_avatar_url' ), 10, 3 );
    16         add_filter('get_avatar', array( $this, 'wpupa_integrate_user_avatar_to_bbpress_profile' ), 10, 5);
     16        add_filter( 'get_avatar', array( $this, 'wpupa_integrate_user_avatar_to_bbpress_profile' ), 10, 5);
    1717    }
    1818    /**
    19      * wpupa_get_user_avatar_url function.
     19     * return user profile avatar url.
    2020     *
    2121     * @access public
     
    2929        $wpupa_show_avatars = esc_attr( get_option( 'wpupa_show_avatars' ) );
    3030
    31         $wpupa_default = esc_attr( get_option( 'wpupa_default' ) );
     31        $wpupa_default = esc_attr( get_option( 'avatar_default' ) );
    3232
    3333        if ( ! $wpupa_show_avatars ) {
     
    4949            }
    5050        }
    51 
     51 
    5252        // First checking custom avatar.
    5353        if ( wpupa_check_wpupa_url( $user_id ) ) {
    54             $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );
     54            $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url);
    5555        } elseif ( $wpupa_disable_gravatar ) {
    56             $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );
     56            $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args , $url);
    5757        } else {
    5858            $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email );
    5959            if ( ! $has_valid_url ) {
    60                 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );
     60                $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args, $url );
    6161            } else {
    6262                if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) {
    63                     $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );
     63                    $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url);
    6464                }
    6565            }
     
    6868    }
    6969    /**
    70      * wpupa_integrate_user_avatar_to_bbpress_profile function.
     70     * Integrate the user profile avatar with bbpress profile function.
    7171     *
    7272     * @access public
     
    7575     * @since 1.0
    7676     */
    77     public function wpupa_integrate_user_avatar_to_bbpress_profile($avatar, $id_or_email, $size, $default, $alt) {
     77    public function wpupa_integrate_user_avatar_to_bbpress_profile( $avatar, $id_or_email, $size, $default, $alt ) {
    7878       
    7979        // Get the user ID
    80         if (is_numeric($id_or_email)) {
    81             $user_id = (int) $id_or_email;
    82         } elseif (is_object($id_or_email)) {
     80        if ( is_numeric( $id_or_email ) ) {
     81            $user_id = ( int ) $id_or_email;
     82        } elseif ( is_object( $id_or_email ) ) {
    8383            $user_id = $id_or_email->user_id;
    8484        } else {
    85             $user = get_user_by('email', $id_or_email);
     85            $user = get_user_by( 'email', $id_or_email );
    8686            $user_id = $user ? $user->ID : 0;
    8787        }
     
    9191        $image_source = wp_get_attachment_image_src( $attachment_id );
    9292         
    93         if ($image_source) {
     93        if ( $image_source ) {
    9494            $avatar = "<img alt='{$alt}' src='{$image_source[0]}' class='avatar avatar-{$size} photo' height='{$image_source[2]}' width='{$image_source[1]}' />";
    9595        }
  • wp-user-profile-avatar/trunk/readme.txt

    r3123813 r3149247  
    11=== WP User Profile Avatar ===
    22
    3 Contributors: wpeventmanager,ashokdudhat,hiteshmakvana
     3Contributors: wpeventmanager,ashokdudhat,krinaydhanani
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=55FRYATTFLA5N
    55Tags: avatar, user profile, gravatar,custom profile photo, custom profile picture, profile photo, profile picture, author image, author photo
    66Requires at least: 5.8
    77Tested up to: 6.5.4
    8 Stable tag: 1.0.4
     8Stable tag: 1.0.5
    99Requires PHP: 8.0.2
    1010License: GNU General Public License v3.0
     
    327327
    328328== Changelog ==
     329
     330= 1.0.5 [Sept 9th, 2024] =
     331
     332Fixed: Admin profile is not display.
     333Fixed: After updating plugin user profile image as set Mystery Man image.
     334Fixed: User Profile is not update from User Profile Avatar Settings Page.
     335Fixed: Correct setting name.
     336Fixed: Delete comment - Post is unable to delete.
     337Fixed: Delete Comment - Check marked again visible in the box.
     338Fixed: Admin profile image is missing from comment.
    329339
    330340= 1.0.4 [July 19th, 2024] =
  • wp-user-profile-avatar/trunk/shortcodes/wp-author-social-info-shortcodes.php

    r3123813 r3149247  
    1616
    1717    /**
    18      * wpupa_authorbox_social_link function
     18     * return current user's social info authorbox function
    1919     *
    2020     * @access public
  • wp-user-profile-avatar/trunk/shortcodes/wp-user-profile-avatar-shortcodes.php

    r3123813 r3149247  
    1616        add_shortcode( 'all_user_avatars', array( $this, 'wpupa_all_user_avatars' ) );
    1717
    18         add_action( 'wp_ajax_update_user_avatar', array( $this, 'update_user_avatar' ) );
    19 
    20         add_action( 'wp_ajax_remove_user_avatar', array( $this, 'remove_user_avatar' ) );
    21 
    22         add_action( 'wp_ajax_undo_user_avatar', array( $this, 'undo_user_avatar' ) );
     18        add_action( 'wp_ajax_update_user_avatar', array( $this, 'wpupa_update_user_avatar' ) );
     19
     20        add_action( 'wp_ajax_remove_user_avatar', array( $this, 'wpupa_remove_user_avatar' ) );
     21
     22        add_action( 'wp_ajax_undo_user_avatar', array( $this, 'wpupa_undo_user_avatar' ) );
    2323
    2424        add_filter( 'get_avatar_url', array( $this, 'wpupa_get_user_avatar_url' ), 10, 3 );
     
    415415
    416416    /**
    417      * update_user_avatar function.
     417     * wpupa_update_user_avatar function.
    418418     *
    419419     * @access public
     
    422422     * @since 1.0
    423423     */
    424     public function update_user_avatar() {
     424    public function wpupa_update_user_avatar() {
    425425        check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' );
    426426
     
    511511
    512512    /**
    513      * remove_user_avatar function.
     513     * wpupa_remove_user_avatar function.
    514514     *
    515515     * @access public
     
    518518     * @since 1.0
    519519     */
    520     public function remove_user_avatar() {
     520    public function wpupa_remove_user_avatar() {
    521521        check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' );
    522522
     
    530530
    531531        if ( $current_user_id == $user_id ) :
    532             if ( isset( $user_id ) ) {
    533                 update_user_meta( $user_id, '_wpupaattachmentid', '' );
     532            if ( isset( $user_id ) ) { 
     533                update_user_meta( $user_id, '_wpupa_attachment_id', '' );
    534534                update_user_meta( $user_id, '_wpupa_url', '' );
    535535                update_user_meta( $user_id, '_wpupa_default', '' );
     
    567567
    568568    /**
    569      * undo_user_avatar function.
     569     * wpupa_undo_user_avatar function.
    570570     *
    571571     * @access public
     
    574574     * @since 1.0
    575575     */
    576     public function undo_user_avatar() {
     576    public function wpupa_undo_user_avatar() {
    577577        check_ajax_referer( '_nonce_user_profile_avatar_security', 'security' );
    578578
     
    587587        if ( $current_user_id == $user_id ) :
    588588            if ( isset( $user_id ) ) {
    589                 update_user_meta( $user_id, '_wpupaattachmentid', '' );
     589                update_user_meta( $user_id, '_wpupa_attachment_id', '' );
    590590                update_user_meta( $user_id, '_wpupa_url', '' );
    591591                update_user_meta( $user_id, '_wpupa_default', '' );
     
    642642     */
    643643    public function wpupa_get_user_avatar_url( $url, $id_or_email, $args ) {
    644 
    645644        $wpupa_disable_gravatar = get_option( 'wpupa_disable_gravatar' );
    646645
    647646        $wpupa_show_avatars = get_option( 'wpupa_show_avatars' );
    648647
    649         $wpupa_default = get_option( 'wpupa_default' );
    650 
     648        $wpupa_default = get_option( 'avatar_default' );
     649       
    651650        if ( ! $wpupa_show_avatars ) {
    652651            return false;
    653652        }
    654653        $user_id = null;
     654        if ( is_admin() ) {
     655            $screen = get_current_screen();
     656        }else{
     657            $screen = array();
     658        }
    655659        if ( is_object( $id_or_email ) ) {
    656660            if ( ! empty( $id_or_email->comment_author_email ) ) {
     
    658662            }
    659663        } else {
    660             if ( is_email( $id_or_email ) ) {
    661                 $user = get_user_by( 'email', $id_or_email );
    662                 if ( $user ) {
    663                     $user_id = $user->ID;
     664            if ( is_email( $id_or_email )) {
     665                if($screen->base !== 'options-discussion' && ($screen->base !== 'admin.php' && isset($_GET['page']) && $_GET['page'] !== 'wp-user-profile-avatar')){
     666                    $user = get_user_by( 'email', $id_or_email );
     667                    if ( $user ) {
     668                        $user_id = $user->ID;
     669                    }
    664670                }
    665671            } else {
     
    667673            }
    668674        }
    669 
     675 
    670676        // First checking custom avatar.
    671         if ( get_current_user_id() == $user_id || is_admin() ) {
    672             if ( wpupa_check_wpupa_url( $user_id ) ) {
    673                 $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );
    674             } elseif ( $wpupa_disable_gravatar ) {
    675                 $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );
    676             } else {
    677                 $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email );
    678                 if ( ! $has_valid_url ) {
    679                     $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ) );
    680                 } else {
    681                     if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) {
    682                         $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) );
     677        if ( wpupa_check_wpupa_url( $user_id ) ) {
     678            $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url);
     679        } elseif ( $wpupa_disable_gravatar ) {
     680            $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail', $args, $url ) );
     681        } else {
     682            $has_valid_url = wpupa_check_wpupa_gravatar( $id_or_email );
     683            if ( ! $has_valid_url ) {
     684                if ( is_object( $screen ) && property_exists( $screen, 'base' ) ) {
     685                    if($screen->base !== 'profile' && $wpupa_default !== 'wp_user_profile_avatar' ){
     686                        return $url;
    683687                    }
    684688                }
     689                $url = wpupa_get_default_avatar_url( array( 'size' => 'thumbnail' ), $args, $url );
     690            } else {
     691                if ( $wpupa_default != 'wp_user_profile_avatar' && ! empty( $user_id ) ) {
     692                    $url = wpupa_get_url( $user_id, array( 'size' => 'thumbnail' ) , $args, $url);
     693                }
    685694            }
    686695        }
     696       
    687697        return $url;
    688698    }
  • wp-user-profile-avatar/trunk/templates/wp-display-user-avatar-list.php

    r3123813 r3149247  
    5555        }
    5656    } else { ?>
    57         <p><?php echo esc_html__( 'No avatars available' ); ?></p>
     57        <p><?php echo esc_html__( 'No avatars available', 'wp-user-profile-avatar' ); ?></p>
    5858    <?php } ?>
    5959
  • wp-user-profile-avatar/trunk/wp-user-profile-avatar-disable-comments.php

    r3123813 r3149247  
    1414function wpupa_init_filters() {
    1515
    16     $options = get_option( 'disable_comments_mode', false );
     16    $options = get_option( 'wpupa_disable_comments_mode', false );
    1717
    1818    if ( is_array( $options ) && isset( $options['remove_everywhere'] ) ) {
     
    3333function wpupa_init_wploaded_filters() {
    3434   
    35     $mode = get_option( 'disable_comments_mode', '' );
    36     $disabled_post_types = get_option( 'disabled_post_types', array() );
     35    $mode = get_option( 'wpupa_disable_comments_mode', '' );
     36    $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() );
    3737
    3838    if ( ! empty( $disabled_post_types ) ) {
     
    110110 */
    111111function wpupa_is_post_type_disabled( $type ) {
    112     $disabled_post_types = get_option( 'disabled_post_types', array() );
     112    $disabled_post_types = get_option( 'wpupa_disabled_post_types', array() );
    113113    return in_array( $type, $disabled_post_types );
    114114}
     
    124124
    125125function wpupa_check_comment_template() {
    126     $mode = get_option( 'disable_comments_mode', '' );
     126    $mode = get_option( 'wpupa_disable_comments_mode', '' );
    127127    if ( is_singular() && (  'remove_everywhere' === $mode || wpupa_is_post_type_disabled( get_post_type() ) ) ) {
    128128        if ( ! defined( 'DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE' ) || DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE == true ) {
  • wp-user-profile-avatar/trunk/wp-user-profile-avatar-functions.php

    r3123813 r3149247  
    7474                'monsterid'        => __( 'MonsterID (Generated)', 'wp-user-profile-avatar' ),
    7575                'retro'            => __( 'Retro (Generated)', 'wp-user-profile-avatar' ),
     76                'robohash'         => __( 'RoboHash (Generated)' ),
    7677            )
    7778        );
     
    7980}
    8081
    81 if ( ! function_exists( 'wpupa_get_selected_avatar_url' ) ) {
    82 
    83     /**
    84      * wpupa_get_selected_avatar_url function used to retrive avatr image based on avatar.
    85      *
    86      * @access public
    87      * @param string
    88      * @return string
    89      * @since 1.0.2
    90      */
    91     function wpupa_get_selected_avatar_url( $name ) {
    92         $avatar_urls = apply_filters(
    93             'wp_user_default_avatar_urls',
    94             array(
    95                 'mystery'          => 'https://2.gravatar.com/avatar/?s=32&d=mystery&r=g&forcedefault=1',
    96                 'blank'            => 'https://2.gravatar.com/avatar/?s=32&d=blank&r=g&forcedefault=1',
    97                 'gravatar_default' => 'https://2.gravatar.com/avatar/?s=32&r=g&forcedefault=1',
    98                 'identicon'        => 'https://2.gravatar.com/avatar/?s=32&d=identicon&r=g&forcedefault=1',
    99                 'wavatar'          => 'https://2.gravatar.com/avatar/?s=32&d=wavatar&r=g&forcedefault=1',
    100                 'monsterid'        => 'https://2.gravatar.com/avatar/?s=32&d=monsterid&r=g&forcedefault=1',
    101                 'retro'            => 'https://2.gravatar.com/avatar/?s=32&d=retro&r=g&forcedefault=1',
    102             )
    103         );
    104 
    105         return $avatar_urls[ $name ];
    106     }
    107 }
    108 
    10982if ( ! function_exists( 'wpupa_get_default_avatar_url' ) ) {
    11083
     
    11790     * @since 1.0
    11891     */
    119     function wpupa_get_default_avatar_url( $args = array() ) {
     92    function wpupa_get_default_avatar_url( $args = array(), $avatar_args = array(), $url = '') {
    12093
    12194        $size          = ! empty( $args['size'] ) ? $args['size'] : 'thumbnail';
    12295        $user_id       = ! empty( $args['user_id'] ) ? $args['user_id'] : '';
    123         $wpupa_default = get_option( 'wpupa_default' );
     96        $wpupa_default = isset($avatar_args['default']) ? $avatar_args['default'] : get_option( 'avatar_default' );
    12497        $avatar_size   = get_option( 'avatar_size' );
    12598        if ( $avatar_size ) {
    12699            $size = get_option( 'avatar_size' );
    127100        }
     101        if($wpupa_default !== 'wp_user_profile_avatar' ) {
     102            return $url;
     103        }
    128104        if ( $wpupa_default == 'wp_user_profile_avatar' || $size == 'admin' ) {
    129105            $attachment_id = get_option( 'wpupa_attachment_id' );
     
    131107            if ( ! empty( $attachment_id ) ) {
    132108                $image_attributes = wp_get_attachment_image_src( $attachment_id, $size );
    133 
    134109                if ( ! empty( $image_attributes ) ) {
    135110                    return $image_attributes[0];
     
    180155     * @since 1.0
    181156     */
    182     function wpupa_get_url( $user_id, $args = array() ) {
     157    function wpupa_get_url( $user_id, $args = array(), $avatar_args = array(), $url = '') {
    183158        $size = ! empty( $args['size'] ) ? $args['size'] : 'thumbnail';
    184159
     
    210185                        'user_id' => $user_id,
    211186                        'size'    => $size,
    212                     )
     187                    ), $avatar_args, $url
    213188                );
    214189            }
     
    218193                    'user_id' => $user_id,
    219194                    'size'    => $size,
    220                 )
     195                ),$avatar_args, $url
    221196            );
    222197        }
     
    262237        $wp_user_hash_gravatar = get_option( 'wp_user_hash_gravatar' );
    263238
    264         $wpupa_default = get_option( 'wpupa_default' );
     239        $wpupa_default = get_option( 'avatar_default' );
    265240
    266241        if ( trim( $wpupa_default ) != 'wp_user_profile_avatar' ) {
     
    455430    add_filter( 'upload_size_limit', 'wpupa_file_size_limit' );
    456431}
    457 if ( ! function_exists( 'delete_comments_everywhere' ) ) {
     432if ( ! function_exists( 'wpupa_delete_comments_everywhere' ) ) {
    458433   
    459434    /**
     
    467442     * @since 1.0
    468443     */
    469     function delete_comments_everywhere() {
     444    function wpupa_delete_comments_everywhere() {
    470445        global $wpdb;
    471         return $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE 1=1" );
    472     }
    473 }
    474 
    475 if ( ! function_exists( 'delete_comments_by_post_types' ) ) {
     446        $result = $wpdb->query( "DELETE FROM {$wpdb->comments} WHERE 1=1" );
     447
     448        $post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts}" );
     449        foreach ( $post_ids as $post_id ) {
     450            wp_update_comment_count_now( $post_id );
     451        }
     452
     453        return $result;
     454    }
     455}
     456
     457if ( ! function_exists( 'wpupa_delete_comments_by_post_types' ) ) {
    476458   
    477459    /**
     
    485467     * @since 1.0
    486468     */
    487     function delete_comments_by_post_types( $post_types ) {
     469    function wpupa_delete_comments_by_post_types( $post_types ) {
    488470        global $wpdb;
     471
    489472        $post_type_placeholders = implode( "','", $post_types );
    490         return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->comments} WHERE comment_post_ID IN (SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s'))", $post_type_placeholders ) );
     473
     474        $post_ids = $wpdb->get_col( $wpdb->prepare(
     475            "SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s')",
     476            $post_type_placeholders
     477        ));
     478
     479        $result = $wpdb->query(
     480            $wpdb->prepare(
     481                "DELETE FROM {$wpdb->comments} WHERE comment_post_ID IN (SELECT ID FROM {$wpdb->posts} WHERE post_type IN ('%s'))",
     482                $post_type_placeholders
     483            )
     484        );
     485
     486        foreach ( $post_ids as $post_id ) {
     487            wp_update_comment_count_now( $post_id );
     488        }
     489
     490        return $result;
    491491    }
    492492}
  • wp-user-profile-avatar/trunk/wp-user-profile-avatar.php

    r3123813 r3149247  
    88 * Text Domain: wp-user-profile-avatar
    99 * Domain Path: /languages
    10  * Version: 1.0.4
     10 * Version: 1.0.5
    1111 * Since: 1.0.0
    1212 * Requires WordPress Version at least: 5.8
     
    2222require_once ABSPATH . 'wp-admin/includes/plugin.php';
    2323
    24 /**
    25  * WPUPA_User_Profile_Avatar class.
    26  */
    2724class WPUPA_User_Profile_Avatar {
    2825
     
    5855
    5956        // Define constants
    60         define( 'WPUPA_VERSION', '1.0.4' );
     57        define( 'WPUPA_VERSION', '1.0.5' );
    6158        define( 'WPUPA_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    6259        define( 'WPUPA_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
Note: See TracChangeset for help on using the changeset viewer.