XF 1.5 How to put Forum.Node_ID in thread title for Reported Content

ainwood

Member
We have all our reported content generating a post in a reports forum. I would like to have the node / forum id name from the originating post report be able to have the moderators be able to see at a glance which forums the reports have come from.

I tried to modify the "reported content" phrase to include {node} and {$forum.node_ID}, but this didn't work. I am relatively new to xenforo, so not sure how to do it. Any steer appreciated!
 

dougdirac

Active member
Any reply on this. I also have this same issue.

In vB4 the default phrase was

Reported Post by $reportinfo[rusername]

Not much info, but they had the variables so that I could change it to this:
$reportinfo[pusername] - $reportinfo[forumtitle] - Post Reported by $reportinfo[rusername]

Any options to do this in XenForo?
 
Last edited:

ainwood

Member
Thanks. As far as I can see, this is not a template, but a phrase that needs to be modified. How do we work out which variables are accessible to a phrase? Is it based on the template used to generate the report? (eg. the post?)
 

S Thomas

Well-known member
In /library/XenForo/ReportHandler/Abstract.php public function prepareReport(array $report) after
PHP:
$contentInfo = unserialize($report['content_info']);
add
PHP:
$report['node_id'] = isset($contentInfo["node_id"]) ? $contentInfo["node_id"] : "";
In report_list template replace
HTML:
                <a href="{xen:link reports, $report}"><xen:if is="{$report.isVisible}">{xen:string wrap, {xen:escape $report.contentTitle, false}, 50}<xen:else />{xen:phrase unknown_content}</xen:if></a>
with
HTML:
                <a href="{xen:link reports, $report}"><xen:if is="{$report.isVisible}">{xen:string wrap, {xen:escape $report.contentTitle, false}, 50} <xen:if is="{$report.node_id}">in node {$report.node_id}</xen:if><xen:else />{xen:phrase unknown_content}</xen:if></a>
 

Tom McIntyre

Active member
HTML:
<a href="{xen:link reports, $report}"><xen:if is="{$report.isVisible}">{xen:string wrap, {xen:escape $report.contentTitle, false}, 50}<xen:else />{xen:phrase unknown_content}</xen:if></a>
does not appear in our report_list template. The line seems to have been changed to:
HTML:
<xen:topctrl><a href="{xen:link 'reports/closed'}" class="callToAction"><span>{xen:phrase closed_reports}</span></a></xen:topctrl>
I think that is because we are using a custom style from @ThemeHouse . Any suggestions on how to map the feature to a different template?
 

S Thomas

Well-known member
Look for a line which containts {xen:link reports, $report} and then only add
<xen:if is="{$report.node_id}">in node {$report.node_id}</xen:if>
within the title part of the line. Otherwise, you'll have to ask your style creator for help.
 

Tom McIntyre

Active member
When a post is reported, a thread is generated in the reported post forum. The phrase reported_thread_message generates the new post/thread. We need the node name or linked node name as a variable in that template. If Abstract.php is the script that generates the variables then @yoloswaggerino hack should be able to capture it. I don't know how to put it all together since I don't know which template I need to modify.

The actual message content in our reported posts forum is from the very strange looking phrase reported_thread_message. However, if I search templates for that phrase, it is not found. This is the phrase itself with my odd ball edit in it. (I have tried lots of variant on node_id.)

When I found the phrase, I thought I could use a parameter and provide it from the template but I cannot find a template so there must be some other mechanism for generating the post in the reported posts forum.
HTML:
[url='{link}']{title}[/url] by [url='{userLink}']{username}[/url] has been reported by [url='{reporterLink}']{reporter}[/url] in {node_id}. Reason given:
[quote]{reportReason}[/quote]

Content being reported:
[quote]{message}[/quote]
{extraDetails}
 
i was able to add the name of the forum containing a reported post by adding this to the textarea tag in the post_report template:

Code:
&nbsp;&nbsp;&nbsp;({xen:raw $forum.title})
i was going to get fancy and move the cursor to after the forum name, but the three non-breaking spaces mean the moderators can just start typing the reason they're reporting the post as they're used to doing, and all will get a forum-name-at-a-glance-in-parens reference with the report.
 

TLBofBL

Member
I'm using XF 2.1, and only have our style based off the default - I can find no post_report template. Help?
 

TLBofBL

Member
To elaborate, I'm assuming I need to be editing report_content_post and/or report_create. However, when I try to edit my child style template of those, I'm getting the "Oops..." message.
 

TLBofBL

Member
In /library/XenForo/ReportHandler/Abstract.php public function prepareReport(array $report) after
I've solved my issue building upon the suggestion here from S Thomas.

In my case, I went to the Post.php in /src/XF/Report folder on the server

From there I added the following:

. ' (' . $content->Thread->Forum->Node->title . ')'

into the two lines of $threadTitle =


Code:
    public function setupReportEntityContent(Report $report, Entity $content)
    {
        if (!empty($content->Thread->prefix_id) && $content->Thread->Prefix)
        {
            $threadTitle = $content->Thread->Prefix->title . ' - ' . $content->Thread->title . ' (' . $content->Thread->Forum->Node->title . ')';
        }
        else
        {
            $threadTitle = $content->Thread->title . ' (' . $content->Thread->Forum->Node->title . ')';
        }
We may play a little with formatting, and if we want to call the node_title or node_name, but yeah, problem solved!
 
Top