Preventing users from inadvertantly deleting albums Preventing users from inadvertantly deleting albums
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Preventing users from inadvertantly deleting albums

Started by timberguy, January 15, 2012, 12:44:45 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

timberguy

Is there a way to remove the album delete link for users other than an admin? We've had the problem several times of users inadvertently deleting an entire album when they think they are deleting the last photo they uploaded. They see the new thumbnail of that photo on the album, and think they are deleting the photo.This can be pretty traumatic for a gallery that is used primarily for storing photos to be posted on a forum.  It happened again tonight.  I usually always have recent back up for the photos, at least within 24 hours of an incident, but restoring the photos to an album, while it may put the photos back on our forum, it does not restore the database for the gallery.

if there was just someway of screaming "YOU ARE ABOUT TO DO SOMETHING VERY STUPID" or taking the link to delete an album away, it would be great.  I appreciate any suggestions.

lurkalot

It does give a warning that you're about to delete the Album, as per my my screengrab.  Or at least it should do.  That said, I do understand the problem, I've had a couple of my members do the same thing.
Running SMF 2.1.4  / Tinyportal 3.0.1, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

Do you prefer to change the message or removing the button?

timberguy

My first instinct is to remove the button form anyone but an admin, but only for albums. I have edited the button text to say STOP! THIS WILL DELETE ENTIRE ALBUM!  But that makes for a pretty big button.

You would think the pop-up would be sufficient, but people are just so programed to click through stuff anymore that they screw up.  Changing the text should do it, but I wouldn't bet on it.

Αndré

To remove that button for regular users, copy the following code block to your theme's theme.php file:
$template_album_admin_menu_nonadmin = <<<EOT
        <div class="buttonlist align_right">
                <ul>
                        <li>
                                <a href="modifyalb.php?album={ALBUM_ID}"><span>{MODIFY}</span></a>
                        </li>
                        <li>
                                <a href="editpics.php?album={ALBUM_ID}"><span class="last">{EDIT_PICS}</span></a>
                        </li>
                </ul>
        </div>
        <div class="clearer"></div>

EOT;



Additionally, open index.php, find
function html_albummenu($id)
{
    global $template_album_admin_menu, $lang_album_admin_menu;

    static $template = '';

    if ($template == '') {
        list($timestamp, $form_token) = getFormToken();
        $params = array(
            '{CONFIRM_DELETE}' => $lang_album_admin_menu['confirm_delete'],
            '{DELETE}' => cpg_fetch_icon('delete', 1) . $lang_album_admin_menu['delete'],
            '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_album_admin_menu['modify'],
            '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_album_admin_menu['edit_pics'],
            '{FORM_TOKEN}' => $form_token,
            '{TIMESTAMP}' => $timestamp
        );

        $template = template_eval($template_album_admin_menu, $params);
    }

    $params = array(
        '{ALBUM_ID}' => $id,
    );

    return template_eval($template, $params);
}

and replace with
function html_albummenu($id)
{
    global $template_album_admin_menu, $template_album_admin_menu_nonadmin, $lang_album_admin_menu;

    static $template = '';

    if ($template == '') {
        list($timestamp, $form_token) = getFormToken();
        $params = array(
            '{CONFIRM_DELETE}' => $lang_album_admin_menu['confirm_delete'],
            '{DELETE}' => cpg_fetch_icon('delete', 1) . $lang_album_admin_menu['delete'],
            '{MODIFY}' => cpg_fetch_icon('modifyalb', 1) . $lang_album_admin_menu['modify'],
            '{EDIT_PICS}' => cpg_fetch_icon('edit', 1) . $lang_album_admin_menu['edit_pics'],
            '{FORM_TOKEN}' => $form_token,
            '{TIMESTAMP}' => $timestamp
        );

        if (GALLERY_ADMIN_MODE) {
            $template = template_eval($template_album_admin_menu, $params);
        } else {
            $template = template_eval($template_album_admin_menu_nonadmin, $params);
        }
    }

    $params = array(
        '{ALBUM_ID}' => $id,
    );

    return template_eval($template, $params);
}

timberguy

Is there a specific place I should place the code for theme.php ?  I'm using the curve theme.

Αndré


timberguy


Αndré

Please
Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
tag your answer as "solved" by clicking on the "Topic Solved" button on the bar at the left hand side at the bottom of your thread.