![]() |
How to add button next to post new thread button
How do I add a button next to the "post new thread" button on the forumdisplay template? Also, how do I add a conditional to only show it on certain forums?
--------------- Added [DATE]1364339041[/DATE] at [TIME]1364339041[/TIME] --------------- For whoever wants to know... on template forumdisplay, add this <a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newurl.php?{vb:raw session.sessionurl}do=newthread&f={vb:raw foruminfo.forumid}" rel="nofollow" class="newcontent_textcontrol" id="newselllink_top" style="margin-left:160px"><span>+</span> New Button</a> after this <a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newthread.php?{vb:raw session.sessionurl}do=newthread&f={vb:raw foruminfo.forumid}" rel="nofollow" class="newcontent_textcontrol" id="newthreadlink_top"><span>+</span> {vb:rawphrase post_new_thread}</a> You may have to change margin-left:160px based on your setup, but that's the general idea. |
I'd like to bump this. I have a similar question, but I don't understand the solution posted above.
What I'd like to do is this: We have a marketplace with forum IDs 50-54. We want the buttons at the top of these forums to say this: + Post New 'For Sale' / + Post New 'For Trade' / + Post New 'Want to Buy' We want each of these buttons to link to custom forms we've created (through Easy Forms, of course). Also, we don't need the existing "+ Post New Thread" button to display in the marketplace because we're replacing it with these three new buttons. So, we need to make the existing Post New Thread button disappear, but only in forums 50-54. To create the three new buttons, I've followed the directions in this mod and added the code below to my additional.css template: Code:
.custom_button_fs { To get these buttons to display and link correctly, here is the code I am planning on using: Code:
<a href="http://mysite.com/forms.php?do=form&fid=2" rel="nofollow" class="newcontent_textcontrol" id="custom_button_fs"><span>+</span> Post New 'For Sale'</a> ...except I don't know which template to put it in. So, my question has two parts:
Thank you for your help! :) |
The template should be FORUMDISPLAY.
I believe the id of the new thread button is called newthreadlink_top and newthreadlink_bottom. Search for that in the FORUMDISPLAY template to locate the new thread button. You can use an if-else statement as follows: HTML Code:
<vb:if condition="in_array($foruminfo['forumid'], array(50,51,52,53,54))"> |
Yep, what Dave said is correct.
|
Thanks, guys. Where in the FORUMDISPLAY template should I enter the if-else statement?
|
Bump for additional assistance! I can't seem to get this to work, and I'm fairly certain it's because I'm doing something wrong with the if-else statement.
What do I need to do with the text in red to make it so that my custom buttons only show up in subforums 50-54? (Sorry; I don't know a lot about PHP!) Code:
<vb:if condition="in_array($foruminfo['forumid'], array(50,51,52,53,54))"> |
So, knowing 0.1% about PHP, I just played around until I got the result I wanted. In the event that this ever helps anyone else, here's the code I used to get three custom buttons (all linking to customized forms I created in Easy Forms) to show in certain subforums and to get the "Post New Thread" button to disappear in those subforums.
Note that I used a vb:if command (as Dave suggested a few posts up) and incorporated vb:elseif for another set of subforums where we wanted the same three buttons to appear but link to different forms. In template FORUMDISPLAY, at line 45, immediately below <vb:if condition="$show['newthreadlink']">, I found this code: Code:
<a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newthread.php?{vb:raw session.sessionurl}do=newthread&f={vb:raw foruminfo.forumid}" rel="nofollow" class="newcontent_textcontrol" id="newthreadlink_top"><span>+</span> {vb:rawphrase post_new_thread}</a></vb:if> ... and replaced it with the following to control how the top buttons are displayed: Code:
<vb:if condition="in_array($foruminfo['forumid'], array(50,51,52,53,54))"> And around line 271, immediately below <vb:if condition="$show['newthreadlink']">, I found this code: Code:
<a href="{vb:raw $vboptions.vbforum_url}{vb:if "$vboptions['vbforum_url']", '/', ''}newthread.php?{vb:raw session.sessionurl}do=newthread&f={vb:raw foruminfo.forumid}" rel="nofollow" class="newcontent_textcontrol" id="newthreadlink_bottom"><span>+</span> {vb:rawphrase post_new_thread}</a> ... and replaced it with the following to control how the bottom buttons are displayed: Code:
<vb:if condition="in_array($foruminfo['forumid'], array(50,51,52,53,54))"> One oddity is that I had to use different pixel widths for spacing the bottom buttons than I did for spacing the top buttons. Anyway, I hope that helps someone! |
Quote:
|
Ha! Thanks. I just hope it will help someone else down the line. ;)
|
All times are GMT. The time now is 05:02 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|