/** * UPDATES AN ACCESS TOKEN'S EXPIRE TIME BY X AMOUNT OF TIME WHEN SUCCESSFULLY USED FOR AUTHENTICATION * * NOTE: This will override any token settings used within the plugin but does allow for active tokens to * stay active instead of expiring. This is useful for auto deauthentication tht is traditionally handled on the * client side. */ add_action( 'wo_endpoint_user_authenticated', 'wp_oauth_successful_authentication_action' ); function wp_oauth_successful_authentication_action( $token ) { //$current_expires = $token[0]['expires']; $access_token = $token[0]['access_token']; $minutes = 30; $new_expires = date( 'Y-m-d H:i:s', current_time( 'timestamp' ) + ( $minutes * 60 ) ); global $wpdb; $update = $wpdb->update( $wpdb->prefix . 'oauth_access_tokens', array( 'expires' => $new_expires ), array( 'access_token' => $access_token ) ); }