mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 21:38:54 +00:00
Merge pull request #1870 from nickvergessen/ticket/12015
Ticket/12015 Enhance events in viewtopic to increase their usability
This commit is contained in:
commit
b64d94b6bc
2 changed files with 40 additions and 4 deletions
|
@ -139,9 +139,12 @@ $sql_ary = array(
|
|||
* @event core.viewonline_modify_sql
|
||||
* @var array sql_ary The SQL array
|
||||
* @var bool show_guests Do we display guests in the list
|
||||
* @var int guest_counter Number of guests displayed
|
||||
* @var array forum_data Array with forum data
|
||||
* @since 3.1-A1
|
||||
* @change 3.1.0-a2 Added vars guest_counter and forum_data
|
||||
*/
|
||||
$vars = array('sql_ary', 'show_guests');
|
||||
$vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars)));
|
||||
|
||||
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
|
||||
|
@ -345,9 +348,11 @@ while ($row = $db->sql_fetchrow($result))
|
|||
* @var array row Array with the users sql row
|
||||
* @var string location Page name to displayed in the list
|
||||
* @var string location_url Page url to displayed in the list
|
||||
* @var array forum_data Array with forum data
|
||||
* @since 3.1-A1
|
||||
* @change 3.1.0-a2 Added var forum_data
|
||||
*/
|
||||
$vars = array('on_page', 'row', 'location', 'location_url');
|
||||
$vars = array('on_page', 'row', 'location', 'location_url', 'forum_data');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars)));
|
||||
|
||||
$template->assign_block_vars('user_row', array(
|
||||
|
|
|
@ -988,10 +988,19 @@ $sql_ary = array(
|
|||
* Event to modify the SQL query before the post and poster data is retrieved
|
||||
*
|
||||
* @event core.viewtopic_get_post_data
|
||||
* @var int forum_id Forum ID
|
||||
* @var int topic_id Topic ID
|
||||
* @var array topic_data Array with topic data
|
||||
* @var array post_list Array with post_ids we are going to retrieve
|
||||
* @var int sort_days Display posts of previous x days
|
||||
* @var string sort_key Key the posts are sorted by
|
||||
* @var string sort_dir Direction the posts are sorted by
|
||||
* @var int start Pagination information
|
||||
* @var array sql_ary The SQL array to get the data of posts and posters
|
||||
* @since 3.1-A1
|
||||
* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start
|
||||
*/
|
||||
$vars = array('sql_ary');
|
||||
$vars = array('forum_id', 'topic_id', 'topic_data', 'post_list', 'sort_days', 'sort_key', 'sort_dir', 'start', 'sql_ary');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars)));
|
||||
|
||||
$sql = $db->sql_build_query('SELECT', $sql_ary);
|
||||
|
@ -1684,13 +1693,18 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
|||
* Modify the posts template block
|
||||
*
|
||||
* @event core.viewtopic_modify_post_row
|
||||
* @var int start Start item of this page
|
||||
* @var int i Number of the post on this page
|
||||
* @var int end Number of posts on this page
|
||||
* @var array row Array with original post and user data
|
||||
* @var array cp_row Custom profile field data of the poster
|
||||
* @var array attachments List of attachments
|
||||
* @var array user_poster_data Poster's data from user cache
|
||||
* @var array post_row Template block array of the post
|
||||
* @since 3.1-A1
|
||||
* @change 3.1.0-a2 Added vars start, i, end, and attachments
|
||||
*/
|
||||
$vars = array('row', 'cp_row', 'user_poster_data', 'post_row');
|
||||
$vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars)));
|
||||
|
||||
if (isset($cp_row['row']) && sizeof($cp_row['row']))
|
||||
|
@ -1726,6 +1740,23 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event after the post data has been assigned to the template
|
||||
*
|
||||
* @event core.viewtopic_post_row_after
|
||||
* @var int start Start item of this page
|
||||
* @var int i Number of the post on this page
|
||||
* @var int end Number of posts on this page
|
||||
* @var array row Array with original post and user data
|
||||
* @var array cp_row Custom profile field data of the poster
|
||||
* @var array attachments List of attachments
|
||||
* @var array user_poster_data Poster's data from user cache
|
||||
* @var array post_row Template block array of the post
|
||||
* @since 3.1.0-a2
|
||||
*/
|
||||
$vars = array('start', 'i', 'end', 'row', 'cp_row', 'attachments', 'user_poster_data', 'post_row');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars)));
|
||||
|
||||
$prev_post_id = $row['post_id'];
|
||||
|
||||
unset($rowset[$post_list[$i]]);
|
||||
|
|
Loading…
Add table
Reference in a new issue