Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: nonce_user_logged_out

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
2358           if ( ! $uid ) {
2359                /**
2360                 * Filters whether the user who generated the nonce is logged out.
2361                 *
2362                 * @since 3.5.0
2363                 *
2364                 * @param int        $uid    ID of the nonce-owning user.
2365                 * @param string|int $action The nonce action, or -1 if none was provided.
2366                 */
2367                $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
2368           }
2369
2370           if ( empty( $nonce ) ) {
2371                return false;
2372           }
2373
2374           $token = wp_get_session_token();
2375           $i     = wp_nonce_tick( $action );
2376
 
Line Code
2413       *
2414       * @param string|int $action Scalar value to add context to the nonce.
2415       * @return string The token.
2416       */
2417      function wp_create_nonce( $action = -1 ) {
2418           $user = wp_get_current_user();
2419           $uid  = (int) $user->ID;
2420           if ( ! $uid ) {
2421                /** This filter is documented in wp-includes/pluggable.php */
2422                $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
2423           }
2424
2425           $token = wp_get_session_token();
2426           $i     = wp_nonce_tick( $action );
2427
2428           return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
2429      }
2430 endif;
2431