MyBB-Plugins Forums

Full Version: Plugin Does Nothing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
<?php

/*
* Last Five Recent Posts (LFRP)
* Blue of http://discussionzone.net (c) 2013
*/

if(!defined("IN_MYBB"))
{
    die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

function lfrp_info() {
    return array(
        "name"            => "Last Five Recent Posts",
        "description"    => "Displays the last five posts in index view.",
        "website"        => "http://discussionzone.net",
        "author"        => "Blue",
        "authorsite"    => "http://discussionzone.net",
        "version"        => "1.0",
        "guid"             => "",
        "compatibility" => "*"
    );
}


function lfrp_activate()
{
    global $db, $mybb;
    
$tfrp = "<table border=\"0\" cellspacing=\"{$theme['borderwidth']}\" cellpadding=\"{$theme['tablespace']}\" class=\"tborder\">

<thead>
<tr>
<td class=\"thead\" colspan=\"6\">
<div><strong><a href=\"#\">Recent Posts</a></strong></div>
</td>
</tr>
</thead>

<tbody>
<tr>
<td class=\"tcat\" colspan=\"6\"><span class=\"smalltext\"><strong>Icon</strong></span></td>
<td class=\"tcat\" width=\"85\" align=\"right\"><span class=\"smalltext\"><strong>Thread</strong></span></td>
<td class=\"tcat\" width=\"200\" align=\"center\"><span class=\"smalltext\"><strong>Replies</strong></span></td>
<td class=\"tcat\" width=\"200\" align=\"center\"><span class=\"smalltext\"><strong>Author</strong></span></td>
<td class=\"tcat\" width=\"200\" align=\"center\"><span class=\"smalltext\"><strong>Views</strong></span></td>
<td class=\"tcat\" width=\"200\" align=\"center\"><span class=\"smalltext\"><strong>Last Post</strong></span></td>

</tr>";

$query = $db->query("SELECT * FROM ".TABLE_PREFIX."users ORDER BY postnum DESC LIMIT 5");

    while($user = $db->fetch_array($query))
    {
    
$tfrp = "<tr>
<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">
<img src=\"images/discussionzone/on.gif\" alt=\"Forum Contains New Posts\" title=\"Forum Contains New Posts - Click to mark this forum as read\" class=\"ajax_mark_read\" id=\"mark_read_2\" style=\"cursor: pointer;\">
</td>

<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">
".build_profile_link($user['username'], $user['uid'])."
</td>

<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">
".build_profile_link($user['username'], $user['uid'])."
</td>

<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">

</td>

<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">

</td>

<td class=\"trow1\" align=\"center\" valign=\"center\" width=\"5%\">

</td>

</tr>";

$tfrp = "</tbody>
</table>";

}
}

function lfrp_deactivate()
{
}

?>

I'm learning PHP and trying to make plugins looking at other people's. This doesn't work at all.

I know this plugin won't display any statistics, I'm doing this for learning purposes.

Any suggestions?

Thanks,
Blue
Well yes everything is actually wrong. I recommend you to read this:
http://forums.mybb-plugins.com/Thread-My...4#pid55914
I completely understand how to code plugins now. Smile
That's good Smile