MyBB Community Forums

Full Version: RateMF Bug Squashing
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am working on fixing a bug with RateMyThread where this Display Order of the icons cannot be updated from within the admin panel. I was looking a the code that handles this and wanted some clarification on a function.

if($action == 'disporder') {
  if($mybb->get_input('display'))
  {
    foreach($mybb->get_input('display') as $id => $newdisplay)
    {
      $insert = array(
        "disporder" => $db->escape_string($newdisplay)
      );
      $db->update_query("ratemf_rates", $insert, "id='".$id."'");
    }
    ratemf_rates_cache();
  }
  admin_redirect("index.php?module=config-ratemf");
}

In the above code does $mybb->get_input('display') return an array of results of all inputs containing the word "display", the input names are formatted like: display[5]? I look forward to your responses!
(2020-07-17, 09:47 PM)TymuOG Wrote: [ -> ]In the above code does $mybb->get_input('display') return an array of results of all inputs containing the word "display", the input names are formatted like: display[5]? I look forward to your responses!

It seems like that was the intention. However, if I'm not mistaken, unless otherwise specified, get_input() returns a string.

I think it should be $mybb->get_input('display', MyBB::INPUT_ARRAY).

Please provide a link to the plugin for reference.
(2020-07-17, 10:40 PM)Omar G. Wrote: [ -> ]
(2020-07-17, 09:47 PM)TymuOG Wrote: [ -> ]In the above code does $mybb->get_input('display') return an array of results of all inputs containing the word "display", the input names are formatted like: display[5]? I look forward to your responses!

It seems like that was the intention. However, if I'm not mistaken, unless otherwise specified, get_input() returns a string.

I think it should be $mybb->get_input('display', MyBB::INPUT_ARRAY).

Please provide a link to the plugin for reference.

Plugin URL for Reference: https://community.mybb.com/mods.php?action=view&pid=275
Issue is in: admin/modules/config/ratemf.php
https://github.com/jung35/Rate-Me-a-Funn...hp#L97-L99

My post above stands, change both instances of $mybb->get_input('display') to $mybb->get_input('display', MyBB::INPUT_ARRAY).

Alternatively, I'd suggest you to try my OUGC Custom Reputation plugin, which was inspired by this plugin back in 2012 but is still actively maintained.
(2020-07-18, 01:06 AM)Omar G. Wrote: [ -> ]https://github.com/jung35/Rate-Me-a-Funn...hp#L97-L99

My post above stands, change both instances of $mybb->get_input('display') to $mybb->get_input('display', MyBB::INPUT_ARRAY).

Alternatively, I'd suggest you to try my OUGC Custom Reputation plugin, which was inspired by this plugin back in 2012 but is still actively maintained.

Thanks for your suggestions, I will definitely at least investigate it. I've applied the suggested patch and it works.