function uc_wishlist_get_uid in UC Wish List 6
Same name and namespace in other branches
- 8 uc_wishlist.module \uc_wishlist_get_uid()
- 7 uc_wishlist.module \uc_wishlist_get_uid()
2 calls to uc_wishlist_get_uid()
- uc_wishlist_create_wishlist in ./
uc_wishlist.module - Creates a new wishlist for the current authenticated or anonymous user.
- uc_wishlist_get_wid in ./
uc_wishlist.module
File
- ./
uc_wishlist.module, line 454 - Allows users to create public shopping/wish lists.
Code
function uc_wishlist_get_uid() {
global $user;
// Get either an authenticated user's uid or an anonymous user's unique ID.
if ($user->uid) {
$uid = $user->uid;
}
else {
if (!isset($_SESSION['uc_wishlist_uid']) || empty($_SESSION['uc_wishlist_uid'])) {
$_SESSION['uc_wishlist_uid'] = md5(uniqid(rand(), TRUE));
}
$uid = $_SESSION['uc_wishlist_uid'];
}
return $uid;
}