PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
← All changes | includes/users/charitable-user-functions.php +29 -2 1.6.60 → 1.8.13 View file →
@@ -4,10 +4,10 @@
4 4 *
5 5 * User related functions.
6 6 *
7 7 * @package Charitable/Functions/User
8 - * @author Eric Daams
9 - * @copyright Copyright (c) 2022, Studio 164a
8 + * @author David Bisset
9 + * @copyright Copyright (c) 2023, WP Charitable LLC
10 10 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
11 11 * @since 1.0.0
12 12 * @version 1.6.0
13 13 */
@@ -200,4 +200,31 @@
200 200 */
201 201 function charitable_get_donor_id_by_email( $email ) {
202 202 return charitable_get_table( 'donors' )->get_donor_id_by_email( $email );
203 203 }
204 +
205 +/**
206 + * Checks to see if the specified email address has a Gravatar image.
207 + *
208 + * @param $email The email of the address of the user to check
209 + * @return boolean
210 + * @since 1.0.2
211 + */
212 +function charitable_user_has_gravatar( $email ) {
213 + $hash_key = md5( strtolower( trim( $email ) ) );
214 + $has_gravatar = wp_cache_get( $hash_key, 'default', false, $uncached );
215 +
216 + if ( $uncached === $has_gravatar ) {
217 + if ( is_ssl() ) {
218 + $url = sprintf( 'https://secure.gravatar.com/avatar/%s?d=404', $hash_key );
219 + } else {
220 + $url = sprintf( 'http://www.gravatar.com/avatar/%s?d=404', $hash_key );
221 + }
222 +
223 + $response = wp_remote_get( $url );
224 + $has_gravatar = 200 == wp_remote_retrieve_response_code( $response );
225 +
226 + wp_cache_set( $hash_key, $has_gravatar, '', 60 * 5 );
227 + }
228 +
229 + return $has_gravatar;
230 +}