Support Forum
Jim,
your code still should work... just need to adjust how you get the current user id... try changing:
$spThisUser->ID
to be
SP()->user->thisUser->user_id
everything is class based now instead of bunch of globals...
Visit Cruise Talk Central and Mr Papa's World
Mr Papa said
try changing...
Perfect, that did the trick. Thank you for the prompt response!
Just in case anyone is looking for help with this same issue, here's the complete edit:
spHeadDesktop.php:111
# start reboot unread pm hack if (function_exists('sp_PmInboxButton')) { $newPM = sp_pm_get_inbox_unread_count(SP()->user->thisUser->user_id); $icon = ($newPM > 0) ? 'sp_PmInboxButtonUnread.png' : 'sp_PmInboxButton.png'; $class = ($newPM > 0) ? 'spButtonUnread' : 'spButton'; sp_PmInboxButton("tagClass=$class spRight&icon=$icon", __sp('Inbox:'), __sp('Go to PM inbox')); } # end reboot pm hack
Simple:Press powers the Tripawds Discussion Forums.
It's better to hop on three legs than to limp on four.
The Tripawds Blogs Community is made possible by The Tripawds Foundation.
Sigh...
So I just discovered this issue persists for any user not logged in.
The hack above works fine when the user is logged in, all pages load fine with no error.
Invalid Database Query error occurs on all forum pages for any user not logged in.
From the SP Error Log:
December 10, 2018 12:36 pm | spaErrError | 60 | database
file: .../public_html/wp-content/sp-resources/forum-plugins/private-messaging/library/sp-pm-database.php
line: 114
function: count
error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND read_status=0' at line 1
Simple:Press powers the Tripawds Discussion Forums.
It's better to hop on three legs than to limp on four.
The Tripawds Blogs Community is made possible by The Tripawds Foundation.
Simple:Press powers the Tripawds Discussion Forums.
It's better to hop on three legs than to limp on four.
The Tripawds Blogs Community is made possible by The Tripawds Foundation.
So, I figure the invalid db query error must have something to do with this:
$newPM = sp_pm_get_inbox_unread_count(SP()->user->thisUser->user_id);
Because if users are not logged in, they they have no ID. Right?
The previous use of "globals" @mr-papa mentioned must have addressed this, because we never experienced it before. Is there some class used to identify guests that can be applied in this scenario?
Simple:Press powers the Tripawds Discussion Forums.
It's better to hop on three legs than to limp on four.
The Tripawds Blogs Community is made possible by The Tripawds Foundation.
No, that is incorrect... they will have a ID of 0 for guests... but does look like I gave you incorrect code... should be:
SP()->user->thisUser->ID
but I will have to research why the member user_id even exists for users... and why we use it in couple locations... should be consistent and stick with the right one..
Visit Cruise Talk Central and Mr Papa's World
Mr Papa said
but does look like I gave you incorrect code...
Fantastic! Thanks for the quick fix, as usual. I can confirm that does the trick.
Just one more issue to resolve and we can update our live site to SP 6.0.
Simple:Press powers the Tripawds Discussion Forums.
It's better to hop on three legs than to limp on four.
The Tripawds Blogs Community is made possible by The Tripawds Foundation.
1 Guest(s)