Forum Integration - Recent Posts on Main Site
#41
Does this method still work? I can't seem to wrap my brain around it. Sad
Reply
#42
The code is working really well for me. But, In some ways too well. it is choosing to display the threads in every forum including the hidden admin forums. While they aren't click able and accessible to the average user is there a way to either choose threads based on a user forum level, or select which forums this will draw from?

Thank you,
Mark D.
Reply
#43
umm I see this thread was started like back in 2010? So Id say it is a good idea to say goodbye to the old mysql_query() function. Its time to shift to PDO or MySQLi now, you may even want to define your own database class and methods by extending PDO or other database libraries.
Reply
#44
Yes, indeed. Still works until now. Sky is the limit for your idea.
Reply
#45
This user has been denied support. This user has been denied support.
Guys, where template this one to place?? I mean this integration, where will be this one to place?? And also, what directory/path to the forums did he mean?? Sad
Reply
#46
(2012-02-24, 10:36 PM)theripetomato Wrote: Does this method still work? I can't seem to wrap my brain around it. Sad

Here are steps 1 & 3 updated to work w/ MyBB 1.6.x*
*and MyBB 1.8 (?):

1. Put this php script at the beginning of the page you want to display the recent posts on line 1 (before the HEAD tags)
<?php
chdir("pathtoforums/"); // path to MyBB
define("IN_MYBB", 1);
require("./global.php");
global $mybb, $db, $cache, $lang, $plugins;  // Trim this list of global vars, if you want to.
?>

3. Insert the code below where you want recent posts to be displayed
<?php
      $query = $db->query("
            SELECT t.*, u.username
            FROM mybb_threads t
            LEFT JOIN mybb_users u ON (u.uid=t.uid)
            WHERE 1=1 AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
            ORDER BY t.lastpost DESC
            LIMIT 0, 6" // Change the last digit to how many recent post you want to be shown
        );

    $list = '';
    while($fetch = $db->fetch_array($query))
    {
        $list .= "<strong><a href=\"forums/showthread.php?tid={$fetch['tid']}\">".htmlspecialchars_uni($fetch['subject'])."</a></strong><br />";
        $poster = "<a href=\"forums/member.php?action=profile&uid=".$fetch['uid']."\">{$fetch['username']}</a>";
        $list .= "Created by: {$poster}<br />";
        $list .= "<i>" .$fetch['replies']. " Replies</i>";
        $list .= "<i> , " .$fetch['views']. " Views</i><br />";
        $list .= " (<i>Last post by: " .$fetch['lastposter']. "</i>)<br /><hr width=\"50\"><br />";
    
    }
    //output
    echo $list;
?>
#
MyBB is the best forum software! Exclamation

Reply
#47
Hi fellows,

is there a way that recent post shows last posts individually one by one instead showing in single line?, or is there any plugin doing this work?, I will add one picture that you can understand me easily, thanks.

This is my Mybb forum, currently I am using overview plugin with only post section, it doesn't have time/date and post area specs, it doesn't look nice, http://www.kuluckaclub.com

if anyone can help me I much appreciate it.

and this is how I want to use recent posts, it is in different language but you may understand me, thanks.


Attached Files Thumbnail(s)
   
Reply
#48
this almost works, it just conflicts with the WordPress calls I already have at the top of my page.

As soon as I add your above code I get a blank white screen unless I take away the wordpress calls then it sort of works but I need wordpress.

any ideas?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)