Welcome to XenForo Premium Community

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Ask question

Ask Questions and Get Answers from Our Community

Answer

Answer Questions and Become an Expert on Your Topic

Contact Staff

Our Experts are Ready to Answer your Questions

  • We now accept : Bitcoin , PayPal

Photo / Image Competition with a Question forum


TuGa_MoDz

New founder XFCheat
Staff member
Joined
22 December 2019
Messages
247
Best answers
4
Reaction score
192
Points
43
Location
CH
Website
extra-gaming.com
10 mins to create/convert a forum node to a Question forum type, and a couple of basic Template Edits to have a quite effective photo/image competition on your site for members.

Goal: A forum node with a thread, per month, where members will submit their photo/image entry. Members will vote on photos/images they like. At the end of the month, the post with the highest votes is marked as the Winner by a moderator/staff member. Celebrate!


Step 1: Create, or convert an existing, forum node and make it a question forum type.

From /admin.php?nodes/ either;
i) add a new node with forum type Question, or
ii) edit an existing node and change its type to Question

Screen Shot 2020-09-08 at 13.51.47.png Screen Shot 2020-09-08 at 13.52.19.png


Step 2: Remove the ability to give down votes.

Edit the node you just created/converted, and untick the option labelled 'Allow answers given to votable questions to be downvoted'

Screen Shot 2020-09-08 at 13.57.01.png

Note: Before saving the node settings, look at your browser's URL bar to note the node ID as you'll need this for Step 5 below. Your node ID is the number near the end of the URL, for example with URL of /admin.php?forums/monthly-photo-competition.89/edit the node ID is 89.


Step 3: Review the remaining node options, including within advanced group, to define your configuration.

For me, I have the following;
  • 'Display in the node list': ticked
  • 'Allow new messages to be posted in this forum': ticked
  • 'Count messages posted in this forum toward user total': ticked
  • 'Include threads from this forum when users click "New posts"': ticked
  • -- All other tick boxes are unticked --


Step 4: Review your node permissions.

Note: The below permissions sets up the presumption that only moderators/staff will create the monthly competition thread and mark the winning image/photo post.

At a minimum, you'll likely want to ensure that your Registered Users user group has at least the following permissions;
  • View node
  • View threads by others
  • View thread content
  • Vote on threads/posts
  • Post replies
  • View attachments to posts
  • Upload attachments to posts
Additionally, you may consider removing the following permissions from Registered users;
  • React to posts
  • Post new thread
Screen Shot 2020-09-08 at 14.26.23.png

And lastly, for permissions, ensure your Moderators/Staff user group has the permissions
  • Post new thread
  • Mark post as solution to any question thread

Note: Utilise Analyze permissions ( /admin.php?permissions/analyze ) | Node permissions to check/confirm your desired permissions are set correctly. Pick both a 'regular' user and a moderator/staff member against your Photo/Image Competition node to see their permissions.

Screen Shot 2020-09-08 at 14.35.31.png


Step 5: Edit Templates to change phrase usage from Solution to Winner.

From Templates ( /admin.php?templates/ ), 1) choose the active style for your site (it's always recommended to have/use a child style, when editing templates),

Screen Shot 2020-09-08 at 14.42.14.png

Step 5.1: Modify the thread_view_type_question template
  • enter 'thread_view' into the filter box (2)
  • click on the thread_view_type_question template (3) to open/edit it
  • Scroll down to line 28 with content of {{ phrase('solution') }}
  • Replace line 28 to instead have content of <xf:if is="in_array($xf.reply.containerKey, ['node-89'])">Winner<xf:else />{{ phrase('solution') }}2</xf:if>
    • Note: Replace node-89 in the line above with the id number of your Photo/Image Competition node, as noted in Step 2.
Your template code should now look like this (but with your node ID):
Screen Shot 2020-09-08 at 15.12.53.png
  • Click the 'Save and exit button' at the bottom to return to the templates list

Step 5.2: Modify the post_question_macros template
  • enter 'post_question' into the filter box (2)
  • click on the post_question_macros template (3) to open/edit it
  • scroll down to line 19 with content of <xf:set var="$makeSolutionText" value="{{ phrase('mark_as_solution') }}" />
  • On a new line immediately below it, add the following code;
Code:
<xf:if is="in_array($xf.reply.containerKey, ['node-89'])">
                            <xf:set var="$isSolutionText" value="Unmark as Winner" />
                        <xf:else />
                            <xf:set var="$isSolutionText" value="{{ phrase('unmark_as_solution') }}" />
                        </xf:if>
                        <xf:if is="in_array($xf.reply.containerKey, ['node-89'])">
                            <xf:set var="$makeSolutionText" value="Mark as Winner" />
                        <xf:else />
                            <xf:set var="$makeSolutionText" value="{{ phrase('mark_as_solution') }}" />
                        </xf:if>
  • Note: Replace node-89 in the two lines above with the id number of your Photo/Image Competition node, as noted in Step 2.
Your template code should now look like this (but with your node ID):
Screen Shot 2020-09-08 at 15.23.07.png
  • Click the 'Save and exit button' at the bottom to return to the templates list

Done!
Now go ahead and create a thread in your Photo Competition forum, announcing the competition rules and theme, and inviting users to post and upload/link their photo or image for the competition.

I have a seperate sticky thread with the overall competition rules, and a thread each month for the competition. The first post in the monthly thread reminding/linking to the overall rules and setting the theme for that month's competition. The previous months winner chooses the theme for the next month.
 
shape1
shape2
shape3
shape4
shape7
shape8
Top