You are here

function simplenews_private_key in Simplenews 6

Same name and namespace in other branches
  1. 5 simplenews.module \simplenews_private_key()
  2. 6.2 simplenews.module \simplenews_private_key()
  3. 7.2 simplenews.module \simplenews_private_key()
  4. 7 simplenews.module \simplenews_private_key()

Create a 32 character identifier.

2 calls to simplenews_private_key()
simplenews_confirm_subscription in ./simplenews.subscription.inc
Menu callback: confirm the user's (un)subscription request
_simplenews_generate_hash in ./simplenews.module
Generate the hash key used for subscribe/unsubscribe link.

File

./simplenews.module, line 2253
Simplnews node handling, sent email, newsletter block and general hooks

Code

function simplenews_private_key() {
  $key = variable_get('simplenews_private_key', FALSE);
  if (!$key) {

    //  This will create a 32 character identifier (a 128 bit hex number) that is extremely difficult to predict
    $key = md5(uniqid(rand()));
    variable_set('simplenews_private_key', $key);
  }
  return $key;
}