It’s important to note that as soon as I removed the APC Object Cache Backend file, the transients were being properly set and found again. This more than anything else, points to something related to APC Object Cache Backend.
In a nutshell, here’s what I’m doing…
Generate the transient key using a hash that’s comprised of the user login, email and timestamp.
// Transient keys need to be less than 45 characters in length. wp-hash generates a 30-character string, but still, to be safe...
$transient_key = substr( wp_hash( self::$registering_user->user_login . self::$registering_user->user_email . 'validate' . time() ), -30 );
Set the transient and store the user ID
if ( set_transient( $transient_key, self::$registering_user->ID, self::EMAIL_VALIDATION_TIMEOUT ) ){
(I should note that… const EMAIL_VALIDATION_TIMEOUT = 28800; // 8 hours
)
Generate a URL that I email to the user’s email. It includes a query arg ‘k’ which contains the transient key for the transient we just created.
$validation_url = add_query_arg( array( 'action' => 'validate', 'k' => $transient_key ), site_url( self::REDIRECT_LOGIN_FORM ) );
Then that all gets sent to the user. Once the user clicks that link…
if ( $transient_key = $_REQUEST['k'] ){
if ( $user_id = get_transient( $transient_key ) ){ // THIS is where we end up with APC Object Cache Backend DISABLED. }
else { // throw error message - THIS is where we end up with APC Object Cache Backend ENABLED. }
The only thing I __don’t__ know at this point is whether the transient is set, but can’t be read back, or whether it never gets set in the first place.