Jump to content

[JIMMO] Top Posters Plus


Recommended Posts

  • 4 weeks later...
Posted (edited)
On 10/7/2017 at 8:54 AM, GazzaGarratt said:

Hi @The Jimmo, any news on the update regarding the 'It only shows "1" all the time at the week view' issue? Thanks.

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.

Edited by Devin Powers
  • 1 month later...
Posted (edited)
On 5/17/2018 at 8:32 PM, Devin Powers said:

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.

For people who may struggle fixing the source code itself, there's a much simpler, but equally effective solution. If the member has not made any posts, then the variable $you gets passed as a SQL query. Hence inside the template you can add this little workaround:

{{if !(is_numeric($you))}}
	<span>0</span>
{{else}}
	<span>{expression="\IPS\Member::loggedIn()->language()->formatNumber( $you )"}</span>
{{endif}}

To edit the template go to: AdminCP -> Customization -> Edit HTML and CSS -> Templates -> jimmotoppostersplus -> jimmoTopPostersPlusRows

EDIT: This only replaces the 1 with a 0 if you have no posts that week.

Edited by Robiss767
  • 6 months later...
  • 7 months later...
Posted

I am seeing duplicate content error for all of the links in this app. This is caused by the app pulling the index pages meta tags and using them instead of having their own meta tags, or instead of inserting something like "Top Posters - " at the start of the title tag.  I am hoping for a quick fix for this issue. Examples:

https://www.celiac.com/index.php?app=jimmotoppostersplus&module=ajax&controller=ajax&do=topposters&time=all&limit=5&orientation=vertical&groupWhere=

https://www.celiac.com/index.php?app=jimmotoppostersplus&module=ajax&controller=ajax&do=topposters&time=month&limit=5&orientation=vertical&groupWhere=

and compare to the meta tags on my index page:

https://www.celiac.com/

Posted (edited)
15 hours ago, sadams101 said:

I am seeing duplicate content error for all of the links in this app. This is caused by the app pulling the index pages meta tags and using them instead of having their own meta tags, or instead of inserting something like "Top Posters - " at the start of the title tag.  I am hoping for a quick fix for this issue. Examples:

https://www.celiac.com/index.php?app=jimmotoppostersplus&module=ajax&controller=ajax&do=topposters&time=all&limit=5&orientation=vertical&groupWhere=

https://www.celiac.com/index.php?app=jimmotoppostersplus&module=ajax&controller=ajax&do=topposters&time=month&limit=5&orientation=vertical&groupWhere=

and compare to the meta tags on my index page:

https://www.celiac.com/

 

So this is an interesting "quirk." Not necessarily a bug with the top posters plus app as it does not touch meta tags, etc... itself. This "page" is actually not even a real page necessarily. This "quirk" is related to how the IPS core software handles meta tags with the meta tag editor. If you have assigned tags using the meta tag editor to the "/" URL then this will happen as we use query strings in the URL to use this ajax call and not a distinct FURL.

Little technical background, "/" = "/index.php"  therefore the IPS core software is saying "Hey, they want these meta tags here too" and places them on the URLs you listed.

To fix this, you can apply the following furl.json file to /applications/jimmotoppostersplus/data/ . This will assign a custom FURL to this page and you won't see any meta tags you've assigned to "/" on the page anymore. If you have any issues, make sure you clear your cache.

(in the future, we'll see if we can't add a "noindex" tag to this "page" as well as there shouldn't be any worthwhile index-worthy data there.)

 

 

furl.json

Edited by The Jimmo
Posted

Thank you for this, as your solution did remove the duplicate meta tags. I did try adding to the Meta tags editor various entries try to customize the meta tag but this failed:

top-posters-plus/all/5/vertical/*

It would be nice to make it work in the meta tags editor at some point.

Posted

Yeah, that's from the core. Essentially, you could create an FURL for it via the ACP or bring this up to IPS but I'm not sure if they would say that is working as intended or not.

Posted
On 9/14/2019 at 11:52 AM, DarkClaWz said:

Hey,

was willing to know if you can add an option to manually set the weekly posters to zero?
thanks.

Not sure I understand. Are you wanting to set the numbers of authors to none or the post count of the authors to zero? If either of those are wanted here, that really contradicts the purpose and usefulness of the block. 

Posted

 

2 hours ago, The Jimmo said:

Not sure I understand. Are you wanting to set the numbers of authors to none or the post count of the authors to zero? If either of those are wanted here, that really contradicts the purpose and usefulness of the block. 

I want to set to zero the post count of only the weekly posters when I want. The reason is we want to make a competition of daily posts - user posts the most posts wins.
but now that I think about it it`s a bad idea. thanks anyway, sorry if I bothered you 👍
Thanks for fast response!

Posted
7 hours ago, DarkClaWz said:

 

I want to set to zero the post count of only the weekly posters when I want. The reason is we want to make a competition of daily posts - user posts the most posts wins.
but now that I think about it it`s a bad idea. thanks anyway, sorry if I bothered you 👍
Thanks for fast response!

Not a bother. Always welcome to submit ideas/suggestions!

  • 4 weeks later...
Posted

Hi there,

We found a bug in you plugin with the help the of invision support.

Your plugin uses the same language string which is used in invision system and therefore the system string will not save changes to database after i have changed the translation and refresh the page.. the field will be empty again.

Could you please fix this issue soon as possible?

Thanks

  • 2 weeks later...
Posted
On 10/15/2019 at 3:07 PM, The Jimmo said:

What is the language string you are having an issue with?

"joined" interfares with invision language string therefore the invision "joined" does not save because of that.

image.png.bc6e5072797f95339633f6a80d56ae

Posted
3 minutes ago, Matis Soppe said:

"joined" interfares with invision language string therefore the invision "joined" does not save because of that.

image.png.bc6e5072797f95339633f6a80d56ae

This would be unrelated to to this application altogether but please be sure you uninstall the version of "User Join Date in Post" and install the latest. We no longer utilize a custom string but use the built in one.

Posted

Hey, just a small bug I noticed long time ago:
nafxV5V.png

as you can see, the You is displayed as 1 post (other 5 not relevent since they are fine).
The you = 1 is at all of them - weekly. monthly and yearly. Not sure about the all times since we tried to fixed it but the fix is not good.
Please help

  • 3 weeks later...
Posted (edited)

hey. seen you uploaded an update but I am still facing the same bug at the 'Weekly' section only.
Also, at the 'All Times' the amount of posts of some members is higher or lower then the 'Content Count' of that member, how is that happening?

Thanks!

Edited by DarkClaWz
  • 3 weeks later...
Posted

I've recently seen some mysql errors related to your app...any idea why or if something needs to be fixed/updated:

The log entry was triggered by a guest
Guests
7 hours ago
The URL of page the error occurred on was https://www.mysite.com/top-posters-plus/month/5/vertical/?groupWhere='[0]

SELECT author_id, COUNT(author_id) as posts FROM `ibf_forums_posts` AS `forums_posts`  LEFT JOIN `ibf_core_members` AS `core_members` ON forums_posts.author_id=core_members.member_id WHERE author_id > 0 AND core_members.member_group_id = '[0] AND post_date>1573221870 GROUP BY `author_id` ORDER BY posts DESC LIMIT 5
IPS\Db\Exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''[0] AND post_date>? GROUP BY `author_id` ORDER BY posts DESC LIMIT 5' at line 1 (1064)
#0 /home/mysite/public_html/system/Db/Select.php(373): IPS\_Db->preparedQuery('/*IPS\\jimmotopp...', Array, true)
#1 /home/mysite/public_html/system/Db/Select.php(436): IPS\Db\_Select->runQuery()
#2 /home/mysite/public_html/applications/jimmotoppostersplus/modules/front/ajax/ajax.php(120): IPS\Db\_Select->rewind()
#3 /home/mysite/public_html/system/Dispatcher/Controller.php(85): IPS\jimmotoppostersplus\modules\front\ajax\_ajax->topPosters()
#4 /home/mysite/public_html/applications/jimmotoppostersplus/modules/front/ajax/ajax.php(26): IPS\Dispatcher\_Controller->execute()
#5 /home/mysite/public_html/system/Dispatcher/Dispatcher.php(152): IPS\jimmotoppostersplus\modules\front\ajax\_ajax->execute()
#6 /home/mysite/public_html/index.php(13): IPS\_Dispatcher->run()
#7 {main}

BACKTRACE

#0 /home/mysite/public_html/init.php(898): IPS\_Log::log('SELECT author_i...', 'uncaught_except...')
#1 [internal function]: IPS\IPS::exceptionHandler(Object(IPS\Db\Exception))
#2 {main}

 

Posted
27 minutes ago, sadams101 said:

I've recently seen some mysql errors related to your app...any idea why or if something needs to be fixed/updated:

The log entry was triggered by a guest
Guests
7 hours ago
The URL of page the error occurred on was https://www.mysite.com/top-posters-plus/month/5/vertical/?groupWhere='[0]


SELECT author_id, COUNT(author_id) as posts FROM `ibf_forums_posts` AS `forums_posts`  LEFT JOIN `ibf_core_members` AS `core_members` ON forums_posts.author_id=core_members.member_id WHERE author_id > 0 AND core_members.member_group_id = '[0] AND post_date>1573221870 GROUP BY `author_id` ORDER BY posts DESC LIMIT 5
IPS\Db\Exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''[0] AND post_date>? GROUP BY `author_id` ORDER BY posts DESC LIMIT 5' at line 1 (1064)
#0 /home/mysite/public_html/system/Db/Select.php(373): IPS\_Db->preparedQuery('/*IPS\\jimmotopp...', Array, true)
#1 /home/mysite/public_html/system/Db/Select.php(436): IPS\Db\_Select->runQuery()
#2 /home/mysite/public_html/applications/jimmotoppostersplus/modules/front/ajax/ajax.php(120): IPS\Db\_Select->rewind()
#3 /home/mysite/public_html/system/Dispatcher/Controller.php(85): IPS\jimmotoppostersplus\modules\front\ajax\_ajax->topPosters()
#4 /home/mysite/public_html/applications/jimmotoppostersplus/modules/front/ajax/ajax.php(26): IPS\Dispatcher\_Controller->execute()
#5 /home/mysite/public_html/system/Dispatcher/Dispatcher.php(152): IPS\jimmotoppostersplus\modules\front\ajax\_ajax->execute()
#6 /home/mysite/public_html/index.php(13): IPS\_Dispatcher->run()
#7 {main}

BACKTRACE


#0 /home/mysite/public_html/init.php(898): IPS\_Log::log('SELECT author_i...', 'uncaught_except...')
#1 [internal function]: IPS\IPS::exceptionHandler(Object(IPS\Db\Exception))
#2 {main}

 

You can safely ignore that. 

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...