Implementing "post moderation" or something similar...

Started by Dainis, October 08, 2004, 05:46:27 PM

Previous topic - Next topic

Dainis

Hi,

We've got a rather long thread going on at http://www.simplemachines.org/community/index.php?topic=17147.0;all, so, I figured I'd break out one of the key topics to see what ya'll might have to say.

Here's the challenge we've been working on resolving, and as yet, we don't have it working:

Person A comes to my forum.  Person A has a post to make, and posts it.  After posting this, person A can see it, and so can I (admin).  Person B (who comes along later) cannot see person A's post, but can make posts for him or herself. Both Person A and Person B, then, are in a "private" correspondence with me (the admin), until I decide to make the thread public (which I may or may not do).

I've got "Member Specific Permissions 1.21," "Post Moderation 2.01,"  and "Visual Warning / Post Moderation" installed, and I can't seem to get them to work...

So, that's the nut to crack, and I'm looking forward to hearing that CRRRUnching sound!  :)

Procedures, help, comments, suggestions, all greatly appreciated,

Dainis

Grudge

I'm slightly confused. If person A has made a new thread then person B couldn't reply as they wouldn't know the thread was there?

If however, person A has replied to an existing thread, do you mean that all subsequent replies also need to be approved?
I'm only a half geek really...

Dainis

Thank you very much for your reply,

Sorry for the confusion. Let me try to clear things up:

QuoteIf person A has made a new thread then person B couldn't reply as they wouldn't know the thread was there?
Right.

I'll try to explain how I'm using certain terms:

thread = something a person starts by posting
post = either an "initial post," or a "subsequent post," where an initial post starts a thread, and a subsequent post is a post to an existing thread

So, Person A comes to a particular board and decides to post. It's an initial post, which starts a thread. We'll call Person A's thread "Thread A." Thread A stays between me (the admin) and Person A. Also, Person A can make subsequent posts to Thread A, and so can I.

Person B comes to the same board and basically sees my stickies and approved threads (not Person A's thread). Person B makes a post and starts Thread B. Thread B stays between me (the admin) and Person B, until I approve the thread. Person B and I can post back and forth on the thread. That thread may never be approved for public viewing.

Both Person A and Person B, then, are in a "private" correspondence with me (the admin), until I decide to make the thread public (which I may or may not do).

QuoteIf however, person A has replied to an existing thread, do you mean that all subsequent replies also need to be approved?
Hmm...not quite sure how to answer this...an "approved thread" is a "public thread" and anyone can post to public threads. However, I imagine that I would close the "approved threads," which would then wind up for viewing purposes only (no more posts allowed by anyone). Whether subsequent posts to "public threads" need to be approved or not is not a "make it or break it" issue for me, it could be yes or no, it would work fine either way.

The main purpose of the board would be to have people start their own threads (by making an initial post), and thereby enter into a "private" discussion with me.

Let me know if I cleared that up, and I'd say that just getting post moderation to work (as designed) would be a great initial step for me. Thanks for your interest in what I'm trying to do!

Peace,
Dainis




Grudge

I see what you mean. Indeed IIRC my post moderation mod only "queues" up posts for moderation and doesn't allow the original user to post in them again. Although I am working on some post moderation stuff in the future I personally won't be able to find the time to update the mod to do what you want I'm afraid. It is functionality I want in the future but it won't be the near future due to my commitments elsewhere. I really don't have much more I can say on this apart from in the future it should do this but we're talking distant future (6 months) not near future :(
I'm only a half geek really...

Dainis

That's fine, can we work on getting post moderation working (as designed by you, not how I've described) in my install? Once it's working, maybe I can start tinkering with the code to see if I can get "thread moderation" to work. That'd be a hoot! Might be a good way to get me more familiar with PHP and SMF.

Thanks for your reply  :)

--Dainis

Grudge

What isn't working about it? If you try and install it what does it say? Bear in mind that I only made it compatible with RC2 about 3 hours ago, so if it says "No install actions defined" you just need to download it from my server again...
I'm only a half geek really...

Dainis

Oh, OK, I got it from [Unknown] here: http://www.simplemachines.org/community/index.php?topic=17147.msg144402#msg144402.

I'm using SMF 1.0 RC1, which I downloaded about 2 weeks ago. Does that mean I need to update SMF and the "post moderation" mod?

Cheers!
Dainis

Oh, regarding what's not working about it...it's just there...an option in the admin cp, but when new users post, nothing happens, I can't seem to "set" a board to have "post moderation," the board just functions like a normal board. 

Oldiesmann

Yeah, you should update your board. As far as post moderation goes, go into Manage Boards, and click Modify next to the board where you want post moderation. There should be a dropdown list in there called "Approve Posts". Choose whatever option you want from that list.
Michael Eshom
Christian Metal Fans

Dainis

Upgraded to RC2, installed Post moderation and member specific permissions.

I'm thinking that there might be a way to create something like "thread moderation" by combining "post moderation" with "member specific permissions."

Maybe we can figure out a "work around" which I can use for the next six months or so, since Grudge mentioned wanting to develop something like "thread moderation" in that approximate time frame.

Here's what I'm thinking of trying: I apply post moderation to a board and let all of my users know that it is a private board. A user comes and posts, creating a new thread. I "approve" the thread, but then I give the thread starter exclusive permission to view that thread using member specific permissions (no one else can see the thread, just the thread starter and the admin). The thread starter and I (admin) are then in a "private discussion."

Yes/no/maybe so?

Cheers!
Dainis


Dainis

Alllrighty folks!

Where to I need to start crack-o hacking to try to get this to work? Can anyone point out the files I'd need to get my arms around, and maybe an appropriate tutorial or two, so that I can inhale PHP and work specifically toward what I'm tring to do in SMF? I'm thinking of digging around in the post moderation mod and trying to make a statement in there that says basically "the person who started the post can see the thread he/she started and make subsequent posts to it, even while the post is still being 'evaluated' by the admin."

I guess I'll take the plunge here, but can someone tell me where the diving board is?

(Hmm that's my second usage of the diving board analogy on this board...wonder what that means... :))

Cheers!
Dainis


Dainis

I'm in PostModeration.php, and I found:

Quote// Permission
   isAllowedTo('moderate_forum');

Is there something like

isAllowedTo('post_to_thread'); or could that be created? Where would that be created? Where/How are "threads" defined? 


There's also
Quote// Show the admin index if this is - well - an admin!
   if ($user_info['is_admin'])
      adminIndex('postmod_manager');

So, is there something like

if ($user_info['is_thread_starter'])
somethingIndex('not_sure'); -- something that would allow the thread starter to see and post to non-approved threads?

Cheers!
Dainis

Grudge

Well - the problem is that IIRC my post moderation mod works by setting ID_BOARD to 0 on messages which aren't approved, and uses log approved table to get approved posts seperatly. Basically, you'd have to add an *extra* query or more to Display/MessageIndex which would slow the page down quite a lot. The biggest problem I had when writting the mod is to make it workable it had to be relatively simple to install. There is an ideal solution to post moderation which I am working on for the distant future but it would be >200 changes to the source files and hence unworkable as a mod! Basically, you can probably do what you want but it's such a massive slow down it's probably not worth it (And would probably need some 100+ lines of code).

Of course you may be able to find an easier way to do it but it represents a big challenge. www.php.net has all the php info that you may need.

Good luck ;)
I'm only a half geek really...

Dainis

Might there be some "sneaky" way to do it? Something like:

if ID Board = 0 and ($user_info['is_thread_starter']), then allow permissions as if user_group_newbie), elseif/otherwise...whatever makes postmod work.

I'm totally guessing here, I wouldn't know where to put this statement, or how to write it exactly, but am I on the right track?

Also, I don't quite understand what can happens when ID_BOARD to 0 on certain messages. What does ID_BOARD equal on "approved" messages? Where can I check that? Also, where's/what's Display/MessageIndex and can I read more about it somewhere?

Thanks for your response!
Dainis

Dainis

Another thing that came to mind is: "how does SMF keep its session variable?" I don't know what it's called, but basically, how does SMF keep a person logged in?

The next thing to do would be to get at thread_starter, and then setting approprate permissions.

Can ya point me to the right files in SMF?

Cheers!
Dainis

Grudge

In MessageIndex I guess you could change the WHERE clause of the request to:
say:

(t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND (t.ID_MEMBER_STARTED = $user_info[id] OR $user_info[is_admin])))


May have to do a similar thing in display.php.  Basically, the idea when writing was that by setting ID_BOARD in the topics table to zero it made it a fast way to excluse it from all sections of SMF, but addig the clause above should make it display moderated posts for the starter and the admin.

As far as sessions go, it just uses a session variable which is kept for the length of time the browser is open. It's probably checked in Subs-Auth.php

Cheers,
Grudge
I'm only a half geek really...

Dainis

Grudge,

Thank you very much for your response. I had to figure out a solution that would work while working on this, so I haven't replied in a while.

Here are the permissions I'm trying to incorporate on various boards in my SMF install:

Permissions
A) Only Admin can start new threads, anyone can reply to existing threads (including guests, but add guest_ prefix) New topic and new poll buttons not visible.

B) User pays. Admin gives that user permission to start threads in this forum. Otherwise, anyone, including guests, can reply to existing threads. New topic and new poll buttons not visible to folks who can't make new topics or polls. I'll probably want to make custom New topic and new poll buttons specifically for this board (as they will be named something else here). Best, if by paying, user could automatically post here.

C) Private between Admin and thread starter, which is what we've talked about here. I am going to go ahead and try the ID_BOARD code Grudge suggested, and I'll let everyone know what happened.

Thanks all and...cheers!
Dainis

Dainis

QuoteIn MessageIndex I guess you could change the WHERE clause of the request to:
say:
Copy to clipboardCode:
(t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND (t.ID_MEMBER_STARTED = $user_info[id] OR $user_info[is_admin])))

May have to do a similar thing in display.php.

OK, there are two requests in MessageIndex.php, and I'm assuming you mean the one in

// Mark current and parent boards as seen.

Hmm, how does the title of this section relate to what we're doing?

Anyway, here's the request I think you're talking about:

$request = db_query("
SELECT sent
FROM {$db_prefix}log_notify
WHERE ID_BOARD = $board
AND ID_MEMBER = $ID_MEMBER
LIMIT 1", __FILE__, __LINE__);
$context['is_marked_notify'] = mysql_num_rows($request) != 0;


You suggested t.ID_BOARD, and I'm trying to figure out what you mean by the "t." part of "(t.ID_BOARD..."

Basically, these permissions would apply to two boards in my forum. Is that possible?

Would the following be the code modification you're suggesting?

$request = db_query("
SELECT sent
FROM {$db_prefix}log_notify
WHERE

(t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND (t.ID_MEMBER_STARTED = $user_info[id] OR $user_info[is_admin])))

LIMIT 1", __FILE__, __LINE__);
$context['is_marked_notify'] = mysql_num_rows($request) != 0;


I'm not seeing how to specify the specific board that requires the permissions I've described.

What statement would isolate the desired board(s)?

Thank you very much for your help.

Kampai!
Dainis

Grudge

Okay... we're looking at this:

(t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND (t.ID_MEMBER_STARTED = $user_info[id] OR $user_info[is_admin])))


That should actually be:

(t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND (t.ID_MEMBER_STARTED = $ID_MEMBER OR $user_info[is_admin])))

(My bad)

And it should apply to the major query in the file, not the one you say, this one:

SELECT
t.ID_TOPIC, t.numReplies, t.locked, t.numViews, t.isSticky, t.ID_POLL,
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
t.ID_LAST_MSG, ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,
ml.subject as lastSubject, ml.icon as lastIcon, ml.posterName AS lastMemberName,
ml.ID_MEMBER AS lastID_MEMBER, IFNULL(meml.realName, ml.posterName) AS lastDisplayName,
t.ID_FIRST_MSG, mf.posterTime AS firstPosterTime, mf.modifiedTime AS firstModifiedTime,
mf.subject as firstSubject, mf.icon as firstIcon, mf.posterName as firstMemberName,
mf.ID_MEMBER as firstID_MEMBER, IFNULL(memf.realName, mf.posterName) AS firstDisplayName,
LEFT(ml.body, 384) AS lastBody, LEFT(mf.body, 384) AS firstBody, ml.smileysEnabled AS lastSmileys,
mf.smileysEnabled AS firstSmileys
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ml, {$db_prefix}messages AS mf
LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS memf ON (memf.ID_MEMBER = mf.ID_MEMBER)
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = $board AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE t.ID_BOARD = $board
AND ml.ID_MSG = t.ID_LAST_MSG
AND mf.ID_MSG = t.ID_FIRST_MSG


That code will show all threads in the board AND which are currently being moderated. To make it work properly it would probably need to look like this:

t.ID_TOPIC, t.numReplies, t.locked, t.numViews, t.isSticky, t.ID_POLL,
IFNULL(lt.logTime, IFNULL(lmr.logTime, 0)) AS isRead,
t.ID_LAST_MSG, ml.posterTime AS lastPosterTime, ml.modifiedTime AS lastModifiedTime,
ml.subject as lastSubject, ml.icon as lastIcon, ml.posterName AS lastMemberName,
ml.ID_MEMBER AS lastID_MEMBER, IFNULL(meml.realName, ml.posterName) AS lastDisplayName,
t.ID_FIRST_MSG, mf.posterTime AS firstPosterTime, mf.modifiedTime AS firstModifiedTime,
mf.subject as firstSubject, mf.icon as firstIcon, mf.posterName as firstMemberName,
mf.ID_MEMBER as firstID_MEMBER, IFNULL(memf.realName, mf.posterName) AS firstDisplayName,
LEFT(ml.body, 384) AS lastBody, LEFT(mf.body, 384) AS firstBody, ml.smileysEnabled AS lastSmileys,
mf.smileysEnabled AS firstSmileys
FROM {$db_prefix}topics AS t, {$db_prefix}messages AS ml, {$db_prefix}messages AS mf
LEFT JOIN {$db_prefix}members AS meml ON (meml.ID_MEMBER = ml.ID_MEMBER)
LEFT JOIN {$db_prefix}members AS memf ON (memf.ID_MEMBER = mf.ID_MEMBER)
LEFT JOIN {$db_prefix}log_approved AS la ON (la.ID_MSG = t.ID_FIRST_MSG)
LEFT JOIN {$db_prefix}log_topics AS lt ON (lt.ID_TOPIC = t.ID_TOPIC AND lt.ID_MEMBER = $ID_MEMBER)
LEFT JOIN {$db_prefix}log_mark_read AS lmr ON (lmr.ID_BOARD = $board AND lmr.ID_MEMBER = $ID_MEMBER)
WHERE (t.ID_BOARD = $board OR (t.ID_BOARD = 0 AND la.ID_BOARD = $board AND (t.ID_MEMBER_STARTED = $ID_MEMBER OR $user_info[is_admin])))
AND ml.ID_MSG = t.ID_LAST_MSG
AND mf.ID_MSG = t.ID_FIRST_MSG


That will list any topics that you want. You'll probably need to do something similar in Display.php too - but one step at a time ;)

BTW - Sorry I'm not much help with this - the way I did the post moderation mod had some good points and some bad ones. I am actually working on a much more integrated solution for SMF 1.1, but we're talking months before that even reaches initial beta I'm afraid - but it would be dead easy to do just what you want with it when it's finished... it's just a while off!
I'm only a half geek really...

Dainis

Grudge,

You're being a great help, it is totally cool to be reading the code, learning etc. Thanks a ton, this is very interesting...oh, I didn't know that there were two MessageIndex files, one with .php~ and one just .php.

Basically, my workaround for the "private posting" situation is simply to have folks send me email. I'm tempted to get it working now, since the new WHERE statement seems to be pretty understandable...but there's one catch for me: I don't know how that would apply to specific boards only.

If this will be super easy in a few months, I'd like to focus on:
QuoteA) Only Admin can start new threads, anyone can reply to existing threads (including guests, but add guest_ prefix) New topic and new poll buttons not visible.

B) User pays. Admin gives that user permission to start threads in this forum. Otherwise, anyone, including guests, can reply to existing threads. New topic and new poll buttons not visible to folks who can't make new topics or polls. I'll probably want to make custom New topic and new poll buttons specifically for this board (as they will be named something else here). Best, if by paying, user could automatically post here.

( I might goof around with your suggestions here at some point, though, if I get that itchy trigger finger... 8))

Anyway, regarding A) It should be pretty easy, but I'm still a bit confused that my "edit permissions area" doesn't look anything like: http://www.simplemachines.org/community/index.php?topic=4606.0 ...also, I can't find an "advanced" tab, which I've read about on the forums. I realize that I can add, clear or deny permissions; however, I have some questions in green at: http://www.simplemachines.org/community/index.php?topic=17147.msg144995#msg144995.

I'm not sure if permissions get overwritten, for example, if I apply a pre-defined permission profile. That would allow me to change some permissions to try to get A) to work, and then be able to get back to a particular point and try something different, if it doesn't work.

I read http://www.simplemachines.org/community/index.php?topic=19136.0, which is a bit of a "permissions tutorial," but I'm still not "there" yet.

Also, any tips for how to configure a "pay to start thread" board? I'd use PayPal and 2Checkout.

Thanks again!

Nazdrovyah!
--Dainis




Dainis

Howdy again,

I'm back on planet SMF! Gotta love it. Been off the planet, as developing the things we were discussing (while business critical for what I was wanting to do) needed to be set aside (since I couldn't get them working on time to make money with them). So, I dove back into my studies and jobs and such, always eager to come back to SMF when time allowed.

Since it's been so long, I'm curious if there have been any developments in

a) being able to create a multiple question custom poll in which the results would be displayed "next to" the user who took the poll. What I mean is a "ratings poll" in multiple categories.

The result would be "UserX ranked this topic as:
Question 1) 7/10,
Question 2) 3/10,
Question 3) 9/10,
for 7 questions.

b) how's "thread moderation" coming?

c) how about something like "pay to start thread" using PayPal or 2Checkout?

I haven't done a ton of searching on these topics, and I know I should have...also, I haven't upgraded my install of SMF yet to see the latest developments...so I know I'm being bad...but since I feel like I'm coming back to a dinner discussion with a bunch of family members, I thought you all might cut me some slack.

Glad to be back!
Dainis



Advertisement: