News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Custom Report Mod

Started by d3vcho, June 02, 2011, 09:27:17 AM

Previous topic - Next topic

Joker™

Quote from: ♦ Ninja ZX-10RR ♦ on December 03, 2014, 01:22:17 PM
I'm in a hurry and can't post everything but I got an "8: Undefined index: cannot_can_solve_report" in Sources/Errors.php at string 204, it prevents me to actually solve the reports from their topics.
Will look into it by tomorrow
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Ninja ZX-10RR

Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Joker™

Quote from: ♦ Ninja ZX-10RR ♦ on December 04, 2014, 02:59:23 PM
I'll be waiting :) thanks!
Thanks for the report. Released a new version 2.0.2 with bug fixed :)
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Ninja ZX-10RR

Will be trying it later today, I'll get back to you :)

And you're welcome ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Ninja ZX-10RR

Seems to work properly now, I have done just a little of testing though. I don't have much time but the issue that was there with the previous version seems to have gone away and I'm now able to mark reports as solved :D nice work Joker™!
I'll bump again in case I stumble into other bugs ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Joker™

Quote from: ♦ Ninja ZX-10RR ♦ on December 05, 2014, 04:56:56 PM
Seems to work properly now, I have done just a little of testing though. I don't have much time but the issue that was there with the previous version seems to have gone away and I'm now able to mark reports as solved :D nice work Joker™!
I'll bump again in case I stumble into other bugs ;)
Thanks and glad that its working as expected
Github Profile
Android apps
Medium

How to enable Post Moderation

"For the wise man looks into space and he knows there is no limited dimensions." - Laozi

All support seeking PM's get microwaved

Bill Statler

Quote from: Joker™ on December 05, 2014, 05:07:56 AM
...Released a new version 2.0.2 with bug fixed :)

Belated thanks for updating this mod!  It will be part of our (also belated) forum software update.

JaGuR

Hi Joker,

Great Mod, and hoping you are still working on it, as I believe it is a must have for any forum.

I have one feature suggestion though if possible, adding custom icons to this mod to show topic solved and unsolved.

on SMF1 the mod I was using had a red unsolved icon and a green solved icon which made it easy for moderators to see a thread that needed actioning

I was thinking about having a go at modding this myself, but thought it best to ask you to implement it first  ;D

Paracelsus

Quote from: JaGuR on June 27, 2015, 09:33:12 PM
Hi Joker,

Great Mod, and hoping you are still working on it, as I believe it is a must have for any forum.

I have one feature suggestion though if possible, adding custom icons to this mod to show topic solved and unsolved.

on SMF1 the mod I was using had a red unsolved icon and a green solved icon which made it easy for moderators to see a thread that needed actioning

I was thinking about having a go at modding this myself, but thought it best to ask you to implement it first  ;D

Thinking about the same thing... in the topic/post icon it should be possible to have an icon for unsolved topics and another one once you click solved.

Maybe it's possible to modify it in CustomReportCore.php in Sources, not sure...

JaGuR

I have been successful in adding a new unsolved icon when first reporting the post and it showing up as a new post.

But the problem is in clicking on solve /  unsolve the reported post, it creates a completely new post below the reported post and the solved icon gets added to that instead of just toggling the icon between solved and unsolved on the reported post that the solve and unsolve relates to, this has nothing to do with the icon that you see in the boards index and recent topics board as it displays the icon from the first post, not subsequent posts.

Thinking I might just add my own code to toggle the icon that is stored in the database by passing the mod all together but keep the report to mod part :/

Paracelsus

Quote from: JaGuR on July 06, 2015, 07:53:31 PM
I have been successful in adding a new unsolved icon when first reporting the post and it showing up as a new post.

How did you do that?

ms_ukyankee

I've made some changes to use solved/unsolved icons and not lock the topics, someone else might find useful.

In /Sources/CustomReport/CustomReportCore.php find:

public function reportSolved($topicId) {
global $txt, $board_info, $user_info, $modSettings;

$result = $this->dbInstance->checkIsTopicSolved($topicId);
if(empty($result['solved'])) {
$subject = '[' .$txt['cr_report_solved'] . ']'. ' ' . $result['subject'];
$body = $txt['cr_report_solved'] . ' ' . $txt['by'] . ' ' . '\''. $user_info['name'] . '\'';

$msgOptions = array(
'subject' => $subject,
'body' => $body,
);
$topicOptions = array(
'id' => $topicId,
'board' => $modSettings['cr_report_board'],
'lock_mode' => 1,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $user_info['id'],
'update_post_count' => !empty($modSettings['cr_enable_report_mod_count']) && $board_info['posts_count'],
);
createPost($msgOptions, $topicOptions, $posterOptions);
} else {
$this->dbInstance->unlockTopic($topicId);
}

$isSolved = empty($result['solved']) ? 1 : 0;
$this->dbInstance->setSolveStatus(array(
'isSolved' => $isSolved,
'topicId' => $topicId
));


Changed to:

public function reportSolved($topicId) {
global $txt, $board_info, $user_info, $modSettings, $smcFunc;

$result = $this->dbInstance->checkIsTopicSolved($topicId);
if(empty($result['solved'])) {
$subject = '[' .$txt['cr_report_solved'] . ']'. ' ' . $result['subject'];
$body = $txt['cr_report_solved'] . ' ' . $txt['by'] . ' ' . '\''. $user_info['name'] . '\'';

$msgOptions = array(
'subject' => $subject,
'body' => $body,
                                'icon' => 'solved',
);
$topicOptions = array(
'id' => $topicId,
'board' => $modSettings['cr_report_board'],
'lock_mode' => 0,
'mark_as_read' => true,
);
$posterOptions = array(
'id' => $user_info['id'],
'update_post_count' => !empty($modSettings['cr_enable_report_mod_count']) && $board_info['posts_count'],
);
                createPost($msgOptions, $topicOptions, $posterOptions);
   
} else {
$this->dbInstance->unlockTopic($topicId);
}

$isSolved = empty($result['solved']) ? 1 : 0;
$this->dbInstance->setSolveStatus(array(
'isSolved' => $isSolved,
'topicId' => $topicId
));

    if ($isSolved == 1) $seticon = 'solved';
    else $seticon = 'unsolved';

    // update icon on first post
   
    $smcFunc['db_query']('', '
      UPDATE {db_prefix}messages
      SET icon = {string:icon}
      WHERE id_msg = {int:id_msg}',
      array(
        'id_msg' => $result['id_first_msg'],
        'icon' => $seticon,
      )
    );
   
// Back to the post we reported!
redirectexit('topic=' . $topicId . '.0');
}


And find:

private function createReport() {
global $modSettings, $user_info, $board_info;

// set up all options
$msgOptions = array(
'id' => 0,
'subject' => $this->post_data['subject'],
'body' => $this->post_data['body'],
'icon' => 'xx',
'smileys_enabled' => true,
'attachments' => array(),
'approved' => true,
);


Change 'icon':

private function createReport() {
global $modSettings, $user_info, $board_info;

// set up all options
$msgOptions = array(
'id' => 0,
'subject' => $this->post_data['subject'],
'body' => $this->post_data['body'],
'icon' => 'unsolved',
'smileys_enabled' => true,
'attachments' => array(),
'approved' => true,
);


You need to have solved.gif and unsolved.gif in the default theme folder Themes/default/images/post/. I had them from the 1.x version of a similar mod.

Thanks Joker for a great mod!
SMF since 2004 <3

ms_ukyankee

Following on from post above with unsolved icon, to change the board topic index to sort by unsolved topics, find in /Sources/MessageIndex.php (around line 390):


ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '
LIMIT ' . ($pre_query ? '' : '{int:start}, ') . '{int:maxindex}',


Change to:

ORDER BY ' . ($pre_query ? 'FIND_IN_SET(t.id_topic, {string:find_set_topics})' : (!empty($modSettings['enableStickyTopics']) ? 'is_sticky' . ($fake_ascending ? '' : ' DESC') . ', ' : '') . (!empty($modSettings['cr_report_board']) && $board == $modSettings['cr_report_board'] ? "mf.icon = 'unsolved'" . ($fake_ascending ? '' : ' DESC') . ', ' : '') . $_REQUEST['sort'] . ($ascending ? '' : ' DESC')) . '
LIMIT ' . ($pre_query ? '' : '{int:start}, ') . '{int:maxindex}',
SMF since 2004 <3

JaGuR

Good man, greatly appreciated :)

Now all that is stopping me from upgrading to SMF 2 from SMF 1 is being able to hide posts from members, as opposed to deleting them completely  ;D

d3vcho

Version 2.0.3

- Fixed couple of bugs that caused the mod not to work

Please leave your feedback.
"Greeting Death as an old friend, they departed this life as equals"

d3vcho

Version 2.0.4

- Adds russian translation (by realdigger)
"Greeting Death as an old friend, they departed this life as equals"

shadav

I know this is an old thread, but noticed there was an update to the mod.....
but.....
the download ins't an installer, nor any install instructions that I can find...just files and folders
am I suppoed to just upload the the files and folders and then run installer/install.php and installhooks.php what about template edits?

[edit] unzipped, took all the items out of the folder (leaving subfolders alone) then rezipped it, the install recognizes it now

Kindred

It is supposed to be installed using the package manager, but it looks like the author  forgot the XML file when he uploaded the new version
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

1.1Nerd

The mod file unfortunately seems to be broken / corrupt. WOuld be nice if somebody could please update the file with a working one. Thank you

shadav

Quote from: 1.1Nerd on August 25, 2020, 05:41:55 PM
The mod file unfortunately seems to be broken / corrupt. WOuld be nice if somebody could please update the file with a working one. Thank you

;) read 2 posts up
Quote from: shadav on June 08, 2020, 11:28:48 PM
I know this is an old thread, but noticed there was an update to the mod.....
but.....
the download ins't an installer, nor any install instructions that I can find...just files and folders
am I suppoed to just upload the the files and folders and then run installer/install.php and installhooks.php what about template edits?

[edit] unzipped, took all the items out of the folder (leaving subfolders alone) then rezipped it, the install recognizes it now

Advertisement: