ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Standalone Delete Function?

February 12, 2009 6:59pm

Subscribe [6]
  • #1 / Feb 12, 2009 6:59pm

    Derek Russell

    29 posts

    Hey

    Just wondering if there is a way to allow the deletion of entries in the same manner in which using the SAEF allows entries to be made on the site?

    Thanks

    D 😊

  • #2 / Feb 13, 2009 1:31am

    John Henry Donovan

    12339 posts

    Joy,

    it is not possible to allow the deletion of entries using a SAEF out-of-the-box.

    Solspace has a Form Helper plugin which allows users to edit their own entries but without the ability to delete entries from the frontend.

    You could use that to create an element which allows users to switch the status of their entries to a “closed” or “deleted” status.

    These can then be periodically deleted from the CP by yourself

  • #3 / Feb 13, 2009 4:03am

    minimal design

    356 posts

    I’m actually coming across the same situation… do you have a code sample that would output a single link that changes status to “closed” the drop down is not an option since the goal it to make it look like a delete button…

    Thanks for any pointer in the right direction…

  • #4 / Feb 13, 2009 4:54am

    minimal design

    356 posts

    ok… couldn’t get a link, but I did it with an img type input field, something like that:

    <input type="hidden" name="entry_id" value="{entry_id}"  />
    <input type="hidden" name="status" value="closed"  />
    <input type="image" src="/delete_image.gif" name="submit" value="Submit" />

    Seems to work, but let me know if I messed something up without knowing, I’m sort of new to SAEF…

    Thanks!

  • #5 / Feb 13, 2009 4:59am

    Mark Bowen

    12637 posts

    Anything’s possible if you know where to look 😉

    Plugin - Delete Entries Outside Of The Control Panel

    That should hopefully cover it.

    Best wishes,

    Mark

  • #6 / Feb 13, 2009 5:04am

    minimal design

    356 posts

    Anything’s possible if you know where to look 😉

    Plugin - Delete Entries Outside Of The Control Panel

    That should hopefully cover it.

    Best wishes,

    Mark

    You’re like the EE plugin Jedi… You know them all, pretty amazing! Thanks… as always 😉

  • #7 / Feb 13, 2009 9:01am

    Mark Bowen

    12637 posts

    You’re like the EE plugin Jedi… You know them all, pretty amazing! Thanks… as always 😉

    No problem at all. I’m kind of lucky in the respect that if I have seen something once I never forget it. Comes from playing the piano I think, although I play by ear so don’t even need music so I think it’s just something in-built to my system really 😉

    Best wishes,

    Mark

  • #8 / Feb 13, 2009 10:34am

    Ingmar

    29245 posts

    Joy, does that answer your question? Otherwise I’d shift this over to Howto. As John said, there is nothing like that built into EE by default.

  • #9 / Aug 09, 2009 9:43am

    sm9

    352 posts

    Hi there,

    I’m currently working on an application system, where we have an applicant weblog (containing personal details of the user who is logging into the SAEF to create their applications) and an application weblog (for the applications themselves).  I’d love to have a ‘delete’ option next to their applications, so that they can delete them if needed (they have permissions to delete their own entries).  Either that, or the ability to ‘close’ the entry would be fine too.

    I tried using this plugin, but as I’m using reverse related entries to get the application data, using it deleted the actual applicant record instead (as the weblog entries tag is pulling in the applicant weblog rather than the application weblog).

    I wonder if anyone has any ideas on how I could adapt my code to make this delete the actual application entry instead?  Or maybe even another option to set the entry as closed even?

    <table>
        <tr>
            <th>Scheme Name</th>
            <th>Status</th>
            <th>Edit/View</th>
            <th>Delete</th>
        </tr>
                                            
    {exp:query sql="SELECT entry_id FROM exp_weblog_data WHERE field_id_494 = '<?php global $SESS; echo $SESS->userdata['member_id']; ?>' AND weblog_id ='56'"}
        {exp:weblog:entries weblog="applicant" entry_id="{entry_id}"}
            {reverse_related_entries orderby="title"}
    
        <tr>
            <td>{title}</td>
            <td>Not submitted</td>
            <td><a href="/apply/edit-application/{url_title}">Edit this entry</a></td>
            <td>{exp:delete_entry:link entryid="{entry_id}" entrytype="application" template="apply/delete"}Delete{/exp:delete_entry:link}</td>
        </tr>
    
            {/reverse_related_entries}
        {/exp:weblog:entries}
    {/exp:query}
    </table>

    Thanks for any help,

    Stephen

  • #10 / Aug 09, 2009 11:05am

    Mark Bowen

    12637 posts

    Hi Stephen,

    In a bit of a rush so hopefully this makes sense but as the {entry_id} that is getting seen inside the delete_entry plugin is coming from the main weblog tag and not the entry_id of the related entry then perhaps if you embed a template at that point instead and pass in the url_title of that entry to that template then you should be able to use that in the embedded template to bring back just that one entry and then use the delete_entry plugin in there instead.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #11 / Aug 09, 2009 12:36pm

    Ingmar

    29245 posts

    You’re welcome to discuss this in more detail, I just moved it over to Howto.

  • #12 / Aug 09, 2009 1:38pm

    sm9

    352 posts

    Hi Stephen,

    In a bit of a rush so hopefully this makes sense but as the {entry_id} that is getting seen inside the delete_entry plugin is coming from the main weblog tag and not the entry_id of the related entry then perhaps if you embed a template at that point instead and pass in the url_title of that entry to that template then you should be able to use that in the embedded template to bring back just that one entry and then use the delete_entry plugin in there instead.

    Hope that helps a bit.

    Best wishes,

    Mark

    Hi Mark,

    I think I understood you, and have just got this working, thanks! 😊

    I’m not sure if I’ve followed what you suggested exactly, or have carried out a slightly more long-winded way.

    Previously, I had the following templates:

    - apply/index (where the ‘delete’ link was located)
    - apply/delete (where the EE delete plugin code was located

    Now following your advice, I have the following:

    - apply/index (as above)
    - apply/delete-confirm (where I’ve took your advice about using a new weblog:entries tag for the application weblog)
    - apply/delete (as above)

    This seems to work!  It involves an extra template and step, but I’m just going to setup some re-directs I think to get it working a bit smoother.

    Thanks! 😊

    Stephen

  • #13 / Aug 09, 2009 2:33pm

    Mark Bowen

    12637 posts

    Excellent news. Sounds like you did what I was trying to explain there. Sorry I couldn’t go into more detail but was in a slight rush.

    Glad you have it all working now though.

    Best wishes,

    Mark

  • #14 / Aug 14, 2009 10:10am

    sm9

    352 posts

    Hi there,

    I wasn’t sure where else to discuss this so I thought I’d post back here in the first instance.

    I got this Delete Entries plugin working fine for allowing users to delete their own entries.  I’ve just tried using it as a Super Admin to delete a user’s entry, and that works fine too, only the ‘Delete Confirm’ page gives the following error at the top of the page:

    Notice: Undefined variable: showconfirm in /home/mydomain/public_html/mysystem/plugins/pi.delete_entry.php on line 42

    Here’s the code from my template, where I have the ‘deleteconfirm’ value set to false (as per the instructions, as I don’t want the JS message to appear as I’m doing the warnings via template messages instead:

    <h2>Delete Confirmation</h2>
    
    <p>{exp:weblog:entries weblog="application" url_title="{segment_3}" dynamic="on" limit="1"}</p>
    
    <p><em>WARNING! Are you sure you want to delete the application for <b>'{title}'</b>? If you delete an application by accident, or delete the wrong one, you will not be able to recover it and will have to type it out again.</em></p>
    
    <p><a href="/apply/">No, I don't want to delete this. Please take me back to the Applcation home page.</a></p>
    
    <p>{exp:delete_entry:link entryid="{entry_id}" showconfirm="false" template="apply/delete"}Yes, I'm sure, please <b>delete</b> my application for <b>'{title}'</b>{/exp:delete_entry:link}</p>
    
    <p>{/exp:weblog:entries}

    The deletion of the entry still works fine, but I’d love to know what I’m doing wrong in order to prevent seeing that message.

    Any ideas appreciated!

    Thanks,

    Stephen

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases