1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 04:23:38 +01:00

[ticket/13786] Add events to add MCP post options

Three new events are included:
1) Core event to perform new moderator action in includes/mcp/mcp_post.php
2) Core event to add/modify template data in includes/mcp/mcp_post.php
3) Template event to present new options in template/mcp_post.html

PHPBB3-13786
This commit is contained in:
javiexin 2015-04-27 13:21:23 +02:00
parent 6322970766
commit e98a5afd07
4 changed files with 62 additions and 4 deletions

View File

@ -496,6 +496,14 @@ mcp_front_latest_unapproved_before
* Since: 3.1.3-RC1
* Purpose: Add content before latest unapproved posts list
mcp_post_additional_options
===
* Locations:
+ styles/prosilver/template/mcp_post.html
+ styles/subsilver2/template/mcp_post.html
* Since: 3.1.5-RC1
* Purpose: Add content within the list of post moderation actions
memberlist_body_username_append
===
* Locations:

View File

@ -26,6 +26,7 @@ function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth, $cache;
global $phpbb_dispatcher;
$user->add_lang('posting');
@ -106,6 +107,21 @@ function mcp_post_details($id, $mode, $action)
}
break;
default:
/**
* This event allows you to handle custom post moderation options
*
* @event core.mcp_post_additional_options
* @var string action Post moderation action name
* @var array post_info Information on the affected post
* @since 3.1.5-RC1
*/
$vars = array('action', 'post_info');
extract($phpbb_dispatcher->trigger_event('core.mcp_post_additional_options', compact($vars)));
break;
}
// Set some vars
@ -197,7 +213,7 @@ function mcp_post_details($id, $mode, $action)
$l_deleted_by = '';
}
$template->assign_vars(array(
$mcp_post_template_data = array(
'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"),
@ -249,7 +265,32 @@ function mcp_post_details($id, $mode, $action)
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&i=$id&mode=$mode&lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&action=whois&p=$post_id&ip={$post_info['poster_ip']}") : '',
));
);
$s_additional_opts = false;
/**
* Event to add/modify MCP post template data
*
* @event core.mcp_post_template_data
* @var array post_info Array with the post information
* @var array mcp_post_template_data Array with the MCP post template data
* @var array attachments Array with the post attachments, if any
* @var bool s_additional_opts Must be set to true in extension if additional options are presented in MCP post panel
* @since 3.1.5-RC1
*/
$vars = array(
'poll_info',
'mcp_post_template_data',
'attachments',
's_additional_opts',
);
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars)));
$template->assign_vars($mcp_post_template_data);
$template->assign_var('S_MCP_POST_ADDITIONAL_OPTS', $s_additional_opts);
unset($mcp_post_template_data);
// Get User Notes
$log_data = array();

View File

@ -144,7 +144,7 @@
</div>
</div>
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER -->
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER or S_MCP_POST_ADDITIONAL_OPTS -->
<div class="panel">
<div class="inner">
@ -168,6 +168,10 @@
</form>
<!-- ENDIF -->
<!-- IF S_MCP_POST_ADDITIONAL_OPTS -->
<!-- EVENT mcp_post_additional_options -->
<!-- ENDIF -->
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST -->
<form method="post" id="mcp" action="{U_MCP_ACTION}">

View File

@ -143,7 +143,7 @@
<!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF -->
<!-- ELSE -->
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER -->
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER or S_MCP_POST_ADDITIONAL_OPTS -->
<br /><a name="mod" class="anchor"></a>
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg">
@ -156,6 +156,11 @@
<td class="row2"><form method="post" name="mcp_chgposter" action="{U_POST_ACTION}"><input class="post" type="text" name="username" value="" /> <input class="btnmain" type="submit" value="{L_CONFIRM}" name="action[chgposter]" /><br /><span class="gensmall">[ <a href="{U_FIND_USERNAME}" onclick="find_username(this.href); return false;">{L_FIND_USERNAME}</a> ]</span><!-- IF S_USER_SELECT --><br /><select name="u">{S_USER_SELECT}</select> <input type="submit" class="btnmain" name="action[chgposter_ip]" value="{L_CONFIRM}" /><!-- ENDIF -->{S_FORM_TOKEN}</form></td>
</tr>
<!-- ENDIF -->
<!-- IF S_MCP_POST_ADDITIONAL_OPTS -->
<!-- EVENT mcp_post_additional_options -->
<!-- ENDIF -->
<!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST -->
<tr>
<td class="row1" valign="top"><b class="gen">{L_MOD_OPTIONS}</b></td>