Submit
Path:
~
/
home
/
getwphos
/
www
/
almajd14
/
wp-content
/
plugins
/
woocommerce
/
vendor
/
automattic
/
jetpack-connection
/
src
/
File Content:
class-user-account-status.php
<?php /** * Class to check for account errors in the Jetpack Connection. * * @package automattic/jetpack-connection * @since 6.11.0 */ namespace Automattic\Jetpack\Connection; /** * Class User_Account_Status */ class User_Account_Status { /** * Check for possible account errors between the local user and WPCOM account. * * @since 6.11.0 * * @param string $current_user_email The email of the current WordPress user. * @param string $wpcom_user_email The email of the connected WordPress.com account. * * @return array An array of possible account errors, empty if no errors. */ public function check_account_errors( $current_user_email, $wpcom_user_email ) { $errors = array(); // Check for email mismatch error. $has_mismatch = $this->possible_account_mismatch( $current_user_email, $wpcom_user_email ); if ( $has_mismatch ) { $errors['mismatch'] = array( 'type' => 'mismatch', 'message' => __( 'Your WordPress.com email also used by another user account. This won’t affect functionality but may cause confusion about which user account is connected.', 'jetpack-connection' ), 'details' => array( 'site_email' => $current_user_email, 'wpcom_email' => $wpcom_user_email, ), ); } /** * Filters the account errors. * * @since 6.11.0 * * @param array $errors The array of account errors. * @param string $current_user_email The email of the current WordPress user. * @param string $wpcom_user_email The email of the connected WordPress.com account. */ return apply_filters( 'jetpack_connection_account_errors', $errors, $current_user_email, $wpcom_user_email ); } /** * Check if there is a possible account mismatch between the local user and WPCOM account. * * @since 6.11.0 * * @param string $current_user_email The email of the current WordPress user. * @param string $wpcom_user_email The email of the connected WordPress.com account. * * @return bool Whether there is a possible account mismatch. */ public function possible_account_mismatch( $current_user_email, $wpcom_user_email ) { // If emails are the same or there's no WPCOM email, there's no mismatch. if ( $current_user_email === $wpcom_user_email || ! $wpcom_user_email ) { return false; } // Generate transient key with both wpcom email and user ID if available. $transient_key = 'jetpack_account_mismatch_'; $transient_key .= md5( $wpcom_user_email ); $cached_result = get_transient( $transient_key ); if ( false !== $cached_result ) { return (bool) $cached_result; } // Check if there's a WordPress user with the WPCOM email . $wpcom_email_user = get_user_by( 'email', $wpcom_user_email ); $mismatch_exists = false !== $wpcom_email_user; // Store the result in a transient for 24 hours. set_transient( $transient_key, $mismatch_exists, DAY_IN_SECONDS ); return $mismatch_exists; } /** * Clears account mismatch transients for a user when they update their email or are deleted. * * @since 6.11.0 * * @param string|int $user_id_or_email User ID or email address. * @return void */ public function clean_account_mismatch_transients( $user_id_or_email ) { $email = null; if ( is_numeric( $user_id_or_email ) ) { $user = get_userdata( $user_id_or_email ); if ( $user && isset( $user->user_email ) ) { $email = $user->user_email; } } else { $email = $user_id_or_email; } if ( ! $email || ! is_email( $email ) ) { return; } $transient_key = 'jetpack_account_mismatch_' . md5( $email ); delete_transient( $transient_key ); } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
identity-crisis
---
0755
sso
---
0755
traits
---
0755
webhooks
---
0755
class-authorize-json-api.php
8900 bytes
0644
class-client.php
16207 bytes
0644
class-connection-assets.php
900 bytes
0644
class-connection-notice.php
8089 bytes
0644
class-error-handler.php
33669 bytes
0644
class-external-storage.php
8256 bytes
0644
class-heartbeat.php
8006 bytes
0644
class-initial-state.php
1935 bytes
0644
class-manager.php
89192 bytes
0644
class-nonce-handler.php
5812 bytes
0644
class-package-version-tracker.php
5686 bytes
0644
class-package-version.php
648 bytes
0644
class-partner-coupon.php
11202 bytes
0644
class-partner.php
5072 bytes
0644
class-plugin-storage.php
7741 bytes
0644
class-plugin.php
2459 bytes
0644
class-rest-authentication.php
6302 bytes
0644
class-rest-connector.php
34784 bytes
0644
class-secrets.php
8608 bytes
0644
class-server-sandbox.php
7863 bytes
0644
class-terms-of-service.php
2798 bytes
0644
class-tokens-locks.php
1745 bytes
0644
class-tokens.php
21301 bytes
0644
class-tracking.php
10100 bytes
0644
class-urls.php
5091 bytes
0644
class-user-account-status.php
3632 bytes
0644
class-users-connection-admin.php
4549 bytes
0644
class-utils.php
3922 bytes
0644
class-webhooks.php
7066 bytes
0644
class-xmlrpc-async-call.php
2685 bytes
0644
class-xmlrpc-connector.php
1918 bytes
0644
interface-manager.php
298 bytes
0644
interface-storage-provider.php
2118 bytes
0644
N4ST4R_ID | Naxtarrr