MyBB Hacks

Full Version: Just For Fun
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If we have a spam forum, and want to create a simple "The X Post Win" thingy for fun, we can do this simple example:

We need PHP in Templates / Complex Templates or Template Conditionals plugin for this:
  1. Create a custom thread fields:
    AdminCP -> Configuration -> Custom Thread Fields
    • Title: Post Winner
      Modify it as our needs
    • Key: postwin
    • Applicable Forums: Select our Spam forum
    • Editable by / Required Field?: Moderators
      Modify it as our needs. In this example, our Mods are allowed to run a contest.
    • Underlying Data Type: Integer Unsigned
    • Text Mask Filter: Digits
  2. Edit our postbit/postbit_classic template.
    Find {$post['message']}, and add this code before the variable:

    Code:
    <if $postcounter == $GLOBALS['threadfields']['postwin'] then><div class="largetext" style="text-align: center;">You're The Winner</div><br /></if>

    Modify it as our needs.


Now, we can run the contest.
Well, it is just for fun Biggrin

There is an additional settings we can do (thanks, Yumi):
(03-04-2012 11:56 AM)ZiNgA BuRgA Wrote: [ -> ]You may wish to disable deleting posts in the forum so that people can't cheat by shifting their posts up or similar.

Example:
The X Post Winner
[attachment=713]

Hidden Post Winner (Lucky Post)
[attachment=714]
Neat and fun idea!
You may wish to disable deleting posts in the forum so that people can't cheat by shifting their posts up or similar.
Thanks, Yumi.

I've updated the first post for the additional setting (disable deleting posts in the forum).
Reference URL's