This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Disable Delete


  1. fredwin
    Member

    Hi Yuniar
    Is it possible to disable the delete file option, or even to have a different password required to delete the entries?

    I am looking at this as we have had one of our admin guys who acidentally deleted an entry, but didn't tell anyone and it was a pretty important entry.

    Fred

    Posted 15 years ago #
  2. redityo

    Hi...

    You can hide/remove delete entries by make modification in "view-entry.php" and "manage_entries.php"

    in view-entry.php files you can edit line 214 , from

    <li><img src="images/icons/cross_22.gif" align="absmiddle"/> &nbsp;
    <a onclick="return confirm('Are you sure you want to delete this entry?');"
     href="view_entry.php?form_id=
    <?php echo $form_id; ?>&id=
    <?php echo $entry_id; ?>&delete=1"
    class="big_dotted_link">Delete</a></li>

    to

    <!--<li><img src="images/icons/cross_22.gif" align="absmiddle"/> &nbsp;
    <a onclick="return confirm('Are you sure you want to delete this entry?');"
     href="view_entry.php?form_id=
    <?php echo $form_id; ?>&id=
    <?php echo $entry_id; ?>&delete=1"
    class="big_dotted_link">Delete</a></li>-->

    and in manage-entries.php you can edit in line 409 with adding style "display:none" properties

    <div style=" display:none;float: left;padding-bottom: 5px;padding-left: 8px">
    <img src="images/icons/arrow_turn_left.gif" align="absmiddle"/>

    Since machform only use single user I think it's not possible to have different password for now.
    I hope this can help you ...


    MachForm Support

    Posted 15 years ago #
  3. fredwin
    Member

    Excellent. That works nicely. I will try and find a tool to let me delete the entry direct from the SQL database. I think that one I have posted before can do that.

    Will try and remember to post an update when I work it out.

    Posted 15 years ago #
  4. raj000
    Member

    Hi,

    Can i implement this for a specific form only. Not for all forms / entries.

    Thanks

    Posted 13 years ago #
  5. redityo

    Hi,

    Yes, it's possible. To do so, try to follow these steps :

    For "manage-entries.php" file, you can change these code in 409 :

    <div style="float: left;padding-bottom: 5px;padding-left: 8px">
    <img src="images/icons/arrow_turn_left.gif" align="absmiddle"/>&nbsp;

    into

    <div style="<?php if($form_id == 1) {echo "display:none;";} ?>float: left;padding-bottom: 5px;padding-left: 8px">
    <img src="images/icons/arrow_turn_left.gif" align="absmiddle"/>&nbsp;

    and for "view-entry.php", you can change these code :

    <li><img src="images/icons/cross_22.gif" align="absmiddle"/> &nbsp;
    <a onclick="return confirm('Are you sure you want to delete this entry?');"
     href="view_entry.php?form_id=
    <?php echo $form_id; ?>&id=
    <?php echo $entry_id; ?>&delete=1"
    class="big_dotted_link">Delete</a></li>

    into

    <?php if ($form_id != 1) { ?>
    <li><img src="images/icons/cross_22.gif" align="absmiddle"/> &nbsp;
    <a onclick="return confirm('Are you sure you want to delete this entry?');"
     href="view_entry.php?form_id=
    <?php echo $form_id; ?>&id=
    <?php echo $entry_id; ?>&delete=1"
    class="big_dotted_link">Delete</a></li>
    <?php } ?>

    That would remove delete link/button for form 1. Don't forget to change the id's with yours.


    MachForm Support

    Posted 13 years ago #
  6. raj000
    Member

    Hi,

    I have made the above changes recommended to fredwin and it has worked well for quiet a long time. However, I recently realized that user can still delete the transaction if the user is on edit_entry.php .

    Is there a way to disable the delete option on the edit entry mode.

    Thanks

    Posted 13 years ago #
  7. yuniar

    Search around line 59 of your edit_entry.php and you'll find this block of code:

    //check for delete parameter
    if(!empty($_GET['delete'])){
    
    	delete_entries($form_id,array($entry_id));
    
    	$_SESSION['AP_SUCCESS']['title'] = 'Entry deleted';
    	$_SESSION['AP_SUCCESS']['desc']  = "Entry #{$entry_id} has been deleted.";
    
    	$ssl_suffix = get_ssl_suffix();
    	header("Location: http{$ssl_suffix}://".$_SERVER['HTTP_HOST'].get_dirname($_SERVER['PHP_SELF'])."/manage_entries.php?id={$form_id}");
    	exit;
    }

    delete that block of code.

    Also search around line 196:

    <li><img src="images/icons/cross_22.gif" align="absmiddle"/> &nbsp;<a onclick="return confirm('Are you sure you want to delete this entry?');" href="edit_entry.php?form_id=<?php echo $form_id; ?>&id=<?php echo $entry_id; ?>&delete=1" class="big_dotted_link">Delete</a></li>

    delete that block of code as well.


    MachForm Founder

    Posted 13 years ago #

RSS feed for this topic

Reply