[ticket/15471] Add core events to ACP when pruning a forum

PHPBB3-15471
This commit is contained in:
Daniel Sinn 2017-11-30 15:40:18 -05:00
parent b66b497429
commit 5b22ccfa76
4 changed files with 49 additions and 6 deletions

View file

@ -94,7 +94,9 @@
<dd><label><input type="radio" class="radio" name="prune_sticky" value="1" /> {L_YES}</label> <dd><label><input type="radio" class="radio" name="prune_sticky" value="1" /> {L_YES}</label>
<label><input type="radio" class="radio" id="sticky" name="prune_sticky" value="0" checked="checked" /> {L_NO}</label></dd> <label><input type="radio" class="radio" id="sticky" name="prune_sticky" value="0" checked="checked" /> {L_NO}</label></dd>
</dl> </dl>
<!-- EVENT acp_prune_forums_settings_append -->
<p class="quick"> <p class="quick">
{S_HIDDEN_FIELDS} {S_HIDDEN_FIELDS}
{S_FORM_TOKEN} {S_FORM_TOKEN}

View file

@ -433,6 +433,13 @@ acp_prune_forums_prepend
* Since: 3.1.7-RC1 * Since: 3.1.7-RC1
* Purpose: Add content before the forum select form label * Purpose: Add content before the forum select form label
acp_prune_forums_settings_append
===
* Locations:
+ adm/style/acp_prune_forums.html
* Since: 3.2.2-RC1
* Purpose: Add content after the prune settings
acp_prune_users_find_username_append acp_prune_users_find_username_append
=== ===
* Locations: * Locations:

View file

@ -55,7 +55,7 @@ class acp_prune
*/ */
function prune_forums($id, $mode) function prune_forums($id, $mode)
{ {
global $db, $user, $auth, $template, $phpbb_log, $request; global $db, $user, $auth, $template, $phpbb_log, $request, $phpbb_dispatcher;
$all_forums = $request->variable('all_forums', 0); $all_forums = $request->variable('all_forums', 0);
$forum_id = $request->variable('f', array(0)); $forum_id = $request->variable('f', array(0));
@ -165,7 +165,7 @@ class acp_prune
} }
else else
{ {
confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields(array( $hidden_fields = array(
'i' => $id, 'i' => $id,
'mode' => $mode, 'mode' => $mode,
'submit' => 1, 'submit' => 1,
@ -177,7 +177,19 @@ class acp_prune
'prune_old_polls' => $request->variable('prune_old_polls', 0), 'prune_old_polls' => $request->variable('prune_old_polls', 0),
'prune_announce' => $request->variable('prune_announce', 0), 'prune_announce' => $request->variable('prune_announce', 0),
'prune_sticky' => $request->variable('prune_sticky', 0), 'prune_sticky' => $request->variable('prune_sticky', 0),
))); );
/**
* Use this event to pass data from the prune form to the confirmation screen
*
* @event core.prune_forums_settings_confirm
* @var int[] hidden_fields The IDs of the topics to be deleted
* @since 3.2.2-RC1
*/
$vars = array('hidden_fields');
extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_confirm', compact($vars)));
confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields($hidden_fields));
} }
} }
@ -217,13 +229,25 @@ class acp_prune
$l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS';
$template->assign_vars(array( $template_data = array(
'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums],
'U_ACTION' => $this->u_action, 'U_ACTION' => $this->u_action,
'U_BACK' => $this->u_action, 'U_BACK' => $this->u_action,
'FORUM_LIST' => $forum_list, 'FORUM_LIST' => $forum_list,
'S_HIDDEN_FIELDS' => $s_hidden_fields) 'S_HIDDEN_FIELDS' => $s_hidden_fields,
); );
/**
* Event to add/modify prune forums settings template data
*
* @event core.prune_forums_settings_template_data
* @var array template_data Array with form template data
* @since 3.2.2-RC1
*/
$vars = array('template_data');
extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_template_data', compact($vars)));
$template->assign_vars($template_data);
} }
} }

View file

@ -2369,6 +2369,16 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync
$topic_list = array_unique($topic_list); $topic_list = array_unique($topic_list);
} }
/**
* Perform additional actions before topic deletion via pruning
*
* @event core.prune_delete_before
* @var int[] topic_list The IDs of the topics to be deleted
* @since 3.2.2-RC1
*/
$vars = array('topic_list');
extract($phpbb_dispatcher->trigger_event('core.prune_delete_before', compact($vars)));
return delete_topics('topic_id', $topic_list, $auto_sync, false); return delete_topics('topic_id', $topic_list, $auto_sync, false);
} }