Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Report Abuse
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Report Abuse
Requirement: XThreads

This is a simple example (and maybe useless) for adding a report abuse.
Basically, maybe we can use it for report profile, attachment, signature and etc.
In this example, we will try to use it for MyBB attachment (report attachment).
We need at least XThreads 1.51 for this.

Create or edit a forum:
  • Template Prefix: xtra_
  • Settings Overrides:
    • Setting: Server and Optimization Options -> Friendly Redirection Pages
    • Value: 0

    Code:
    redirects=0

  • Set forum permissions, depends on which usergroup(s) are allowed to report an attachment. And set which usergroup(s) are allowed to view the threads in this forum.

Create Custom Thread Fields:
  1. Textbox for Thread ID
    • Title: Thread ID
    • Key: xtra_tid
    • Applicable Forums: 'elect our Report Abuse forum
    • Editable by / Required Field?: Everyone (required)
    • Display Order: 1
    • Capture Tab Key: No
    • Default Value:

      Code:
      <?=intval($mybb->input['xthreads_xtra_tid'])?>

    • Underlying Data Type: Integer unsigned
    • Text Mask Filter: Digits
    • Hide Input Field: Yes
    • Use Custom Input HTML: Yes
    • Input Field HTML:

      HTML Code
      <input type="hidden"{NAME_PROP} value="{VALUE}" />

  2. Textbox for Post ID
    • Title: Post ID
    • Key: xtra_pid
    • Applicable Forums: 'elect our Report Abuse forum
    • Editable by / Required Field?: Everyone (required)
    • Display Order: 2
    • Capture Tab Key: No
    • Default Value:

      Code:
      <?=intval($mybb->input['xthreads_xtra_pid'])?>

    • Display Format:

      HTML Code
      <div class="smalltext"><strong><a href="<?=get_post_link(intval({VALUE}),intval($threadfields['xtra_tid']))?>#pid<?=intval({VALUE})?>" target="_blank">View Post</a></strong></div>

    • Underlying Data Type: Integer unsigned
    • Text Mask Filter: Digits
    • Hide Input Field: Yes
    • Use Custom Input HTML: Yes
    • Input Field HTML:

      HTML Code
      <input type="hidden"{NAME_PROP} value="{VALUE}" />

  3. Textbox for Attachment ID
    • Title: Attachment ID
    • Key: xtra_aid
    • Applicable Forums: 'elect our Report Abuse forum
    • Editable by / Required Field?: Everyone (required)
    • Display Order: 3
    • Capture Tab Key: No
    • Default Value:

      Code:
      <?=intval($mybb->input['xthreads_xtra_aid'])?>

    • Display Format:

      HTML Code
      <div class="smalltext"><strong><a href="{$mybb->settings['bburl']}/attachment.php?aid={VALUE}" target="_blank">View Attachment</a></strong></div>

    • Underlying Data Type: Integer unsigned
    • Text Mask Filter: Digits
    • Hide Input Field: Yes
    • Use Custom Input HTML: Yes
    • Input Field HTML:

      HTML Code
      <input type="hidden"{NAME_PROP} value="{VALUE}" />



Edit template:
  • editpost and newthread templates:
    Basically, we need to add this variables in those template:

    Code:
    {$tfinput['xtra_tid']}{$tfinput['xtra_pid']}{$tfinput['xtra_aid']}

    If we want to use a specific layout for the Report Abuse form, create a xtra_newthread and xtra_editpost_first templates in our Global Template.

  • postbit and postbit_classic template:
    Basically, we need to add these variables in those templates:

    Code:
    {$GLOBALS['threadfields']['xtra_aid']}{$GLOBALS['threadfields']['xtra_pid']}

    If we want to use a specific layout for the first post in this forum, create xtra_postbit_first and xtra_postbit_first_classic in our Global Templates.


Now, we need to use this URL in our attachment templates (for example, postbit_attachments_thumbnails_thumbnail):

HTML Code
<a href="newthread.php?fid=X&amp;xthreads_xtra_aid={$attachment['aid']}&amp;xthreads_xtra_tid={$post['tid']}{$announcement['tid']}&amp;xthreads_xtra_pid={$attachment['pid']}"><img src="{$theme['imglangdir']}/postbit_report.gif" alt="Report this attachment" title="Report this attachment" /></a>

Replace the X with our Report Abuse forum ID.

If we want to make sure that the reported attachment is a valid attachment, we need an additional plugin for that. The example plugin is attached for that (change the forum id inside the plugin to our Report Abuse forum id).

Live Demo:
There are some attachments I posted here:
http://xtest.byethost7.com/showthread.ph...http://xtest.byethost7.com/showthread.php?tid=25&pi
http://xtest.byethost7.com/showthread.ph...http://xtest.byethost7.com/showthread.php?tid=26&pi
Click the attachment, and click the first Report button (guest are allowed to report the attachments).
And because it is a demo, I don't prevent guest to view the forum.
Here is the forum:
http://xtest.byethost7.com/forumdisplay.php?fid=16

That is our simple (and maybe useless) report attachment example application. Just modify it as our needs.
Please tell me if there is something wrong with the above method. I'm still learning Smile



Attached File(s)
.php  xtra_plgn.php (Size: 1.34 KB / Downloads: 310)

(This post was last modified: 04-18-2012 07:57 AM by RateU.)
04-18-2012 07:43 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: