mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-12 11:40:26 +01:00
[ticket/15925] Add core.sync_forum_last_post_info_sql
Add core event to modify the last posts' data retrieved to update forums' data Also add $phpbb_dispatcher to sync globals to allow function use PHPBB3-15925
This commit is contained in:
parent
9d2ab88c69
commit
6728497434
@ -1324,7 +1324,7 @@ function update_posted_info(&$topic_ids)
|
|||||||
*/
|
*/
|
||||||
function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false)
|
function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db, $phpbb_dispatcher;
|
||||||
|
|
||||||
if (is_array($where_ids))
|
if (is_array($where_ids))
|
||||||
{
|
{
|
||||||
@ -1826,11 +1826,26 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
|
|||||||
// 5: Retrieve last_post infos
|
// 5: Retrieve last_post infos
|
||||||
if (count($post_ids))
|
if (count($post_ids))
|
||||||
{
|
{
|
||||||
$sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour
|
$sql_ary = array(
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
'SELECT' => 'p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour',
|
||||||
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
|
'FROM' => array(
|
||||||
AND p.poster_id = u.user_id';
|
POSTS_TABLE => 'p',
|
||||||
$result = $db->sql_query($sql);
|
USERS_TABLE => 'u',
|
||||||
|
),
|
||||||
|
'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . '
|
||||||
|
AND p.poster_id = u.user_id',
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event to modify the SQL array to get the post and user data from all forums' last posts
|
||||||
|
*
|
||||||
|
* @event core.sync_forum_last_post_info_sql
|
||||||
|
* @var array sql_ary SQL array with some post and user data from the last posts list
|
||||||
|
* @since 3.2.6-RC1
|
||||||
|
*/
|
||||||
|
$vars = array('sql_ary');
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.sync_forum_last_post_info_sql', compact($vars)));
|
||||||
|
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user