Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Preventing users from inadvertantly deleting albums  (Read 2725 times)

0 Members and 1 Guest are viewing this topic.

timberguy

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Preventing users from inadvertantly deleting albums
« on: January 15, 2012, 12:44:45 am »

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.
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 947
  • +Tinyportal Support team.
Re: Preventing users from inadvertantly deleting albums
« Reply #1 on: January 15, 2012, 01:35:28 am »

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.
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Preventing users from inadvertantly deleting albums
« Reply #2 on: January 17, 2012, 02:48:22 pm »

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

timberguy

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Preventing users from inadvertantly deleting albums
« Reply #3 on: January 17, 2012, 08:06:08 pm »

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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Preventing users from inadvertantly deleting albums
« Reply #4 on: January 18, 2012, 02:24:46 pm »

To remove that button for regular users, copy the following code block to your theme's theme.php file:
Code: [Select]
$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
Code: [Select]
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
Code: [Select]
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);
}
Logged

timberguy

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Preventing users from inadvertantly deleting albums
« Reply #5 on: January 18, 2012, 05:41:09 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Preventing users from inadvertantly deleting albums
« Reply #6 on: January 18, 2012, 06:39:24 pm »

Right before the closing
Code: [Select]
?>is fine.
Logged

timberguy

  • Coppermine newbie
  • Offline Offline
  • Posts: 14
Re: Preventing users from inadvertantly deleting albums
« Reply #7 on: January 18, 2012, 10:21:04 pm »

Thank you very much. That worked perfectly.  :)
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Preventing users from inadvertantly deleting albums
« Reply #8 on: January 19, 2012, 09:27:32 am »

Please
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.
Logged
Pages: [1]   Go Up
 

Page created in 0.035 seconds with 19 queries.