Jump to content

Robiss767

Members
  • Posts

    37
  • Joined

  • Last visited

Reputation Activity

  1. Like
    Robiss767 reacted to Devin Powers in [JIMMO] Top Posters Plus   
    Hi -
    This error popped up again @The Jimmo
    I took a look at the source code (widgets/jimmoTopPostersPlus.php) and it seemed to resolve the problem. This error seems to occur when you're not in the top 5 and for weekly only. This means its an issue with the default case and as such the widgets rather than the AJAX folder.
    This was the code I found inside the if statement that checks to see if the member is logged in.
    $you = \IPS\Db::i()->select( 'author_id, COUNT(author_id) as posts', 'forums_posts', array( 'author_id =' . \IPS\Member::loggedIn()->member_id . ' AND post_date>?', \IPS\DateTime::create()->sub( new \DateInterval( 'P1W' ) )->getTimestamp() ), '', '', NULL)->join( 'core_members', 'forums_posts.author_id=core_members.member_id' ); I changed the code to the following:
    $myPosts = \IPS\Db::i()->select( 'author_id, COUNT(author_id) as posts', 'forums_posts', array( 'author_id =? AND post_date>?', \IPS\Member::loggedIn()->member_id, \IPS\DateTime::create()->sub( new \DateInterval( 'P1W' ) )->getTimestamp()) , '', '', array('author_id'))->join( 'core_members', 'forums_posts.author_id=core_members.member_id' ); if (count($myPosts > 0)) { foreach ($myPosts as $col) { $y = $col['posts']; } $you = $y; } else { $you = 0; }  
    To explain: I've changed it so both parameters in the where clause are parameterized and I've made it group it by author_id. Then I've checked to see if there is a result (a new member with 0 posts wouldn't have any results returned). Then I've just selected it.
    A neater way would probably be the try-catch-block using the ->first() method where if it fails you assign $you to 0, but this was just a quick dirty fix for me.
    Hope this helps some other people ?
    Cheers.
  2. Like
    Robiss767 reacted to Dannyo in [JIMMO] Top Posters Plus   
    Nope, still got that problem. It only shows "1" all the time at the week view.
    Month view seems to work.

  3. Like
    Robiss767 reacted to The Jimmo in [JIMMO] Top Posters Plus   
    Yup, something on our list. Just have to find time to do it  Should have it soon though.
×
×
  • Create New...