PDA

View Full Version : how do I add "New Thread" button to SHOWTHREAD?



Andy Huang
Tue 29th Mar '05, 4:21pm
Hi guys,
Ok, I am trying to add the "New Thread" button to SHOWTHREAD (see attached) because it makes creating new thread slightly easier; however, it doesn't seem to want to work with this below code:


<if condition="$show['largereplybutton']">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$LASTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" /></if></a></td>
<else />
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if>&nbsp;</td>
</if>

I basically added the two if clauses in both cases; and the added if clause is stolen from FORUMDISPLAY (where it checks if user can post new thread and give the button as needed). Can someone please check and let me know why the above doesn't work?

Thanks in advance.

daemon
Tue 29th Mar '05, 4:50pm
Try using this code instead:


<if condition="$show['largereplybutton']">
<td class="smallfont"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a>&nbsp;<a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$LASTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" /></if></a></td>
<else />
<td class="smallfont"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a></td>
</if>

The $show['newthreadlink'] variable isn't set in showthread.php which is why it wasn't working.

Andy Huang
Tue 29th Mar '05, 6:11pm
Ok, that make sense, but is there a way to check whether or not the user have permission to post new thread in that forum and then show the button? Because with the code you provided, it'll always show that button and I'd rather it only show if the user have the permission to do it.

I found a $forum array which is suppose to house some permission information; I wonder if I can directly access it from the template system, as well as what's in that array... I'll be poking around with it...

Edit: Uhhg, $forum['permissions'] had some stuff in it which are not named (just number and more number), and I can't figure that out :/ it'd be great if any vb dev can shed some lights here... its only a template edit requiring knowledge about one variable... no code editing required...

Andy Huang
Wed 30th Mar '05, 1:22pm
Not quite 24 hours yet... but I won't be around too much later today... so bumpy bumpy :)

Andy Huang
Thu 31st Mar '05, 9:40pm
still nothing? bumpy bumpy... anyone familiar with using templates to access forum permissions?

Steve Machol
Thu 31st Mar '05, 11:16pm
Ok, that make sense, but is there a way to check whether or not the user have permission to post new thread in that forum and then show the button? There is no function or conditional I am aware of to do this.

Ace
Fri 1st Apr '05, 5:28am
No...for some reason it's set per-forum, rather than per-usergroup.

Thereby showing for Guests in a forum, when they can't actually post new threads.

There's probably a logical reason..

fusioncreations
Fri 1st Apr '05, 6:10am
I would like to do this as well.

Andy Huang
Fri 1st Apr '05, 12:23pm
if I write in template $forum['permissions'][$forumid] it'd give me a numeric string, I'm guessing its got something to do with the permission, does anyone know what defined word I should use to check whether or not the person can post new thread in this forum?

Dennis Olson
Fri 1st Apr '05, 12:31pm
Use this EXACT CODE:



<if condition="$show['largereplybutton']">
<td class="smallfont"><a href="newreply.php?$session[sessionurl]do=newreply&amp;noquote=1&amp;p=$FIRSTPOSTID"><if condition="$show['closethread']"><img src="$stylevar[imgdir_button]/reply.gif" alt="$vbphrase[reply]" border="0" /><else /><img src="$stylevar[imgdir_button]/threadclosed.gif" alt="$vbphrase[closed_thread]" border="0" /></if></a><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]">
<img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a></td>
<else />
<td class="smallfont">&nbsp;</td>
</if>