append('element_set_global_plugins_actions', array(
'ID' => 'CWAP',
'NAME' => l10n('Change who added photo'),
'CONTENT' => '
'.l10n('confirm').'
',
));
}
function CWAP_element_set_global_action($action, $collection)
{
if ($action == 'CWAP')
{
global $page;
if (empty($_POST['check_CWAP']))
{
array_push($page['warnings'], l10n('You need to confirm'));
}
else
{
$query = '
select id
FROM ' . USERS_TABLE . '
WHERE username = \''.$_POST['CWAP'].'\'
;';
$result = pwg_query($query);
$row = pwg_db_fetch_assoc($result);
$CWAP=$row['id'];
if ($row['id'] == 0)
{
array_push($page['warnings'], l10n('This user doesn\'t exist'));
}
else
{
$datas = array();
foreach ($collection as $image_id)
{
array_push(
$datas,
array(
'id' => $image_id,
'added_by' => $CWAP
)
);
}
mass_updates(
IMAGES_TABLE,
array('primary' => array('id'), 'update' => array('added_by')),
$datas
);
}
}
}
}
?>