1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-03-23 00:50:30 +01:00

Merge pull request #5055 from dsinn/ticket/15471

[ticket/15471] Add core events to ACP when pruning a forum
This commit is contained in:
Marc Alexander 2017-12-27 20:44:40 +01:00
commit d1f10d54fc
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995
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>
<label><input type="radio" class="radio" id="sticky" name="prune_sticky" value="0" checked="checked" /> {L_NO}</label></dd>
</dl>
<!-- EVENT acp_prune_forums_settings_append -->
<p class="quick">
{S_HIDDEN_FIELDS}
{S_FORM_TOKEN}

View File

@ -433,6 +433,13 @@ acp_prune_forums_prepend
* Since: 3.1.7-RC1
* 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
===
* Locations:

View File

@ -55,7 +55,7 @@ class acp_prune
*/
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);
$forum_id = $request->variable('f', array(0));
@ -165,7 +165,7 @@ class acp_prune
}
else
{
confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields(array(
$hidden_fields = array(
'i' => $id,
'mode' => $mode,
'submit' => 1,
@ -177,7 +177,19 @@ class acp_prune
'prune_old_polls' => $request->variable('prune_old_polls', 0),
'prune_announce' => $request->variable('prune_announce', 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 array hidden_fields Hidden fields that are passed through the confirm screen
* @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';
$template->assign_vars(array(
$template_data = array(
'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums],
'U_ACTION' => $this->u_action,
'U_BACK' => $this->u_action,
'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);
}
/**
* 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);
}