Skip to content

Commit 2173a06

Browse files
committed
Merge pull request #7052 from iMattPro/ticket/17720
Ticket/17720 Add some events for consistency with topic lists in UCP, etc.
2 parents c97316b + 0cf49ab commit 2173a06

6 files changed

Lines changed: 66 additions & 3 deletions

File tree

‎phpBB/docs/events.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,6 +2480,20 @@ search_results_topic_title_after
24802480
* Since: 3.1.11-RC1
24812481
* Purpose: Add data after search results topic title
24822482

2483+
search_results_topic_title_append
2484+
===
2485+
* Locations:
2486+
+ styles/prosilver/template/search_results.html
2487+
* Since: 3.3.20-RC1
2488+
* Purpose: Add data directly after search results topic title
2489+
2490+
search_results_topic_title_prepend
2491+
===
2492+
* Locations:
2493+
+ styles/prosilver/template/search_results.html
2494+
* Since: 3.3.20-RC1
2495+
* Purpose: Add data directly before search results topic title
2496+
24832497
simple_footer_after
24842498
===
24852499
* Locations:
@@ -2522,8 +2536,12 @@ topiclist_row_append
25222536
+ styles/prosilver/template/search_results.html
25232537
+ styles/prosilver/template/viewforum_body.html
25242538
+ styles/prosilver/template/mcp_forum.html
2539+
+ styles/prosilver/template/ucp_main_bookmarks.html
2540+
+ styles/prosilver/template/ucp_main_front.html
2541+
+ styles/prosilver/template/ucp_main_subscribed.html
25252542
* Since: 3.1.0-a1
25262543
* Changed: 3.1.6-RC1 Added event to mcp_forum.html
2544+
* Changed: 3.3.20-RC1 Added event to UCP topic lists
25272545
* Purpose: Add content into topic rows (inside the elements containing topic titles)
25282546

25292547
topiclist_row_prepend
@@ -2532,8 +2550,12 @@ topiclist_row_prepend
25322550
+ styles/prosilver/template/search_results.html
25332551
+ styles/prosilver/template/viewforum_body.html
25342552
+ styles/prosilver/template/mcp_forum.html
2553+
+ styles/prosilver/template/ucp_main_bookmarks.html
2554+
+ styles/prosilver/template/ucp_main_front.html
2555+
+ styles/prosilver/template/ucp_main_subscribed.html
25352556
* Since: 3.1.0-a1
25362557
* Changed: 3.1.6-RC1 Added event to mcp_forum.html
2558+
* Changed: 3.3.20-RC1 Added event to UCP topic lists
25372559
* Purpose: Add content into topic rows (inside the elements containing topic titles)
25382560

25392561
topiclist_row_topic_by_author_after

‎phpBB/includes/ucp/ucp_main.php‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,20 @@ function main($id, $mode)
114114
$db->sql_freeresult($result);
115115
}
116116

117+
/**
118+
* Modify UCP front topic data before it is processed.
119+
*
120+
* @event core.ucp_main_front_modify_topic_data
121+
* @var array topic_list Topic IDs displayed on the UCP front page
122+
* @var array rowset Topic rows keyed by topic ID
123+
* @since 3.3.20-RC1
124+
*/
125+
$vars = array(
126+
'topic_list',
127+
'rowset',
128+
);
129+
extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_topic_data', compact($vars)));
130+
117131
$topic_forum_list = array();
118132
foreach ($rowset as $t_id => $row)
119133
{
@@ -902,14 +916,36 @@ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
902916
$sql = $db->sql_build_query('SELECT', $sql_array);
903917
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
904918

905-
$topic_list = $topic_forum_list = $global_announce_list = $rowset = array();
919+
$topic_list = $rowset = array();
906920
while ($row = $db->sql_fetchrow($result))
907921
{
908922
$topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id'];
909923

910924
$topic_list[] = $topic_id;
911925
$rowset[$topic_id] = $row;
926+
}
927+
$db->sql_freeresult($result);
928+
929+
/**
930+
* Modify subscribed/bookmarked topic data before it is processed.
931+
*
932+
* @event core.ucp_main_topiclist_modify_topic_data
933+
* @var string mode Topic-list mode ('subscribed' or 'bookmarks')
934+
* @var array topic_list Topic IDs displayed on the current page
935+
* @var array rowset Topic rows keyed by topic ID
936+
* @since 3.3.20-RC1
937+
*/
938+
$vars = array(
939+
'mode',
940+
'topic_list',
941+
'rowset',
942+
);
943+
extract($phpbb_dispatcher->trigger_event('core.ucp_main_topiclist_modify_topic_data', compact($vars)));
912944

945+
$topic_forum_list = $global_announce_list = array();
946+
foreach ($topic_list as $topic_id)
947+
{
948+
$row = $rowset[$topic_id];
913949
$topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread']) ? $row['forum_mark_time'] : 0;
914950
$topic_forum_list[$row['forum_id']]['topics'][] = $topic_id;
915951

@@ -918,7 +954,6 @@ function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
918954
$global_announce_list[] = $topic_id;
919955
}
920956
}
921-
$db->sql_freeresult($result);
922957

923958
$topic_tracking_info = array();
924959
if ($config['load_db_lastread'])

‎phpBB/styles/prosilver/template/search_results.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ <h2 class="searchresults-title"><!-- IF SEARCH_TITLE -->{SEARCH_TITLE}<!-- ELSE
188188
<dt class="author">{L_POST_BY_AUTHOR} <!-- EVENT search_results_post_author_username_prepend -->{searchresults.POST_AUTHOR_FULL}<!-- EVENT search_results_post_author_username_append --></dt>
189189
<dd class="search-result-date">{searchresults.POST_DATE}</dd>
190190
<dd>{L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></dd>
191-
<dd>{L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd>
191+
<dd>{L_TOPIC}{L_COLON} <!-- EVENT search_results_topic_title_prepend --><a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a><!-- EVENT search_results_topic_title_append --></dd>
192192
<!-- EVENT search_results_topic_title_after -->
193193
<dd>{L_REPLIES}{L_COLON} <strong>{searchresults.TOPIC_REPLIES}</strong></dd>
194194
<dd>{L_VIEWS}{L_COLON} <strong>{searchresults.TOPIC_VIEWS}</strong></dd>

‎phpBB/styles/prosilver/template/ucp_main_bookmarks.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ <h2>{L_TITLE}</h2>
3838
<dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
3939
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
4040
<div class="list-inner">
41+
<!-- EVENT topiclist_row_prepend -->
4142
<!-- IF topicrow.S_UNREAD_TOPIC -->
4243
<a class="unread" href="{topicrow.U_NEWEST_POST}">
4344
<i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span>
@@ -78,6 +79,7 @@ <h2>{L_TITLE}</h2>
7879
{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} &laquo;
7980
<a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a>
8081
</div>
82+
<!-- EVENT topiclist_row_append -->
8183
</div>
8284
</dt>
8385
<dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}

‎phpBB/styles/prosilver/template/ucp_main_front.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ <h3>{L_IMPORTANT_NEWS}</h3>
1717
<dt <!-- IF topicrow.TOPIC_ICON_IMG and topicrow.S_TOPIC_ICONS -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->>
1818
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
1919
<div class="list-inner">
20+
<!-- EVENT topiclist_row_prepend -->
2021
<!-- IF topicrow.S_UNREAD -->
2122
<a class="unread" href="{topicrow.U_NEWEST_POST}">
2223
<i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span>
@@ -45,6 +46,7 @@ <h3>{L_IMPORTANT_NEWS}</h3>
4546
<!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF -->
4647
{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} &laquo; <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a>
4748
</div>
49+
<!-- EVENT topiclist_row_append -->
4850
</div>
4951
</dt>
5052
<dd class="lastpost">

‎phpBB/styles/prosilver/template/ucp_main_subscribed.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ <h2>{L_TITLE}</h2>
8181
<dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
8282
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="row-item-link"></a><!-- ENDIF -->
8383
<div class="list-inner">
84+
<!-- EVENT topiclist_row_prepend -->
8485
<!-- IF topicrow.S_UNREAD_TOPIC -->
8586
<a class="unread" href="{topicrow.U_NEWEST_POST}">
8687
<i class="icon fa-file fa-fw icon-red icon-md" aria-hidden="true"></i><span class="sr-only">{NEW_POST}</span>
@@ -120,6 +121,7 @@ <h2>{L_TITLE}</h2>
120121
<!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF -->
121122
{L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL} &laquo; <a href="{topicrow.U_LAST_POST}" title="{L_GOTO_LAST_POST}">{topicrow.LAST_POST_TIME}</a>
122123
</div>
124+
<!-- EVENT topiclist_row_append -->
123125
</div>
124126
</dt>
125127
<dd class="lastpost"><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}

0 commit comments

Comments
 (0)