function photos_user in Album Photos 6.2
File
- ./
photos.module, line 487
Code
function photos_user($op, &$edit, &$ac) {
global $user;
switch ($op) {
case 'view':
if (user_access('view photo') || user_access('create photo', $ac)) {
if ($ac->album['album']['count']) {
$item[] = l(t('There are !a albums in total', array(
'!a' => $ac->album['album']['count'],
)), "photos/user/{$ac->uid}/album");
}
else {
if ($ac->uid == $user->uid) {
$item[] = t('No alubms yet, ') . l(t('Create album'), 'node/add/photos');
}
}
if ($ac->album['image']['count']) {
$item[] = l(t('There are !a images in total', array(
'!a' => $ac->album['image']['count'],
)), "photos/user/{$ac->uid}/image");
}
else {
if ($ac->uid == $user->uid) {
$item[] = t('No images yet, ') . l(t('Upload images'), 'photos/upload');
}
}
if (variable_get('photos_slide', 0) && $ac->album['image']['count']) {
$item[] = l(t('Slideshow'), "photos/user/{$ac->uid}/slide");
}
if ($item[0]) {
$ac->content['summary']['photos'] = array(
'#type' => 'user_profile_item',
'#title' => t('Album image'),
'#value' => theme('item_list', $item),
'#attributes' => array(
'class' => 'photos',
),
);
}
}
break;
case 'load':
$ac->album['album']['count'] = photos_get_count('user_album', $ac->uid);
$ac->album['image']['count'] = photos_get_count('user_image', $ac->uid);
break;
case 'insert':
db_query("INSERT INTO {x_count} (cid, changed, type, value) VALUES (%d, 0, '%s', 0), (%d, 0, '%s', 0)", $ac->uid, 'user_album', $ac->uid, 'user_image');
}
}