The website is for sale. Check here for more information.
This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.
Plugin Does Nothing
#1
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
Reply
#2
Well yes everything is actually wrong. I recommend you to read this:
http://forums.mybb-plugins.com/Thread-My...4#pid55914
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.
Reply
#3
I completely understand how to code plugins now. Smile
Reply
#4
That's good Smile
To download our paid plugins and receive support you must be a paid subscriber. Click here for more information.
Reply



  • View a Printable Version


Users browsing this thread: 1 Guest(s)

About MyBB-Plugins

Plug Yourself into the best MyBB AddOn.

Copyright © 2009-2021 MyBB-Plugins Forums.

Statistics

  • 51,000+ Posts
  • 19,000+ Members
  • 3,600+ Threads

Impressed? For sure
Check Full Stats here