PDA

View Full Version : Forum Display Enhancements - Users can see own moderated threads prior to approval


MoMan
01-25-2012, 11:00 PM
On my forum, to prevent spam, threads from new users are checked for common spam keywords, including links. If any such keywords are found, the thread gets auto-moderated.

In order to prevent double-posting, I decided it was necessary for users to be able to see their own moderated threads in the forum listings before they get approved. Nobody reads the redirection message shown, so I hope that this will be more effective in preventing duplicates.

Moderated threads from unregistered users will not be shown to those users.

Open forumdisplay.php,

Find:

if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND visible = 1 ";
}
else
{
$visiblethreads = " AND visible IN (1,2)";
}


Replace with:

if ($vbulletin->userinfo['userid'])
{
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND (visible = 1 OR (visible = 0 AND postuserid = " . intval($vbulletin->userinfo['userid']) . "))";
}
else
{
$visiblethreads = " AND (visible IN (1,2) OR (visible = 0 AND postuserid = " . intval($vbulletin->userinfo['userid']) . "))";
}
}
else
{
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND visible = 1 ";
}
else
{
$visiblethreads = " AND visible IN (1,2)";
}
}



Note: if you want to allow users to see their own moderated posts as well, see post #2.

PhilG
01-27-2012, 01:03 PM
I just installed this and works great until you click on the link to view the thread. Then is shows the default no thread page because of permissions.. If you edit showthread.php the follow will solve that:

Find:
if ((!$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts'))

Replace with:
if ((!$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts') AND ($thread['postuserid'] != $vbulletin->userinfo['userid'] OR !$vbulletin->userinfo['userid']))

Find:
AND post.visible = 1

Replace with:
AND (post.visible = 1 OR (post.visible = 0 AND post.userid = " . intval($vbulletin->userinfo['userid']) . "))

inciarco
01-27-2012, 06:31 PM
Interesting Code, and the Detail for the Thread View. :up:

Is it Possible to Apply it Also to the Posts (Postbit) so that the User can See His/Her Own Posts Prior to Approval? (Not only New Threads but Also New Posts?) :confused:

Something Like: Users can see own moderated posts prior to approval. ;)

My Best Regards and Thank You For Sharing this Code and the Additional Code Edit. :up:

:)

MoMan
01-28-2012, 03:34 AM
See post #2, I guess. I didn't originally intend to extend this feature to posts, but now that I think about it, there's really no reason not to.

MoMan
01-28-2012, 03:42 AM
I'd like to add one thing to the code for the posts: if you want guests to never be able to see moderated content, change

$thread['postuserid'] != $vbulletin->userinfo['userid']

to

($thread['postuserid'] != $vbulletin->userinfo['userid'] OR !$vbulletin->userinfo['userid'])

In the first part of the code in post #2.

PhilG
01-28-2012, 04:21 AM
I'd like to add one thing to the code for the posts: if you want guests to never be able to see moderated content, change


I updated the code for post #2 ;)

inciarco
01-28-2012, 05:00 PM
I'd like to add one thing to the code for the posts: if you want guests to never be able to see moderated content, change
... to ...
In the first part of the code in post #2.

I updated the code for post #2 ;)

Thank You Very Much, I'll Try It and I'll Tell You How It Works. :up:

My Best Regards To Both Of You MoMan and PhilG . ;)

:)

inciarco
01-28-2012, 06:55 PM
Both Codes Work Fine, but there is a Bug with the Pagenavs. The Pagenav generator isn't taking in Consideration the New Displayed Threads and Posts and the Threads and Posts on the Last Page are Lost, the Link to the Last Page isn't Displayed and there is Not Access to It Not Even by Writing the Number of the Page, it Goes to the Last One Showed but the Last Threads and Posts on that Last Page are Not Accesible. :confused:

What Additional Code Should be Edited for the Pagenavs on forumdisplay and on showthread to Consider the Moderated Threads and Posts of the User and to Access the Last Page (or Pages if there are Many Threads of Posts Moderated)? :confused:

I Also Noticed on the forumdisplay that for Moderated Posts the threadbit Don't Display the Last Message if is a Moderated One. What Additional Code Should be Edited for them to Display? :confused:

I Also Noticed that on the search Page the Moderated Threads and Posts are Not Displayed. What Additional Code Should be Edited for them to Display? :confused:

My Best Regards. ;)

:)

bestone96
02-29-2012, 10:30 AM
thanks a lot

Meestor_X
04-22-2012, 05:15 PM
Will this work on 4.x?

xorex
04-25-2012, 09:10 AM
<a href="https://vborg.vbsupport.ru/member.php?u=115402" target="_blank">MoMan</a> thank you, may be posible also make it editable for own moderated posts and threads prior to approval ?

wangyu1314
06-28-2012, 09:32 AM
thank you ,it's great

zardos
02-11-2013, 08:20 AM
Anyone know how to make this running on VB 3.8.4?
Need to make the posts and threads visible to moderated users.

if (!can_moderate($forumid, 'canmoderateposts'))
{
if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{
$visiblethreads = " AND visible = 1 ";
}
else
{
$visiblethreads = " AND visible IN (1,2)";
}
}
else
{
$visiblethreads = " AND visible IN (0,1,2)";
}



I only have that part there. Nothing found about post #2 in the forumdisplay.php in 3.8.4 which is why I asked:
if ((!$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts'))

Skyrider
03-04-2014, 08:46 AM
There a way this code can be converted to vBulletin 4? I tried it myself, but I keep getting a blank page. The code:

if (!can_moderate($forumid, 'canmoderateposts'))
{

is I believe new in vBulletin 4 just above:

if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canseedelnotice']))
{

as I don't think its in vBulletin 3.

Calystos
03-07-2014, 01:51 PM
O/P and S/P codes both work perfectly as-is in vb4.2.2. I edited the forumdisplay.php and showthread.php files accordingly, and all 3 changes were found and made and tested as-is and works, :-)

Meestor_X
10-18-2014, 05:16 PM
Works great on 4.2.2! Thank you.

Ig@r
06-13-2016, 04:29 PM
Is there any way to make this mod a product?

MarkFL
06-13-2016, 05:17 PM
Is there any way to make this mod a product?

Yes, I have attached a product that does the same thing (including post #2)...I haven't tested it, so please let me know if it works for you, and if you would like any added features. :)

You will have to enable the product in its settings.

Ig@r
06-13-2016, 05:25 PM
Yes, I have attached a product that does the same thing (including post #2)...I haven't tested it, so please let me know if it works for you, and if you would like any added features. :)
Thanks Mark, I will give this a try! :up:

Ig@r
06-13-2016, 08:24 PM
OK, installed the product and tested, the users now able to see their moderated threads, unfortunately the second part is't working and they can not see their moderated posts yet.
Another thing I've discovered, that users are not able to post a reply in their own moderated thread if they decide to add something to it.

MarkFL
06-13-2016, 09:06 PM
OK, installed the product and tested, the users now able to see their moderated threads, unfortunately the second part is't working and they can not see their moderated posts yet.
Another thing I've discovered, that users are not able to post a reply in their own moderated thread if they decide to add something to it.

Okay, I will do some testing then and see if I can get everything to function correctly. :)

MarkFL
06-14-2016, 12:43 AM
I fixed the error preventing the db query from working, and have attached the updated product.

Allowing users to reply to their own moderated threads isn't something this was ever intended to do, and so I will have to figure out how to make that happen. Once I have, I will post. :)

MarkFL
06-14-2016, 03:41 AM
Okay, this updated version will allow users to reply to their own moderated threads, and to edit their own moderated posts. :)

Ig@r
06-14-2016, 04:16 PM
Okay, this updated version will allow users to reply to their own moderated threads, and to edit their own moderated posts. :)

Thank you very much, Mark :up:
It is working on 4.2.3
Because I have AJAX function turned on the new post appers only after full page refresh, before that user still sees "Your post will not be visible until a moderator has approved it for posting" message. Other then that the hack works great. Thanks again.

MarkFL
06-14-2016, 04:23 PM
On my dev site, I also have the "Quick Reply" enabled, and the new post shows up immediately. This is when a thread has been put into the moderation queue by a mod/admin. How are threads/posts being put into the moderation queue on your site?

Perhaps if I know this, I can duplicate the conditions you have and fix this remaining issue. :)

MarkFL
06-15-2016, 01:31 AM
Thank you very much, Mark :up:
It is working on 4.2.3
Because I have AJAX function turned on the new post appers only after full page refresh, before that user still sees "Your post will not be visible until a moderator has approved it for posting" message. Other then that the hack works great. Thanks again.

Are you by chance using my automated post reporter product, that puts posts/threads into the moderation queue automatically, if a user posts certain flagged words, or necro-posts?

The reason I ask is that I do get the behavior you describe with that product (which is by design), and what I can do is incorporate this feature (allowing users to see/edit their own moderated posts) into the automated post reporter, and then if you elect to allow users to see/edit their own moderated posts, I can turn off the error message.

The automated post reporter product is in need of an overhaul as it was the first product I wrote, and so look for an upgrade including this feature at some point (I don't want to give any kind of timeline at this point). :)

Ig@r
06-15-2016, 07:41 PM
I have special user group with settings "Follow Forum Moderation Rules If no, posts are always placed into moderation queue" set to no. For my testing I used an account of this type.

blah100
07-01-2016, 03:12 PM
Are you by chance using my automated post reporter product, that puts posts/threads into the moderation queue automatically, if a user posts certain flagged words, or necro-posts?

The reason I ask is that I do get the behavior you describe with that product (which is by design), and what I can do is incorporate this feature (allowing users to see/edit their own moderated posts) into the automated post reporter, and then if you elect to allow users to see/edit their own moderated posts, I can turn off the error message.

The automated post reporter product is in need of an overhaul as it was the first product I wrote, and so look for an upgrade including this feature at some point (I don't want to give any kind of timeline at this point). :)
I can confirm that it's due to another modification which moderates based upon keywords (in my case it's Glowhost's Spam-o-matic). Sounds like your product does the same thing. I always found it better to moderate based upon keywords rather than having an entire board's threads/posts go into moderation via vbulletin's settings. I mean who has time to do all that approving? So I used glowhost's spam-o-matic to only look for spam keywords in order to put posts/threads into moderation and when I tested your updated product by entering a bad keyword and it still gave me that annoying "Your post will not be visible until a moderator has approved it for posting" popup, and even further it wouldn't let me edit the post after I did a manual refresh.

I'd gladly switch to your post reporter product when you update it to work with allowing users to see and edit their own moderated posts/threads without getting that annoying popup about needing a moderator approval first. To me it just seems better for members not to see that popup since it only annoys them. It's better that when they post something that is moderated that the post/thread appears and is editable as if nothing is wrong. While in the background moderators efficiently approve the post/threads without the user being none the wiser that it was moderated to begin with. It'll also cut down on members making duplicate posts/threads to bypass the moderation.

Stratis
02-25-2017, 03:22 PM
Okay, this updated version will allow users to reply to their own moderated threads, and to edit their own moderated posts. :)


Is there possible Mark, that they can see attached images they upload?
Now attached images dos not show up. I do not have in settings moderate attachments. I realized this because 4-5 members try to upload image again and again as they do not see the image, it shows with the X. After approve is ok.
As admins - Mods we can see the image.


Thank you very much

Meestor_X
07-26-2017, 01:48 PM
I used this hack in the past by modifying the files as per the O/P and 2nd Post. On my new forum (4.2.5) I tried doing it using the XML product, and that's doesn't seem to work.
I'll uninstall the product and try the manual modification again.

Meestor_X
08-04-2017, 04:04 PM
Ok, in testing the product further, it seems moderated users can see their own posts, but not threads they started.
So it works for posts, but not for threads.
Any suggestions on how to fix this in the product? It would be nice to keep it as a product rather than having to edit the source files directly as before...

MarkFL
08-04-2017, 05:22 PM
Ok, in testing the product further, it seems moderated users can see their own posts, but not threads they started.
So it works for posts, but not for threads.
Any suggestions on how to fix this in the product? It would be nice to keep it as a product rather than having to edit the source files directly as before...

Are you talking about the product I uploaded?

Meestor_X
08-04-2017, 05:27 PM
Are you talking about the product I uploaded?
I assume it's yours? This one here (https://vborg.vbsupport.ru/showpost.php?p=2572029&postcount=23).

MarkFL
08-04-2017, 05:33 PM
I assume it's yours? This one here (https://vborg.vbsupport.ru/showpost.php?p=2572029&postcount=23).

Yes, I wasn't sure if that's what you are using. What version of vB are you running? I can test this on either vB 3.8.11 or vB 4.2.5...it's been so long since I did this I would have to get familiar with it again. I seem to recall it working correctly for me though.

Meestor_X
08-04-2017, 05:44 PM
Yes, I wasn't sure if that's what you are using. What version of vB are you running? I can test this on either vB 3.8.11 or vB 4.2.5...it's been so long since I did this I would have to get familiar with it again. I seem to recall it working correctly for me though.
Thanks! I'm using 4.2.5 (https://vborg.vbsupport.ru/showpost.php?p=2588898&postcount=30). I had tried the direct modifications to the files in 4.2.3 and that had worked. Just trying the product version and as I say, it seems to work for posts, but not threads. Not sure if I'm doing something wrong, but it would be great if you could check it out as I love this hack. Saves me getting all sorts of double-posts because people don't realize their moderated posts won't show up until approved (and of course they never read the message they get that tells them the same)... ;-)

MarkFL
08-04-2017, 09:09 PM
Yes, I know exactly what you mean...they post over and over and finally give up and usually don't return.

I'll check this out ASAP and post back. :)

MarkFL
08-05-2017, 02:40 PM
Thanks! I'm using 4.2.5 (https://vborg.vbsupport.ru/showpost.php?p=2588898&postcount=30). I had tried the direct modifications to the files in 4.2.3 and that had worked. Just trying the product version and as I say, it seems to work for posts, but not threads. Not sure if I'm doing something wrong, but it would be great if you could check it out as I love this hack. Saves me getting all sorts of double-posts because people don't realize their moderated posts won't show up until approved (and of course they never read the message they get that tells them the same)... ;-)

Okay, I just retested this on my dev site, and I found moderated users can see both their new threads and posts. :)

Meestor_X
08-11-2017, 11:48 PM
Okay, I just retested this on my dev site, and I found moderated users can see both their new threads and posts. :)
I had mistakenly thought that it was partially working. I realize now that it doesn't work at all on my forum.
I'll try the direct file modification again and see if that works.

MarkFL
08-12-2017, 12:01 AM
I had mistakenly thought that it was partially working. I realize now that it doesn't work at all on my forum.
I'll try the direct file modification again and see if that works.

I would guess some other add-on is interfering.

Meestor_X
08-12-2017, 12:31 AM
There a way this code can be converted to vBulletin 4? I tried it myself, but I keep getting a blank page.

I got blank pages as well until I did the change in post #2 differently.
I changed:
if ((!$thread['visible'] AND !can_moderate($thread['forumid'], 'canmoderateposts'))
OR ($thread['isdeleted'] AND !can_moderate($thread['forumid'])))TO:
if (($thread['isdeleted'] AND !can_moderate($thread['forumid'])))Instead of what is shown in post #2.

I have no idea if I've broken something else by doing it this way, but at least it works now...

Meestor_X
08-12-2017, 12:32 AM
I would guess some other add-on is interfering.
Must be. Did the direct file mods, but had to do the post #2 change differently or I just get a blank page.

Stratis
10-13-2017, 06:15 AM
Okay, this updated version will allow users to reply to their own moderated threads, and to edit their own moderated posts. :)


Mark I was using this mod a while, but I realized that all users can see moderated threads. It supposed it will allow only the owner of the post-thread.
Maybe some other mod of mine interferer with it.


Do you use this mod of yours? Thanks

MarkFL
10-13-2017, 02:16 PM
Mark I was using this mod a while, but I realized that all users can see moderated threads. It supposed it will allow only the owner of the post-thread.
Maybe some other mod of mine interferer with it.


Do you use this mod of yours? Thanks

I don't use this personally...I was just attempting to put forth something to address the reported issues with the published product.

I will have to dig this up soon (currently working on a big project) and look into the issue you've brought up. :)

Stratis
10-13-2017, 02:31 PM
I will have to dig this up soon (currently working on a big project) and look into the issue you've brought up. :)


Thank you Mark, have a nice day :)

MarkFL
10-15-2017, 03:41 AM
Thank you Mark, have a nice day :)

Hello, Stratis! :)

I found that it was working correctly for threads, but not for posts, and I now submit for your testing an updated version which I have attached. ;)

Please let me know if there are any issues...:eek::cool:

Stratis
10-15-2017, 08:06 AM
I just test it:


Posts:
1) Other users do not see the post (as supposed to be)
2) Owner can see, the moderated icon inside the post, but can not see uploaded attach image (this problem was before to)
3) Post can not be edited, error (Can not find phrase 'no permission')


Threads:
1) Other users do not see the thread (as supposed to be)
2) Owner can see the thread, but can not see the moderated icon inside the thread (I think before this was not problem) he can see the icon only out off thread in the title.
3)Thread can be edited


can not see uploaded attach image (this problem was before to)
* At least to see the moderated icon to know that thread is in moderated condition.
and be able to edit in both conditions or not to let edit in both conditions.


Thank you very much.

MarkFL
10-15-2017, 11:23 AM
Yes, I see theses issues now as well. I suspect these were issues all along with this product. Unfortunately I just have too many other things I'm working on to address this now. Perhaps someday I can return to this and figure it out. :)

Stratis
10-15-2017, 12:02 PM
Ok Mark, thanks

MarkFL
10-19-2017, 01:43 AM
Hey Stratis,

I think I have the issues you reported worked out. I have attached the latest update...:)

Stratis
10-19-2017, 03:04 AM
Yes Mark, now it works as supposed to be.
Thank you so much for making this to work :)

wangyu1314
11-05-2017, 07:48 AM
Hey Stratis,

I think I have the issues you reported worked out. I have attached the latest update...:)
hello. I test it and found thread and post can view, but can not edit all in vb 3.8.11, could you fix it ? thank you.

DCD.RB
04-13-2018, 07:42 PM
Hey Stratis,

I think I have the issues you reported worked out. I have attached the latest update...:)

Does this work on 3.8? It's posted on a 3.8 Mod thread, but the version says 4 is required.

Edit: I manually changed the version number, but also have the same issue where users are unable to edit posts pending approval.

MarkFL
04-13-2018, 09:22 PM
The product I uploaded is intended for use with vB 4.2.x.