bgarrels / textpattern

Automatically exported from code.google.com/p/textpattern
0 stars 0 forks source link

Callback_events: articles_deleted and categories_deleted #254

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
1. I rewrite a very old plugin rss_unlimited_categories, but unfortunately I 
can not determine which articles have been removed, to remove the information 
associated with these articles.

Without callback_event('articles_deleted') I need to directly intercept
$event == 'list' && $step == 'list_multi_edit' && ps('edit_method') == 'delete'

The most unpleasant thing - copy/paste priv_code_section from main code 
Texpattern and track all changes to the code in future versions of Textpattern.

copy/paste priv_code_section from current Texpattern code:

---
require_privs('article');

if (!has_privs('article.delete'))
{
        $allowed = array();

        if (has_privs('article.delete.own'))
        {
                foreach ($selected as $id)
                {
                        $author = safe_field('AuthorID', 'textpattern', "ID = $id");

                        if ($author == $txp_user)
                        {
                                $allowed[] = $id;
                        }
                }
        }

        $selected = $allowed;
}

---

So I want to suggest adding callback_event('articles_deleted').
IMHO, It could also be useful for other plugins such as: tru_tags, smd_tags, 
article-related images..  (remove unused tags, images).

Patch attached.

2. Exactly the same problem with callback_event('categories_deleted') - need 
directly intercept $event, $step, $method, $type, check_priv - track all 
changes in future...

So I want to suggest adding callback_event('categories_deleted').
Patch attached.

Original issue reported on code.google.com by zasl...@gmail.com on 28 Aug 2012 at 9:57

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r4089.

Original comment by stefdawson on 29 Aug 2012 at 12:50