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
1646      if ( ! $uid ) {
1647           /**
1648            * Filter whether the user who generated the nonce is logged out.
1649            *
1650            * @since 3.5.0
1651            *
1652            * @param int    $uid    ID of the nonce-owning user.
1653            * @param string $action The nonce action.
1654            */
1655           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1656      }
1657
1658      $i = wp_nonce_tick();
1659
1660      // Nonce generated 0-12 hours ago
1661      if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) === $nonce )
1662           return 1;
1663      // Nonce generated 12-24 hours ago
1664      if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) === $nonce )
 
Line Code
1676  *
1677  * @param string|int $action Scalar value to add context to the nonce.
1678  * @return string The one use form token
1679  */
1680 function wp_create_nonce($action = -1) {
1681      $user = wp_get_current_user();
1682      $uid = (int) $user->ID;
1683      if ( ! $uid ) {
1684           /** This filter is documented in wp-includes/pluggable.php */
1685           $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1686      }
1687
1688      $i = wp_nonce_tick();
1689
1690      return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10);
1691 }
1692 endif;
1693
1694 if ( !function_exists('wp_salt') ) :