MyBB Community Forums

Full Version: Rate Me a Funny
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
How do I stop this plug-in from refreshing the page?

When a user clicks on one of the icons, the ajax will update but the thread will fully refresh as well.

Any help would be appreciated.
(2012-07-22, 06:12 PM)StampsFans Wrote: [ -> ]How do I stop this plug-in from refreshing the page?

When a user clicks on one of the icons, the ajax will update but the thread will fully refresh as well.

Any help would be appreciated.

Anyone?
It was working fine until today, now i'm getting a "content encoding error" whenever I try to rate someone.
(2012-07-30, 11:23 PM)StampsFans Wrote: [ -> ]
(2012-07-22, 06:12 PM)StampsFans Wrote: [ -> ]How do I stop this plug-in from refreshing the page?

When a user clicks on one of the icons, the ajax will update but the thread will fully refresh as well.

Any help would be appreciated.

Anyone?
I got this problem aswell. .some help would be nice.
This doesn't work for me...like the others...nothing shows.
I've made new version of this plugin! Waiting for submission to be approved! Please check OP for change log. The manual install isn't hard at all!

you can download attachment while waiting for approval.
approved

sorry guys for being away for such a long time! I hope I don't have to make you guys wait anymore..
No sure if you know about this, but I was thinking (and actually got to beta stage) about forking your plugin. There are many things I don't like about it TBH, even when it does is the BEST plugin for which it does currently freely available (ignoring Tomm's Post Reputation, which requires MyNetworks, a big downward for me since I'm an optimize freaky, you can say).

My fork is now SO different, that I don't consider it a fork anymore, really, I can not see to find a piece of code that remains from yours. Anyways, there are some things that you need to improve here quite seriously, the main problem with your plugin for me was two things.
  • Too many queries.
  • It uses jQuery.

Glad you "fixed" the jQuery one. But currently I can see some performance issues regarding your plugin.

function ratemf_postbit(&$post)
{
    global $db,$settings,$mybb;

    $query = $db->simple_select("posts", "*", "pid='".$post['pid']."'");
    $ratemf_yes = $db->fetch_field($query, "ratemf");
    $post['ratemf'] = '';

You don't need to query the DB to get each post's "ratemf" column, it is already there for you to use it.
function ratemf_postbit(&$post)
{
    global $db,$settings,$mybb;

    $ratemf_yes = $post['ratemf'];
    $post['ratemf'] = '';

You are even doing queries inside queries, which is next to unbelievable.
function ratemf_postbit_rate_it($post)
{
    global $db,$settings,$mybb;
    $rate_name = '';
    $rate_img = '';

    $querys = $db->simple_select("ratemf", "*", "", array('order_by' => 'disporder'));
    while($result=$db->fetch_array($querys))
    {
        $stop = 0;
        $query = $db->simple_select("posts", "*", "pid='".$post['pid']."'");
        $fid = $db->fetch_field($query, "fid");
        $query = $db->simple_select("ratemf", "*", "id='".$result['id']."'");
        while($inception=$db->fetch_array($query))

Even through you are passing the post information by reference, you are querying it once again (two times by now!). For the rates, why not trying to use the MyBB cache system? Only difference is the change from while loop to a foreach loop, and I'm sure performance will significantly increase.

                    $query = $db->simple_select("users", "*", "uid='".$whom."'");
                    $username = $db->fetch_field($query, "username");

Try to use the core get_user() function, at least probably save queries.
					$user = get_user($whom);
                    $username = $user['username'];

Don't trying to say I'm an expert when it comes to optimization, because it is not true at all. Just pouting out what I noticed.

I really wish you the best of the lucks with your plugin and I just approved it.
Yeah. Finally some kind of input. Thanks too for approving it.
I keep forgetting about optimization and just wanted to get over with.

also, are there any more shortcut functions that i should know of? Big Grin
There are actually some others, read up the inc/functions.php file, that is included in each php that includes the MyBB core (global.php, xmlhttp.php, etc).

Other files may also have useful functions for you to use(functions_user.php, functions_post.php, etc).

But anyways, even using get_user wouldn't be the best option here, you need to cache all users on one go (one query if possible).

BTW, I have been following this plugin since long ago, just people will not always actually comment with no real reason Wink
I'm trying to figure out how to use the cache system. Am I suppose to use a hook? or do I send mysql data into the datacache?

I tried to use $cache, but it gets refreshed...

new version coming out soon.


New version out.

Please check the OP for changelog again! There is a new version and i can guarantee it's worth the download.

Temporary download link
Pages: 1 2 3 4 5 6 7