Advertisement:

Hiding Reported Posts

Aloittaja sedrik05, syyskuu 30, 2013, 05:05:43 AP

« edellinen - seuraava »

sedrik05

I want to hide a reported posts, then it will be sent to the reported posts. I will check if the content is really abusive or what, then if it's really an abusive post, i will delete it, but if it's not abusive, i will make it visible again on the topic. Our panel wants that in our forum, because it's a school forum. Thanks In Advance! God bless! :)

margarett

#1
I'm afraid that's not that easy...

The problem is that a reported post is not signalled in the "messages" table as reported. There's just an email sent to moderators and, if the moderation log is active, it is added to that list/log...
So there is probably nothing you can use to hide such post...

edit: not true, what I've said here...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

how can i filter the displayed posts? what source file i need to edit? i added 'reported' field on the messages table. I want to do if 'reported' column == 0 then it will be posted, but if it's 1 then it will not be posted. Thanks! :)

margarett

Let me investigate a bit further. It might be easier than I thought
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

OK, so further investigation here.

Sorry, I wasn't being correct here...
All the reported posts are added to the table "smf_log_reported" (not sure if you need to activate something for this, my test board is now an official mess, I have to start over...)
In this action here index.php?action=moderate;area=reports you can see the actual reports. And you also have an option to close or delete them.
This should provide you enough "filters" to not show such post.

The most complicated part I see here is: what if someone reports a post that happens to be the first of a topic?
- if the topic has no replies, you should hide the topic
- if the topic has replies, you cannot show the topic without its first message. So, you need to hide ALL posts related to that topic...

This has some further implications: the topics/posts counters should be properly updated if a certain post/topic is not to be shown, the number of topics in MessageIndex or the number of replies in Display should also be updated...

I see this as a quite interesting MOD in the making ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

Now, i can update the column 'reported'. And my Post Moderation Feature is enabled (I will not disable it). I just want to know what file to edit, to filter the posts that will display. Thanks! :)

margarett

Actually, you don't need that new field. You can do everything from standard SMF tables.

The tricky part is that "topics first message"... Because you cannot show a topic without it's first message :P

Anyway, if you forget that "detail", Sources/Display.php shoud be your starting point...
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

Then how can i hide the 'Report to moderator' link on the first post? :D

margarett

That would be Display.template.php
Find:

// Maybe they want to report this post to the moderator(s)?
if ($context['can_report_moderator'])

Replace with:

// Maybe they want to report this post to the moderator(s)?
if (($context['can_report_moderator']) && ($message['id'] != $context['first_message']))
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

I can't hide the posts that have reported = 1 in the database. i tried to edit the Display.php, but the posts that should be hidden is still displaying. :(

margarett

That seriously depends on how you're doing it.
You probably have an "undefined index" error in your error log. You need to fetch that column when the message is loaded. Are you doing it?
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

Sorry for asking many questions. I really don't know what file should i edit, and what part of the file.

I'm doing this:

// Get each post and poster in this topic.
$request = $smcFunc['db_query']('display_get_post_poster', '
SELECT id_msg, id_member, approved, reported
FROM {db_prefix}messages
WHERE id_topic = {int:current_topic}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : (!empty($modSettings['db_mysql_group_by_fix']) ? '' : '
GROUP BY id_msg') . '
HAVING (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ' AND reported = {int:is_reported})') . '
ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
LIMIT ' . $start . ', ' . $limit),
array(
'current_member' => $user_info['id'],
'current_topic' => $topic,
'is_approved' => 1,
'is_reported' => 0,
'blank_id_member' => 0,
)
);

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

It actually works ;) Just a little rewritten:

// Get each post and poster in this topic.
$request = $smcFunc['db_query']('display_get_post_poster', '
SELECT id_msg, id_member, approved, reported
FROM {db_prefix}messages
WHERE reported = {int:is_reported} AND id_topic = {int:current_topic}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : (!empty($modSettings['db_mysql_group_by_fix']) ? '' : '
GROUP BY id_msg') . '
HAVING (approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . '
ORDER BY id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
LIMIT ' . $start . ', ' . $limit),
array(
'current_member' => $user_info['id'],
'current_topic' => $topic,
'is_approved' => 1,
'is_reported' => 0,
'blank_id_member' => 0,
)
);
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

Thank you very much! Hmm, how can i add button on index.php?action=moderate;area=reports? I want to add 'Ignore Report' button that will change the value of reported = 0, so that it will be posted again on the forum. :)

margarett

I see what you mean. I still think you don't need that new column, you can use the already existing mechanism for reported posts.

You can build that query like this (damn this took time :P ):

// Get each post and poster in this topic.
$request = $smcFunc['db_query']('display_get_post_poster', '
SELECT m.id_msg, m.id_member, m.approved
FROM {db_prefix}messages AS m
LEFT JOIN {db_prefix}log_reported as r ON (m.id_msg = r.id_msg)
WHERE (r.id_msg IS NULL OR (r.num_reports > 0 AND r.closed = 1)) AND m.id_topic = {int:current_topic}' . (!$modSettings['postmod_active'] || allowedTo('approve_posts') ? '' : (!empty($modSettings['db_mysql_group_by_fix']) ? '' : '
GROUP BY m.id_msg') . '
HAVING (m.approved = {int:is_approved}' . ($user_info['is_guest'] ? '' : ' OR id_member = {int:current_member}') . ')') . '
ORDER BY m.id_msg ' . ($ascending ? '' : 'DESC') . ($context['messages_per_page'] == -1 ? '' : '
LIMIT ' . $start . ', ' . $limit),
array(
'current_member' => $user_info['id'],
'current_topic' => $topic,
'is_approved' => 1,
'blank_id_member' => 0,
)
);


So you will get what you want, just using SMF's core features and database operations :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

sedrik05

Thank you very much sir! I will just change the name of the 'Close' button. God bless! :)

margarett

Glad it worked out ;)
Marked as solved for you. If you need further help, just marks unsolved and reply again.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: