function drupal_valid_token

7.x drupal_valid_token($token, $value = '', $skip_anonymous = FALSE)
5.x drupal_valid_token($token, $value = '', $skip_anonymous = FALSE)
6.x drupal_valid_token($token, $value = '', $skip_anonymous = FALSE)

Validates a token based on $value, the user session, and the private key.


$token: The token to be validated.

$value: An additional value to base the token on.

$skip_anonymous: Set to true to skip token validation for anonymous users.

Return value

True for a valid token, false for an invalid token. When $skip_anonymous is true, the return value will always be true for anonymous users.

15 calls to drupal_valid_token()
aggregator_admin_refresh_feed in drupal/modules/aggregator/
Page callback: Refreshes a feed, then redirects to the overview page.
ajax_base_page_theme in drupal/includes/
Theme callback for Ajax requests.
color_palette_color_value in drupal/modules/color/color.module
Determines the value for a palette color field.
comment_approve in drupal/modules/comment/
Menu callback; publish specified comment.
dashboard_update in drupal/modules/dashboard/dashboard.module
Sets the new weight of each region according to the drag-and-drop order.

... See full list


drupal/includes/, line 5130
Common functions that many Drupal modules will need to reference.


function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
  global $user;
  return (($skip_anonymous && $user->uid == 0) || ($token === drupal_get_token($value)));