[Plugin: phpbb_recent_topics] >>> phpbb recent POSTS
-
I’d like some instrukcions, that in my wordpress sidebar topics would be listed by the time someone made a post in the topic. for example if topic is very old and it isn’t visible in the recent topic sidebar, and when someone posts there it goes in the first position in the sidebar, I’d be thankful for instrukcions or plugin update with this option π
-
π lol noOne gives a fuck what do I need π
!!! This only works in phpBB3 !!!
In the file display.php change “topic_time” to “topic_last_post_time” (5x)
Now the Topics are sorted by the latest post in the topic, but the plugin is still linking to the topic-page and not to the last post. So you have to change (in display.php) this line:
echo " href='" . $SITEURL . "/viewtopic.php?t=$topic->topic_id'>";
to this:
echo " href='" . $SITEURL . "/viewtopic.php?p=$topic->topic_last_post_id#p$topic->topic_last_post_id'>";Now you have links to the latest post in the topic!
Greetings
TorstenThanks, can you share more hacks? And it would be beautifull to have the ability to add two or more widgets with different information inside (for example, one with last topic, one with last post, and so on).
Thank you
zodiac1978, dude, thanks a lot.It was REALLY REALLY helpful.I was sooo nervous that noone could help me.I’d like to donate you, could I ? π I’d like to know your paypal in order to do that.If you don’t want to say it public, you can send it to my email. [email protected]
@rate4d: I’ve got a Paypal Donate-Button on my Blog: http://netztaucher.wordpress.com/ π
I’ve donated β¬5.00 EUR.It’s not very big money, but a bit better than only “thanks”.So, thanks again zodiac, you helped a lot.It’s pleasure to do someone good π As I appreaciate your help I hope you appreciate people’s donations.Helping for people in support forums for free is very kind work. π
Sorry for answering so late. The Paypal-E-Mail was in my spam folder!
Thank you very much for your donation!
This is my first donation ever … πKind regards
TorstenGreat modification. After reviewing the idea (and implementing it). I thought it would be nice to reflect the real post date (and time).
So after changing some lines of code, I ended up with this:
<?php # Get the Options from the Database $PHPBBDB = stripslashes(get_option('prt_phpbb_db')); $TOPIC_TABLE = stripslashes(get_option('prt_phpbb_tt')); $SITEURL = stripslashes(get_option('prt_phpbb_url')); $PHPBBDATE = stripslashes(get_option('prt_phpbb_date')); $PHPBBEXCLUDED = get_option('prt_phpbb_exclued'); $OPENINNEWWIN = stripslashes(get_option('prt_phpbb_newwin')); # TODO change above variables to match "admin-display" style, cause it makes more sense! $prt_phpbb_dbinsecureon = stripslashes(get_option('prt_phpbb_dbinsecureon')); # Setup our WordPress DB Connection global $wpdb; # Are we a function call or Page call ? Set up our list length... if (is_null($LIMIT)) { $LIMIT = stripslashes(get_option('prt_phpbb_LIMIT')); if (is_null($LIMIT)) { $LIMIT = 5; } } # Check the $TOPIC_TABLE variable if (is_null($TOPIC_TABLE)) { $TOPIC_TABLE = "phpbb_topics"; } # if $TOPIC_TABLE is set up empty :) if ($TOPIC_TABLE == "") { $TOPIC_TABLE = "phpbb_topics"; } # Connect to php BB # # Insecure Method if ($prt_phpbb_dbinsecureon == "1") { $prt_phpbb_dbinsecureuid = stripslashes(get_option('prt_phpbb_dbinsecureuid')); $prt_phpbb_dbinsecurepw = stripslashes(get_option('prt_phpbb_dbinsecurepw')); $prt_phpbb_dbinsecurehost = stripslashes(get_option('prt_phpbb_dbinsecurehost')); $phpbbdb = new wpdb($prt_phpbb_dbinsecureuid, $prt_phpbb_dbinsecurepw, $PHPBBDB, $prt_phpbb_dbinsecurehos); } else { # Secure Method $wpdb->select($PHPBBDB); } # Run The query if (is_array($PHPBBEXCLUDED)) { $counter = 0; $countermax = count($PHPBBEXCLUDED) -1; # Construct Excluded Query $EXCLUDED_FORUM = "AND "; foreach ($PHPBBEXCLUDED as $EXCLUDED) { $EXCLUDED_FORUM .= "forum_id !=$EXCLUDED"; if ($counter < $countermax ) { $EXCLUDED_FORUM .= " AND "; } $counter++; } // Added WHERE TOPIC_APPROVED = 1 to the following, creditz Ashish http://www.microstrategy101.com/ if ($prt_phpbb_dbinsecureon == "1") { // $results = $phpbbdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 $EXCLUDED_FORUM ORDER BY topic_time DESC LIMIT $LIMIT"); $results = $phpbbdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 $EXCLUDED_FORUM ORDER BY topic_last_post_time DESC LIMIT $LIMIT"); } else { // $results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 $EXCLUDED_FORUM ORDER BY topic_time DESC LIMIT $LIMIT"); $results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 $EXCLUDED_FORUM ORDER BY topic_last_post_time DESC LIMIT $LIMIT"); } } else { # No excluded Query if ($prt_phpbb_dbinsecureon == "1") { $results = $phpbbdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 ORDER BY topic_time DESC LIMIT $LIMIT"); } else { $results = $wpdb->get_results("SELECT * FROM $TOPIC_TABLE WHERE TOPIC_APPROVED = 1 ORDER BY topic_time DESC LIMIT $LIMIT"); } } if ($results){ echo "<ul>"; # Loop away baby ! foreach ($results as $topic) { echo "<li>"; //echo "$topic->post_text"; echo "<a "; if ($OPENINNEWWIN == "1") { echo "target=\"_blank\""; } // echo " href='" . $SITEURL . "/viewtopic.php?t=$topic->topic_id'"; echo " href='" . $SITEURL . "/viewtopic.php?p=$topic->topic_last_post_id#p$topic->topic_last_post_id'"; echo ">"; echo "$topic->topic_last_post_subject"; // echo "$topic->topic_title"; echo "</a>"; if ($PHPBBDATE != "") { echo "<br />\n"; //echo "<small><i>" . date("$PHPBBDATE", $topic->topic_time) . "</i></small>\n"; echo "<small><i>" . date("$PHPBBDATE", $topic->topic_last_post_time) . "</i></small>\n"; } echo "</li>"; } echo "</ul>"; } else { echo "<h2> phpBB Error -$TOPIC_TABLE </h2>"; } if ($prt_phpbb_dbinsecureon != "1") { # Connect back to wordpress :-) $wpdb->select(DB_NAME); } ?>Now the only thing I want to add is a little code to fetch the post content and show it as a tooltip. But I have not gotten this to work yet, since I need to read the content of the post from another table.
Hi All,
FYI I have this thread bookmarked an will incorporate the suggestions in the next version π
If you could checkout the source from the trunk and post a link to a .diff / patch file that would really help me.
Thanks,
NickHi Nick,
I will look into making a diff. Suggestions for which tool to use would be great… I am not into development lately, missed out on most SVN/Git like tools.
So what to use to make a diff?
Gr.
#3This is now in the trunk – http://plugins.trac.ww.wp.xz.cn/log/phpbb-recent-topics/
I plan to do some further code clean up prior to the next release, please test.
Cheers,
NickGreat plugin !
I have 1 problem. When i fetch the topics i get wrong time. Im in sweden ( UTC + 1 ) and summertime, but it shows -2 hrs.
forgot to say date is correct in forum
Yeah, I deleted time from my settings for this plugin. But I do see the same problem. I have looked into this, but I have not been able to pinpoint the problem.
Anyone any ideas on how to solve this?
Elo,
I think the problem is that the servers ‘actual’ time is on a different zone to the forum/wp.
In the plugin I pull the post/topic time direct out from mysql (and format it in php)…. the solution requires a patch to handle timezones, however the technically difficulty relies in that this plugin _must_ support PHP4 (like WP) and be future-proofed to work with PHP 5.2’s built-in functions…. setting up a testing environment which can debug both PHP4/5 is a bit of a headache…. possibly something I’ll do once I’m sure that no WP3.0 bugs appear.
Cheers,
Nick
The topic ‘[Plugin: phpbb_recent_topics] >>> phpbb recent POSTS’ is closed to new replies.