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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
1702      if ( ! $uid ) {
1703           /**
1704            * Filter whether the user who generated the nonce is logged out.
1705            *
1706            * @since 3.5.0
1707            *
1708            * @param int    $uid    ID of the nonce-owning user.
1709            * @param string $action The nonce action.
1710            */
1711           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1712      }
1713
1714      if ( empty( $nonce ) ) {
1715           return false;
1716      }
1717
1718      $token = wp_get_session_token();
1719      $i = wp_nonce_tick();
1720
 
Line Code
1743  *
1744  * @param string|int $action Scalar value to add context to the nonce.
1745  * @return string The token.
1746  */
1747 function wp_create_nonce($action = -1) {
1748      $user = wp_get_current_user();
1749      $uid = (int) $user->ID;
1750      if ( ! $uid ) {
1751           /** This filter is documented in wp-includes/pluggable.php */
1752           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1753      }
1754
1755      $token = wp_get_session_token();
1756      $i = wp_nonce_tick();
1757
1758      return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1759 }
1760 endif;
1761