You are here

function _favorites_delete_cookie in Favorites 7

Same name and namespace in other branches
  1. 7.2 favorites.module \_favorites_delete_cookie()

Helper function: Delete a single favorite from the user's cookies.

Used to abstract the storage model (cookie vs. db).

Parameters

$favorite: The favorite object.

Return value

bool The deletion success.

See also

_favorites_delete().

1 call to _favorites_delete_cookie()
_favorites_delete in ./favorites.module
Helper function: Delete a single favorite.

File

./favorites.module, line 624
The favorites module allows users to bookmark any path within a site.

Code

function _favorites_delete_cookie($favorite) {
  $cookie_id = 'Drupal_visitor_favorites_' . $favorite->fid;
  if (isset($_COOKIE[$cookie_id])) {

    // We must unset this cookie immediately so it will not have
    // further effects for the current request.
    user_cookie_delete('favorites_' . $favorite->fid);
    unset($_COOKIE[$cookie_id]);
    return TRUE;
  }
  return FALSE;
}