Match phpBB3.2 'Unread' FA Icon In WP Last Posts Widget!

User avatar
kaspir
Moderator
Moderator
Posts: 88
Joined: Mon Mar 20, 2017 2:38 pm
Location: USA
Contact:

Match phpBB3.2 'Unread' FA Icon In WP Last Posts Widget!

Post by kaspir »

Step 1: Edit your WP theme's (preferebably child's) header.php and add this right before the </head> tag. Be sure to use YOUR path to phpbb.

Code: Select all

<link rel="stylesheet" href="http://localhost/root_integrations/phpbb32/assets/css/font-awesome.min.css?assets_version=9">
Step 2: Open phpbb_last_topics.php and find:

Code: Select all

$w3all_post_state_ru = (isset($phpbb_unread_topics) && is_array($phpbb_unread_topics) && array_key_exists($value->topic_id, $phpbb_unread_topics)) ? $w3all_post_state_ru = '<span style="color:red">&#9754;</span>' : '';
Replace with:

Code: Select all

$w3all_post_state_ru = (isset($phpbb_unread_topics) && is_array($phpbb_unread_topics) && array_key_exists($value->topic_id, $phpbb_unread_topics)) ? $w3all_post_state_ru = '<span style="color:#BC2A4D"><i class="fa fa-file-o" aria-hidden="true"></i>&nbsp;</span>' : '';
Step 3: Upload both header.php & phpbb_last_topics.php to the proper directories, and refresh your page!

Instead of the original red finger point, the "unread" topic icon will now match the original color & FA icon from phpBB3.2 prosilver theme.

Hope someone enjoys this edit I've done for myself. Just sharing!

Another minor change I made, was I moved the ".$w3all_post_state_ru." var in phpbb_last_topics.php to the beginning of the <a> element, so that my FA icon now appears BEFORE the topic title, instead of after. This will need to be done on a few different lines, but should look something like this:

Code: Select all

echo "<li>".$w3all_post_state_ru." <a href=\"".get_home_url()."/index.php/$wp_w3all_forum_folder_wp/?forum_id=$value->forum_id&amp;topic_id=$value->topic_id&amp;post_id=$value->post_id#p$value->post_id\" title=\"Last Post: $value->post_subject\">$value->topic_title</a><br />".__( 'by' , 'wp-w3all-phpbb-integration' )." $value->topic_last_poster_name ".__( 'at ' , 'wp-w3all-phpbb-integration' ) . date_i18n( 'H:i M d, Y', $value->topic_last_post_time + ( 3600 * get_option( 'gmt_offset' )) ) ."</li>";
Only move the var on echo lines. Enjoy.
Last edited by kaspir on Mon Oct 16, 2017 8:45 am, edited 1 time in total.
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Match phpBB3.2 'Unread' FA Icon In WP Last Posts Widget!

Post by axew3 »

Nice! We can add this by default for sure.
Let prepare 1.6.7 to be WP widget code fixed on last topics and remove some messy thing, and we add this by default!
This a sticky post!
User avatar
axew3
w3all User
w3all User
Posts: 2883
Joined: Fri Jan 22, 2016 5:15 pm
Location: Italy
Contact:

Re: Match phpBB3.2 'Unread' FA Icon In WP Last Posts Widget!

Post by axew3 »

hi! i'm over right now to check before to start 1.7.2 and looking for requested additions.
do not know if this will be added but looking on fly into this feature (and due to latest little fix to the js code that render columned colors (still not perfect for topics lists) on phpBB template) i see that the folder
phpbb32/assets/css/
contain the font-awesome.min.css
so you can avoid to load the file from external resource and load the one embedded already into phpBB adding on wp header the css style:

Code: Select all

  <link rel="stylesheet" href="http://localhost/root_integrations/phpbb32/assets/css/font-awesome.min.css?assets_version=9">
so replace the code on widget, as suggested by @kaspir.
(just to mention on fly)
User avatar
kaspir
Moderator
Moderator
Posts: 88
Joined: Mon Mar 20, 2017 2:38 pm
Location: USA
Contact:

Re: Match phpBB3.2 'Unread' FA Icon In WP Last Posts Widget!

Post by kaspir »

That's actually smarter, I totally didn't think of it! Thanks!

phpBB 3.2 USERS
Instead use his suggestion to load FA icons, add this to your Wordpress, header.php (sorry I forgot or didn't mention his before):

Code: Select all

  <link rel="stylesheet" href="http://localhost/root_integrations/phpbb32/assets/css/font-awesome.min.css?assets_version=9">
Same replacement as first post in phpbb_last_topis.php

Code: Select all

 $w3all_post_state_ru = (isset($phpbb_unread_topics) && array_key_exists($value->topic_id, $phpbb_unread_topics)) ? $w3all_post_state_ru = '<span style="color:#BC2A4D"><i class="fa fa-file-o" aria-hidden="true"></i></span>' : '';
Image
World of Phaos RPG online is making it's come back! Play free now!
Check out phpBB contributions & extension downloads. :P
Post Reply