function photos_edit_sort_albums_save in Album Photos 7.3
Save weight for array of album id's.
1 call to photos_edit_sort_albums_save()
- _photos_ajax_helper in ./
photos.module - Ajax helper, perform different ajax requests.
File
- inc/
photos.edit.inc, line 450 - Handles uploading and editing images.
Code
function photos_edit_sort_albums_save($order = array(), $uid = 0) {
if ($uid) {
global $user;
$access = FALSE;
// @todo add support for admin.
if ($user->uid == $uid) {
$weight = 0;
// Update weight for all albums in array.
foreach ($order as $album_id) {
$pid = str_replace('photos_', '', $album_id);
$node = node_load($pid);
// Check for node_accss.
$access = _photos_access('editAlbum', $node);
if ($access) {
db_query("UPDATE {photos_album} SET wid = :wid WHERE pid = :pid", array(
':wid' => $weight,
':pid' => $pid,
));
$weight++;
}
}
if ($weight > 0) {
$message = t('Album order saved!');
return $message;
}
}
}
}