![]() |
Moderator only notes & Number of queries
Hiya,
I installed the latest version a couple of days ago after having used the older one a while back (but lost it in an upgrade). Two things I've noticed: 1. All members can see the warning notes in the default install 2. 1 query is performed per post to get the warning notes I have 3.0.7 so the fixes below work ONLY on that version. The template fix could work on others, and the logic behind the query too. To fix #1, do the following: Edit the postbit / postbit_legacy template. Find: Code:
<if condition="$pnotes!='' AND $vboptions['warn_allownotes']==1"> Code:
<if condition="$bbuserinfo[usergroupid] == 7 || $bbuserinfo[usergroupid] == 6 || $bbuserinfo[usergroupid] == 5"> Code:
$pnotes Code:
$pnotes First, edit showthread.php Find: Code:
$getpostids = $DB_site->query(" Code:
$getpostids = $DB_site->query(" Code:
$ids .= ',' . $post['postid']; Code:
$ids .= ',' . $post['postid']; Code:
$postids = "post.postid IN (0" . $ids . ")"; Code:
// Start Cached Warning Notes Next, edit includes/functions_showthread.php Find: Code:
if ($post['warn_notes']==1 and $showviewwarnlink==1); Code:
if ($post['warn_notes']==1 and $showviewwarnlink==1); Code:
while($notes=$DB_site->fetch_array($get_notes)) Code:
foreach ($warn_notes as $notes) Code:
elseif ($notes['warned_type']==0) Code:
elseif ($notes['warned_type']==0) This cuts the number of queries from 1 per post to 1 on the entire page. Hope this helps. Regards, Delphy |
I'll have to try these...I am having the same problem you stated in #1. THanks for the feedback, it is appreciated!
|
I'll check your changes for (2), but for issue (1), are you sure you have made the changes suggested in functions_showthread.php?
If you have, then the parameter $pnotes should have a value only if $showviewwarnlink is set to 1. The $showviewwarnlink parameter is set to one only for admins or for admins/smods/mods depending on the usage of the hierarchical schema or not. It should not be necessary to use the code below: Code:
<if condition="$bbuserinfo[usergroupid] == 7 || $bbuserinfo[usergroupid] == 6 || $bbuserinfo[usergroupid] == 5"> Check your edits in functions_showthread.php, that's where the check is made. Also check that you have defined your Warning Options about which are your admin, mod, smod groups. |
Hiya,
I made all the changes to the showthread.php, but left the admin/smod/mod fields empty in the settings page since I use the defaults. From my understanding of what you said, this would suggest if I specifically set the fields, then it should work? I'll go through and double check everything again just to make sure. Thanks, Delphy |
Yes, if you leave them empty the program will enter the proper groups (6,5,7) for the admins/smods/mods. From there on, the code in functions_showthread.php decides if the $pnotes will be filled up, depending on the $showviewwarnlink parameter.
If your plain users can see the notes, they should also be able to see the "View XYZ Warnings". DARN!!! Now, I know, you have the "Who can view warning points" set to "All", right? OK, try this. In functions_showthread.php find: Code:
if ($post['warn_notes']==1 and $showviewwarnlink==1); Code:
if ($post['warn_notes']==1 and ($useradmin==1 OR $usersmod==1 OR $usermod==1)); |
sv1,
I had "Who can view warning points?" set to Mgmt, but when the moderators where entering notes they set "private note?" to No - becuase the wording seems to indicate the only the moderator who entered the note in the first place could see the note (and not all moderators which is what I wanted). Maybe I'm just trying to use it in a way it's not supposed to be used :D Regards Delphy |
Notes can be either public (for all the management team to see) or private (only the person who entered it can see it). If you had set the Who can view Warning Points" to Mgm, there is no reason why the rest of your members could see the notes.
Try the change suggested above and let me know if it works OK. |
Hiya,
Nope - it didn't. Members and guests can still see the notes entered. Regards, Delphy |
I am not sure if this is due to your modifications, or not. Look at the code below:
Code:
if ($post['warn_notes']==1 and ($useradmin==1 OR $usersmod==1 OR $usermod==1)); If the post has a note, and the user is administrator, super moderator or moderator, then do whatever follows. If the post has no notes or if the user is nothing of the above, then obviously the parameter $pnotes never gets a value, so it should not show. I do not know if your changes have affected this procedure or not. |
With regards to the number of SQL queries changes I made, they dont affect that line - I was simply referencing it in my changelog becuase I needed to alter the lines below it.
I just saw you released the latest version so I'll try that out and get back to you. Thanks for the replies. Have you managed to have a look at the single query code yet? Regards, Delphy |
The new release contains the code I suggested above. That should prevent simple users from seeing the notes. If that does not work for you, I do not know what to suggest, since I haven't checked your code yet.
I have one question about the way you modified the code for reducing the number of queries for the notes. How do you handle a post-specific note? I went through your replacements, but I am not sure I noticed how a post-specific note is handled. Admitedly, I haven't done the changes in the files, but from looking in your code, I didn't see that. |
Post specific notes are handled by your original code - all I'm doing is, instead of doing a query per note, just cache everything first in an array with 1 query, and then do a foreach through the loop to get post specific notes. It's all still 1 query for an entire thread as opposed to 1 per post.
Regards, Delphy |
I did your changes, as suggested, and for some reason, post-specific notes do not appear.
I added a Private, non-post-specific note and it appeared OK. Then I added a Private, post-specific one too, and only the first appears. I am sure it is something trivial, and your idea to reduce the queries is a great one, but I do not have the time to look further into it. If you can solve the problem, let me know. Rgds |
All times are GMT. The time now is 02:21 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|