PDA

View Full Version : Post reported post as issue


Carnage
09 Aug 2011, 06:55
A little something I've been working on since 4.1.5 was release; not good enough for a full mod yet, but it might be of use as a base for others.

Place in hook report_do_report (new 4.1.5)


require_once(DIR . '/includes/functions_projecttools.php');
require_once(DIR . '/includes/functions_pt_posting.php');
$vbulletin = $this->registry;
$issuedata =& datamanager_init('Pt_Issue', $vbulletin, ERRTYPE_ARRAY);
eval(fetch_email_phrases('report' . $this->phrasekey . '_newthread', 0));
$issuedata->set('title', $subject);
$issuedata->set('summary', '');
$issuedata->set('issuestatusid', 20);
$issuedata->set('priority', 5);
$issuedata->set('projectcategoryid', 0);
$issuedata->set('appliesversionid', 0);
$issuedata->set('projectid', 4); //set to the project you want it to go into.
$issuedata->set('issuetypeid', 'reportedpost'); //change to the issue type you want
$issuedata->set('submituserid', $vbulletin->userinfo['userid']);
$issuedata->set('submitusername', $vbulletin->userinfo['username']);
$issuedata->set('visible', 'visible');
$issuedata->set('lastpost', TIMENOW);

$issuenote =& datamanager_init('Pt_IssueNote_User', $vbulletin, ERRTYPE_ARRAY, 'pt_issuenote');
$issuenote->set_info('parseurl', $vbulletin->options['pt_allowbbcode']);

$issuenote->set('userid', $vbulletin->userinfo['userid']);
$issuenote->set('username', $vbulletin->userinfo['username']);
$issuenote->set('visible', 'visible');
$issuenote->set('isfirstnote', 1);
$issuenote->set('pagetext', $message);
$issuedata->pre_save();
if (!$issuedata->errors)
{
$issuenote->pre_save();
}

$issue['issueid'] = $issuedata->save();
$issuenote->set('issueid', $issue['issueid']);
$issue['issuenoteid'] = $issuenote->save();

PitchouneN64ngc
09 Aug 2011, 23:39
Could be part later of http://tracker.vbulletin.com/browse/VBIV-10779 :)

Carnage
10 Aug 2011, 06:38
I think you've got the wrong idea. The idea is to create a project tools issue everytime a post is reported. Thus you can use the project tools work flow for managing reported posts.

TheLastSuperman
10 Aug 2011, 18:37
I think you've got the wrong idea. The idea is to create a project tools issue everytime a post is reported. Thus you can use the project tools work flow for managing reported posts.

Awesome Carnage, and I have not seen you on lately... heck you might of been and I simply didn't notice however your one of my favorites on here, glad to see you posting and quite a useful post at that ;).

Carnage
13 Aug 2011, 10:19
I've not been around much recently, a full time job leaves much less time for working on things than being a student :p

I'm trying to make project tools a useful mod for many other than its original uses. Another thing I want to try and do is make some modifications to make it useful for moderator votes/applications. I think PT still has some way to go as well in this respect.