Changeset 3405961
- Timestamp:
- 11/30/2025 12:40:09 AM (4 months ago)
- Location:
- codeablepress-simple-frontend-profile-picture-upload
- Files:
-
- 66 added
- 3 edited
-
tags/1.0.0 (added)
-
tags/1.0.0/admin (added)
-
tags/1.0.0/admin/index.php (added)
-
tags/1.0.0/admin/profile.php (added)
-
tags/1.0.0/assets (added)
-
tags/1.0.0/assets/csfpp-admin.js (added)
-
tags/1.0.0/assets/csfpp.css (added)
-
tags/1.0.0/assets/csfpp.js (added)
-
tags/1.0.0/assets/index.php (added)
-
tags/1.0.0/bootstrap.php (added)
-
tags/1.0.0/codeablepress-simple-frontend-profile-picture-upload.php (added)
-
tags/1.0.0/includes (added)
-
tags/1.0.0/includes/enqueue.php (added)
-
tags/1.0.0/includes/filters.php (added)
-
tags/1.0.0/includes/index.php (added)
-
tags/1.0.0/includes/init.php (added)
-
tags/1.0.0/includes/shortcodes.php (added)
-
tags/1.0.0/includes/template-loaders.php (added)
-
tags/1.0.0/includes/upload.php (added)
-
tags/1.0.0/includes/utilities.php (added)
-
tags/1.0.0/index.php (added)
-
tags/1.0.0/languages (added)
-
tags/1.0.0/languages/csfpp.pot (added)
-
tags/1.0.0/languages/index.php (added)
-
tags/1.0.0/lib (added)
-
tags/1.0.0/lib/index.php (added)
-
tags/1.0.0/lib/smartcrop.js (added)
-
tags/1.0.0/lib/tailwind.css (added)
-
tags/1.0.0/readme.txt (added)
-
tags/1.0.0/templates (added)
-
tags/1.0.0/templates/avatar-with-content.php (added)
-
tags/1.0.0/templates/avatar.php (added)
-
tags/1.0.0/templates/index.php (added)
-
tags/1.0.1 (added)
-
tags/1.0.1/admin (added)
-
tags/1.0.1/admin/index.php (added)
-
tags/1.0.1/admin/profile.php (added)
-
tags/1.0.1/assets (added)
-
tags/1.0.1/assets/csfpp-admin.js (added)
-
tags/1.0.1/assets/csfpp.css (added)
-
tags/1.0.1/assets/csfpp.js (added)
-
tags/1.0.1/assets/index.php (added)
-
tags/1.0.1/bootstrap.php (added)
-
tags/1.0.1/codeablepress-simple-frontend-profile-picture-upload.php (added)
-
tags/1.0.1/includes (added)
-
tags/1.0.1/includes/enqueue.php (added)
-
tags/1.0.1/includes/filters.php (added)
-
tags/1.0.1/includes/index.php (added)
-
tags/1.0.1/includes/init.php (added)
-
tags/1.0.1/includes/shortcodes.php (added)
-
tags/1.0.1/includes/template-loaders.php (added)
-
tags/1.0.1/includes/upload.php (added)
-
tags/1.0.1/includes/utilities.php (added)
-
tags/1.0.1/index.php (added)
-
tags/1.0.1/languages (added)
-
tags/1.0.1/languages/csfpp.pot (added)
-
tags/1.0.1/languages/index.php (added)
-
tags/1.0.1/lib (added)
-
tags/1.0.1/lib/index.php (added)
-
tags/1.0.1/lib/smartcrop.js (added)
-
tags/1.0.1/lib/tailwind.css (added)
-
tags/1.0.1/readme.txt (added)
-
tags/1.0.1/templates (added)
-
tags/1.0.1/templates/avatar-with-content.php (added)
-
tags/1.0.1/templates/avatar.php (added)
-
tags/1.0.1/templates/index.php (added)
-
trunk/bootstrap.php (modified) (2 diffs)
-
trunk/codeablepress-simple-frontend-profile-picture-upload.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
codeablepress-simple-frontend-profile-picture-upload/trunk/bootstrap.php
r3179664 r3405961 9 9 'includes/enqueue.php', // Handles script and style enqueuing. 10 10 'includes/filters.php', // Applies filters for avatar customization. 11 'includes/template-loaders.php', // Handles the loading and rendering of template files.11 'includes/template-loaders.php', // Handles the loading and rendering of template files. 12 12 'includes/shortcodes.php', // Manages shortcodes for displaying custom avatars and user information. 13 13 'includes/upload.php', // Contains functions for uploading avatar. … … 32 32 }); 33 33 } 34 35 // Added in version 1.0.1 36 if (defined('CWPD_PLUGIN_DIR') && apply_filters('cwpa_auto_inject_cwpd_sidebar', true)) { 37 add_action('cwpd_dashboard_sidebar_before', function () { 38 $type = apply_filters('cwpa_avatar_type_cwpd_sidebar', '1'); 39 echo do_shortcode('[csfpp_avatar type="' . esc_attr($type) . '"]'); 40 }); 41 } 34 42 }); -
codeablepress-simple-frontend-profile-picture-upload/trunk/codeablepress-simple-frontend-profile-picture-upload.php
r3179664 r3405961 1 <?php defined( 'ABSPATH' ) || exit; 2 3 /** 4 * Plugin Name: CodeablePress: Simple Frontend Profile Picture Upload 5 * Plugin URI: https://codeablepress.com/product/simple-frontend-profile-picture-upload/ 6 * Description: A simple, lightweight, and secure way for users to upload profile pictures directly from the WooCommerce My Account page or via shortcode. 7 * Version: 1.0.0 8 * Author: CodeablePress 9 * Author URI: https://codeablepress.com 10 * License: GPL-3.0-or-later 11 * License URI: http://www.gnu.org/licenses/gpl-3.0.html 1 <?php defined('ABSPATH') || exit; 2 /** 3 * Plugin Name: CodeablePress: Simple Frontend Profile Picture Upload (Retired) 4 * Plugin URI: https://chargewp.com/plugin/front-end-avatar-upload/ 5 * Description: This plugin is retired. Please install our new plugin from WordPress.org: ChargeWP – Front-End Avatar Upload. 6 * Version: 1.0.1 7 * Author: ChargeWP 8 * Author URI: https://chargewp.com 9 * License: GPL-3.0-or-later 12 10 * Text Domain: codeablepress-simple-frontend-profile-picture-upload 13 11 * Domain Path: /languages 14 *15 * ---------------------------------------------------------------------------//16 *17 * This program is free software; you can redistribute it and/or modify18 * it under the terms of the GNU General Public License as published by19 * the Free Software Foundation; either version 3 of the License, or20 * (at your option) any later version.21 *22 * This program is distributed in the hope that it will be useful,23 * but WITHOUT ANY WARRANTY; without even the implied warranty of24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the25 * GNU General Public License for more details.26 *27 * You should have received a copy of the GNU General Public License28 * along with Simple Frontend Profile Picture Upload. If not, see <http://www.gnu.org/licenses/>.29 *30 * @author CodeablePress31 * @copyright Copyright (c) 2024, Jack Calihan, 2024 CodeablePress32 * @link https://codeablepress.com33 * @license http://www.gnu.org/licenses/gpl-3.0.html34 12 */ 35 13 … … 40 18 define('CSFPP_PLUGIN_URL', plugin_dir_url(__FILE__)); 41 19 42 // Include the bootstrap file 20 // If ChargeWP is active, stop this plugin from running to avoid conflicts. 21 if ( ! function_exists( 'is_plugin_active' ) ) { 22 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 23 } 24 25 $chargewp_main = 'chargewp-front-end-avatar-upload/chargewp-front-end-avatar-upload.php'; 26 27 if ( 28 ( is_multisite() && is_plugin_active_for_network( $chargewp_main ) ) 29 || is_plugin_active( $chargewp_main ) 30 || defined( 'CWPA_PLUGIN_DIR' ) // defined if ChargeWP already loaded this request 31 ) { 32 return; 33 } 34 35 // Otherwise, continue loading the legacy plugin normally. 43 36 require_once CSFPP_PLUGIN_DIR . 'bootstrap.php'; 37 38 if ( ! is_admin() ) { 39 // Frontend: keep running legacy features, but skip admin migration UI below. 40 return; 41 } 42 43 /** 44 * CONFIG 45 */ 46 const CSFPP_NEW_SLUG = 'chargewp-front-end-avatar-upload'; 47 const CSFPP_NEW_MAIN_FILE = 'chargewp-front-end-avatar-upload/chargewp-front-end-avatar-upload.php'; 48 const CSFPP_NOTICE_META = 'csfpp_migration_notice_dismissed'; 49 50 /** 51 * Helpers 52 */ 53 function csfpp_is_network() : bool { 54 return function_exists('is_network_admin') && is_network_admin(); 55 } 56 57 function csfpp_new_plugin_installed() : bool { 58 if ( ! function_exists('get_plugins')) { 59 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 60 } 61 $all = get_plugins(); 62 return isset($all[CSFPP_NEW_MAIN_FILE]); 63 } 64 65 function csfpp_new_plugin_active() : bool { 66 if ( ! function_exists('is_plugin_active') ) { 67 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 68 } 69 if (csfpp_is_network()) { 70 return is_plugin_active_for_network(CSFPP_NEW_MAIN_FILE); 71 } 72 return is_plugin_active(CSFPP_NEW_MAIN_FILE); 73 } 74 75 function csfpp_can_install() : bool { 76 return current_user_can( csfpp_is_network() ? 'manage_network_plugins' : 'install_plugins' ); 77 } 78 79 function csfpp_can_activate() : bool { 80 return current_user_can( csfpp_is_network() ? 'manage_network_plugins' : 'activate_plugins' ); 81 } 82 83 function csfpp_wporg_url() : string { 84 return 'https://wordpress.org/plugins/' . CSFPP_NEW_SLUG . '/'; 85 } 86 87 function csfpp_action_url(string $action) : string { 88 $args = [ 89 'action' => 'csfpp_migrate', 90 'step' => $action, // 'install_and_activate', 'activate_only', 'dismiss' 91 '_wpnonce' => wp_create_nonce('csfpp_migrate'), 92 ]; 93 $base = admin_url('admin-post.php'); 94 // In network admin, send to network admin-post 95 if (csfpp_is_network()) { 96 $base = network_admin_url('admin-post.php'); 97 } 98 return esc_url( add_query_arg( $args, $base ) ); 99 } 100 101 /** 102 * One-time activation: set a transient so the notice shows immediately. 103 */ 104 register_activation_hook(__FILE__, function() { 105 set_transient('csfpp_show_notice_now', 1, 60); 106 }); 107 108 /** 109 * Admin notice (dismissible per-user). 110 */ 111 add_action('admin_notices', 'csfpp_admin_notice'); 112 add_action('network_admin_notices', 'csfpp_admin_notice'); 113 function csfpp_admin_notice() { 114 115 if ( get_transient('csfpp_show_notice_now') ) { 116 delete_transient('csfpp_show_notice_now'); 117 } 118 119 // Per-user dismiss? 120 $user_id = get_current_user_id(); 121 if ( $user_id && get_user_meta($user_id, CSFPP_NOTICE_META, true) ) { 122 return; 123 } 124 125 // Only users who can act on plugins see this. 126 if ( ! ( csfpp_can_install() || csfpp_can_activate() ) ) { 127 return; 128 } 129 130 $is_installed = csfpp_new_plugin_installed(); 131 $is_active = csfpp_new_plugin_active(); 132 133 if ( $is_active ) { 134 // Nothing to show: they already migrated. 135 return; 136 } 137 138 $button_label = $is_installed ? __('Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload') 139 : __('Install & Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload'); 140 141 $step = $is_installed ? 'activate_only' : 'install_and_activate'; 142 143 ?> 144 <div class="notice notice-warning is-dismissible"> 145 <p><strong><?php esc_html_e('CodeablePress: Simple Frontend Profile Picture Upload plugin is retired.', 'codeablepress-simple-frontend-profile-picture-upload'); ?></strong> 146 <?php esc_html_e('Please move to our new WordPress.org plugin:', 'codeablepress-simple-frontend-profile-picture-upload'); ?> 147 <a href="<?php echo esc_url(csfpp_wporg_url()); ?>" target="_blank" rel="noopener noreferrer"><strong>ChargeWP – Front-End Avatar Upload</strong></a>. 148 </p> 149 150 <p> 151 <?php if ( csfpp_can_install() || csfpp_can_activate() ) : ?> 152 <a href="<?php echo csfpp_action_url($step); ?>" class="button button-primary"><?php echo esc_html($button_label); ?></a> 153 <?php endif; ?> 154 <a href="<?php echo csfpp_action_url('dismiss'); ?>" class="button"><?php esc_html_e('Dismiss', 'codeablepress-simple-frontend-profile-picture-upload'); ?></a> 155 </p> 156 </div> 157 <?php 158 } 159 160 /** 161 * Plugin row message (appears beneath the plugin on Plugins screen). 162 */ 163 add_action('in_plugin_update_message-' . plugin_basename(__FILE__), function() { 164 $is_installed = csfpp_new_plugin_installed(); 165 $is_active = csfpp_new_plugin_active(); 166 167 if ($is_active) { 168 return; 169 } 170 171 $label = $is_installed ? __('Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload') 172 : __('Install & Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload'); 173 $step = $is_installed ? 'activate_only' : 'install_and_activate'; 174 175 echo ' <strong>' . esc_html__('Retired:', 'codeablepress-simple-frontend-profile-picture-upload') . '</strong> '; 176 echo esc_html__('Please switch to the new plugin', 'codeablepress-simple-frontend-profile-picture-upload'); 177 echo ' — <a href="' . csfpp_action_url($step) . '">' . esc_html($label) . '</a> '; 178 echo ' | <a href="' . esc_url(csfpp_wporg_url()) . '" target="_blank" rel="noopener noreferrer">' . esc_html__('View on WordPress.org', 'codeablepress-simple-frontend-profile-picture-upload') . '</a>'; 179 }); 180 181 /** 182 * Add quick action link on plugin row. 183 */ 184 add_filter('plugin_action_links_' . plugin_basename(__FILE__), function($links) { 185 if ( csfpp_new_plugin_active() ) { 186 return $links; 187 } 188 $is_installed = csfpp_new_plugin_installed(); 189 $label = $is_installed ? __('Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload') 190 : __('Install & Activate ChargeWP', 'codeablepress-simple-frontend-profile-picture-upload'); 191 $step = $is_installed ? 'activate_only' : 'install_and_activate'; 192 array_unshift($links, '<a href="' . csfpp_action_url($step) . '">' . esc_html($label) . '</a>'); 193 return $links; 194 }); 195 196 /** 197 * Handle migration actions: install from .org and/or activate. 198 */ 199 add_action('admin_post_csfpp_migrate', 'csfpp_handle_migration'); 200 function csfpp_handle_migration() { 201 if ( ! isset($_GET['_wpnonce']) || ! wp_verify_nonce($_GET['_wpnonce'], 'csfpp_migrate') ) { 202 wp_die(__('Security check failed.', 'codeablepress-simple-frontend-profile-picture-upload')); 203 } 204 205 $step = isset($_GET['step']) ? sanitize_key($_GET['step']) : ''; 206 207 if ($step === 'dismiss') { 208 $user_id = get_current_user_id(); 209 if ($user_id) { 210 update_user_meta($user_id, CSFPP_NOTICE_META, 1); 211 } 212 csfpp_safe_back(); 213 } 214 215 if ($step === 'activate_only') { 216 if ( ! csfpp_can_activate() ) { 217 wp_die(__('You do not have permission to activate plugins.', 'codeablepress-simple-frontend-profile-picture-upload')); 218 } 219 $activated = csfpp_activate_new_plugin(); 220 csfpp_redirect_after($activated); 221 } 222 223 if ($step === 'install_and_activate') { 224 if ( ! csfpp_can_install() ) { 225 wp_die(__('You do not have permission to install plugins.', 'codeablepress-simple-frontend-profile-picture-upload')); 226 } 227 $installed = csfpp_install_from_wporg(); 228 $activated = $installed ? csfpp_activate_new_plugin() : false; 229 csfpp_redirect_after($installed && $activated); 230 } 231 232 // Fallback 233 csfpp_safe_back(); 234 } 235 236 /** 237 * Install the new plugin from WordPress.org. 238 */ 239 function csfpp_install_from_wporg() : bool { 240 require_once ABSPATH . 'wp-admin/includes/plugin-install.php'; 241 require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 242 require_once ABSPATH . 'wp-admin/includes/file.php'; 243 require_once ABSPATH . 'wp-admin/includes/misc.php'; 244 245 $api = plugins_api('plugin_information', ['slug' => CSFPP_NEW_SLUG, 'fields' => ['sections' => false]]); 246 if ( is_wp_error($api) ) { 247 wp_die( sprintf( esc_html__('Could not fetch plugin info from WordPress.org: %s', 'codeablepress-simple-frontend-profile-picture-upload'), $api->get_error_message() ) ); 248 } 249 250 $url = $api->download_link ?? ''; 251 if ( ! $url ) { 252 wp_die( esc_html__('No download link returned by WordPress.org.', 'codeablepress-simple-frontend-profile-picture-upload') ); 253 } 254 255 $creds = request_filesystem_credentials( admin_url() ); 256 if ( false === $creds ) { 257 return false; // WP will present credentials form 258 } 259 if ( ! WP_Filesystem($creds) ) { 260 return false; 261 } 262 263 $skin = new Automatic_Upgrader_Skin(); 264 $upgrader = new Plugin_Upgrader($skin); 265 $result = $upgrader->install($url); 266 267 if ( is_wp_error($result) ) { 268 wp_die( sprintf( esc_html__('Installation failed: %s', 'codeablepress-simple-frontend-profile-picture-upload'), $result->get_error_message() ) ); 269 } 270 271 // Refresh the plugins list 272 if ( ! function_exists('get_plugins') ) { 273 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 274 } 275 wp_clean_plugins_cache(); 276 $all = get_plugins(); 277 278 return isset($all[CSFPP_NEW_MAIN_FILE]); 279 } 280 281 /** 282 * Activate the new plugin (single site or network). 283 */ 284 function csfpp_activate_new_plugin() : bool { 285 if ( ! function_exists('activate_plugin') ) { 286 require_once ABSPATH . 'wp-admin/includes/plugin.php'; 287 } 288 $plugin_file = CSFPP_NEW_MAIN_FILE; 289 290 if (csfpp_is_network()) { 291 // In network admin, network-activate 292 $result = activate_plugin($plugin_file, '', true); // network_wide = true 293 } else { 294 $result = activate_plugin($plugin_file); 295 } 296 297 if ( is_wp_error($result) ) { 298 wp_die( sprintf( esc_html__('Activation failed: %s', 'codeablepress-simple-frontend-profile-picture-upload'), $result->get_error_message() ) ); 299 } 300 return csfpp_new_plugin_active(); 301 } 302 303 /** 304 * Redirect back with a status flag. 305 */ 306 function csfpp_redirect_after(bool $success) { 307 $ref = wp_get_referer(); 308 $to = $ref ?: ( csfpp_is_network() ? network_admin_url('plugins.php') : admin_url('plugins.php') ); 309 $to = add_query_arg('csfpp_migrated', $success ? '1' : '0', $to); 310 wp_safe_redirect($to); 311 exit; 312 } 313 314 function csfpp_safe_back() { 315 $ref = wp_get_referer(); 316 if ($ref) { 317 wp_safe_redirect($ref); 318 exit; 319 } 320 wp_safe_redirect( csfpp_is_network() ? network_admin_url('plugins.php') : admin_url('plugins.php') ); 321 exit; 322 } 323 324 /** 325 * Success/error admin notice after redirect. 326 */ 327 add_action('admin_notices', 'csfpp_result_notice'); 328 add_action('network_admin_notices', 'csfpp_result_notice'); 329 function csfpp_result_notice() { 330 if ( isset($_GET['csfpp_migrated']) ) { 331 $ok = $_GET['csfpp_migrated'] === '1'; 332 $class = $ok ? 'notice-success' : 'notice-error'; 333 $msg = $ok ? __('ChargeWP has been installed and activated.', 'codeablepress-simple-frontend-profile-picture-upload') 334 : __('Sorry, the migration to ChargeWP did not complete.', 'codeablepress-simple-frontend-profile-picture-upload'); 335 echo '<div class="notice ' . esc_attr($class) . ' is-dismissible"><p>' . esc_html($msg) . '</p></div>'; 336 } 337 } -
codeablepress-simple-frontend-profile-picture-upload/trunk/readme.txt
r3179664 r3405961 1 1 === CodeablePress: Simple Frontend Profile Picture Upload === 2 2 Contributors: codeablepress 3 Tags: profile picture, avatar, WooCommerce, user profile, frontend 4 Requires at least: 5.8 5 Tested up to: 6.6 6 Stable tag: 1.0.0 7 Requires PHP: 7.4 8 License: GPL-3.0-or-later 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html 3 Tags: profile, avatar, upload, frontend, woocommerce, user profile 4 Requires at least: 5.0 5 Tested up to: 6.8 6 Stable tag: 1.0.1 7 License: GPLv3 or later 8 License URI: https://www.gnu.org/licenses/gpl-3.0.html 10 9 11 10 A simple, lightweight, and secure way for users to upload profile pictures directly from the WooCommerce My Account page or via shortcode. … … 13 12 == Description == 14 13 15 **CodeablePress: Simple Frontend Profile Picture Upload** provides a seamless way for users to upload profile pictures directly from their WooCommerce My Account page or using a shortcode. The plugin is designed with simplicity, security, and performance in mind, ensuring an efficient user experience. 14 ⚠️ **This plugin has been retired.** 16 15 17 **Features:** 18 * Seamlessly set a default image using a simple filter 19 * Intelligent cropping to identify the best focal point, ensuring a perfectly squared photo on upload 20 * Lightweight shortcode to display other users avatars and current users avatar uploader anywhere on your site 21 * Automatically integrates an avatar display and upload option in the WooCommerce 'My Account' page 22 * Effortlessly manages old profile pictures by automatically deleting them upon new uploads 23 * Easily upload or delete custom avatars directly from the Admin user's profile area 24 * Ultra-light plugin with a file size of less than 0.05MB 25 * Very high emphasis on security 26 * Fully translation-ready with a .pot file included for easy localization 27 * Supports multiple image formats (JPG, JPEG, PNG, GIF, WEBP) 28 * Regular updates and dedicated support for seamless integration 16 We've rebuilt this plugin from the ground up as a brand new, modern WordPress.org plugin: 29 17 30 This plugin is perfect for websites that need a straightforward solution for users to update their profile pictures from the frontend. 18 👉 [ChargeWP – Front-End Avatar Upload](https://wordpress.org/plugins/chargewp-front-end-avatar-upload/) 31 19 32 == Installation == 20 **Please install and activate the new plugin** to continue receiving updates and support. 33 21 34 1. Upload the plugin files to the /wp-content/plugins/custom-profile-picture-for-woocommerce directory, or install the plugin through the WordPress plugins screen directly. 35 2. Activate the plugin through the 'Plugins' screen in WordPress. 36 3. Plugin will automatically display users avatar with upload option above the WooCommerce My Account menu. 37 4. Use the [csfpp_avatar] shortcode to display avatars on additional pages or posts. 22 This version (1.0.1) only displays a migration notice and does **not** run the old upload functionality anymore — it’s safe to keep active temporarily while switching. 38 23 39 Usage: 24 ### Why the Change? 40 25 41 Shortcode: [csfpp_avatar] 42 Attributes: 43 check_page_author: Check the page author and display their avatar instead of current users (default: false). 44 classes: Additional CSS classes to apply (default: ''). 45 type: Decides what content to display. Type 0. Avatar only | Type 1. Avatar and name | Type 2. Avatar, name and profile link (default: 0) 26 - The new plugin offers improved performance and security 27 - Better WooCommerce and block editor support 28 - Ongoing updates and future enhancements on WordPress.org 29 - Easier support and automatic updates 46 30 47 Full use example: 48 [csfpp_avatar check_page_author="false" classes="" type="0"] 31 ### What Happens After Updating? 32 33 After updating to version 1.0.1, you'll see a notice in your WordPress Dashboard with a one-click option to **Install & Activate ChargeWP – Front-End Avatar Upload**. 34 All existing data (user profile pictures) remains untouched. 49 35 50 36 == Frequently Asked Questions == 51 37 52 = Can I set a default avatar?=53 Yes! You can set the path with a simple filter. 38 = Is this plugin still supported? = 39 No. Please migrate to **ChargeWP – Front-End Avatar Upload** for continued updates and support. 54 40 55 1. Upload your default image to wp-content/uploads/. 56 2. change default-profile-picture.png to the name of your image in the code below. 57 3. Add the code to your functions.php file. 41 = Will my existing user avatars or uploads be lost? = 42 No. This retirement release does not delete or modify any existing user data. The new plugin will convert existing data over automatically. 58 43 59 // Set default avatar image 60 add_filter('get_avatar_url', function($url, $id_or_email, $args) { 61 // Check if the URL is empty or not an image URL 62 if (empty($url) || !wp_attachment_is_image($url)) { 63 // Update this to the relative path of the image in the uploads directory 64 $default_image_path = 'default-profile-picture.png'; 65 66 // Upload file to wp-content/uploads/ 67 return trailingslashit(wp_upload_dir()['baseurl']) . $default_image_path; 68 } 69 70 return $url; 71 }, 10, 3); 72 73 = How do I remove the avatar above the woocommerce menu in My Account? = 74 Add the following code to your functions.php file to remove the profile picture above the WooCommerce My Account menu. 75 remove_action('woocommerce_before_account_navigation', 'csfpp_display_avatar_with_name'); 76 77 = How do I stop the avatar from being round? = 78 The avatar design is controlled by a template that can be placed in your theme folder. Copy the avatar.php file from the templates folder of the plugin and place it in yourtheme/templates/csfpp/avatar.php 79 80 Open the template file in your themes folder and remove the text "rounded-full". 81 82 = Can I delete or change other user's avatars? = 83 Yes. Simply navigate to their profile page in the admin area. 84 85 Delete: Click the delete button that shows if the user has a custom profile (not gravatar). 86 Upload: Click on the users profile photo, upload a photo with the media uploader, save the profile. 87 88 = Does gravatar still work and can I disable it? = 89 Yes, gravatar still works. If you'd like to disable it, you can use the following functions in your function.php file. Be sure to set a new default avatar after doing so in discussion.php 90 91 // Disable Gravatars 92 add_filter('get_avatar', function($avatar, $id_or_email, $size, $default, $alt) { 93 return ''; 94 }, 1, 5); 95 96 // Remove Gravatar from Discussion Settings 97 add_filter('avatar_defaults', function($avatar_defaults) { 98 unset($avatar_defaults['mystery']); 99 unset($avatar_defaults['blank']); 100 unset($avatar_defaults['gravatar_default']); 101 return $avatar_defaults; 102 }); 103 104 // Hide the Avatar Settings Section 105 add_action('admin_init', function() { 106 remove_action('admin_init', 'avatar_settings_init'); 107 }); 108 109 = How can I change the default size of uploaded avatars? = 110 The default size for avatars in this plugin is based on your WordPress settings for thumbnail size. You can easily change this by following these steps: 111 112 1. Go to WordPress Admin Settings: 113 Navigate to Settings > Media in your WordPress dashboard. 114 Under the "Thumbnail size" section, you’ll see options to set the width and height for thumbnails. Adjust these values to your desired dimensions. 115 116 2. Override Default Size (Advanced Users): 117 If you prefer to set a specific size for avatars that differs from your general thumbnail settings, you can modify the code where the avatar upload size is defined. This is typically done in the plugin's settings or by adding a custom function in your theme's functions.php file. 118 119 add_filter('csfpp_avatar_size', function() { 120 return [150, 150]; // Change 150x150 to your preferred dimensions 121 }); 122 123 == License == 124 125 This plugin is licensed under the GPL-3.0-or-later license. For more information, please visit GPL-3.0 License. 44 = Can I safely deactivate or delete this plugin after migration? = 45 Yes. Once you’ve installed and activated the new plugin, you can safely remove this one. 126 46 127 47 == Changelog == 128 48 129 = 1.0.0 - 2024-10-28 130 * Initial full release! 49 = 1.0.1 = 50 * Soft Retirement release. 51 * Added in-dashboard and plugin screen notices to guide users to the new plugin. 52 * Added one-click **Install & Activate** migration flow. 53 * Removed all previous upload functionality once new plugin is installed. 54 55 = 1.0.0 = 56 * Initial public release – Frontend avatar upload from WooCommerce My Account or shortcode.
Note: See TracChangeset
for help on using the changeset viewer.