PDA

View Full Version : Hide Post Buttons


tubedogg
05-15-2002, 10:00 PM
Another small hack, this one requested by cessna140 (https://vborg.vbsupport.ru/showthread.php?s=&threadid=38661).

It will remove the New Thread and/or Post Reply buttons from showthread and forumdisplay if the user does not have permission to post a New Thread and/or Post a Reply.

Again, it's really quite simple. Download the attached file and follow the instructions.

Please no PMs, email, ICQ, or AIM about this hack. It will be ignored.

RDX1
05-16-2002, 04:12 AM
not bad... wont install it tho - no need

cessna140
05-16-2002, 04:38 AM
Awesome! Thanks for the quick response. I have installed it but have a problem. I have vB 2.2.5.

Your instructions state:

---------------------------------------------------------------
= = = = = = = S H O W T H R E A D . P H P = = = =
---------------------------------------------------------------
__Find__
updateuserforum($thread['forumid']);

__Right after that add__
// ****** //
$showthreadbutton = 1;
if (!$getperms['canpostnew']) {
$showthreadbutton = 0;
}

$showreplybutton = 1;
if (!$getperms['canreplyown'] or (!$getperms['canreplyothers'] and ($thread['postuserid']!=$bbuserinfo['userid'] or $bbuserinfo['userid'] == 0))) {
$showreplybutton = 0;
}
if (!$thread['open'] == 0 and ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] != 6 or !ismoderator($thread['forumid']))) {
$showreplybutton = 0;
}

if ($showthreadbutton == 1) {
eval("\$threadbutton = \"".gettemplate("showthread_threadbutton")."\";");
} else {
$threadbutton = " ";
}
if ($showreplybutton == 1) {
eval("\$replybutton = \"".gettemplate("showthread_replybutton")."\";");
} else {
$replybutton = " ";
}
// ****** //


In showthread.php there are two occurances of updateuserforum($thread['forumid']);. The first on line ~86 the second on line ~468.

I placed the code after the first one I came across, saved/uploaded the file and checked the result. The buttons were gone from the top of the thread but not the bottom. So I inserted the code after the second occurance, saved/uploaded and tried again. Same result, the buttons are still at the bottom of the thread.

Any ideas? Thanks again.

tubedogg
05-16-2002, 04:46 AM
You wanted the second occurance, correct.

I missed one bit of the instructions, you need to do some additional stuff in the showthread template. Download the new file and do the second find/replace under showthread template. That will fix it.

cessna140
05-16-2002, 05:54 AM
Hey tubedogg,

Originally posted by tubedogg
You wanted the second occurance, correct.

Not sure what you meant by this? If you meant at the Thread level, no I would rather not have any buttons show if the person is not allowed to post/reply.

I missed one bit of the instructions, you need to do some additional stuff in the showthread template. Download the new file and do the second find/replace under showthread template. That will fix it.

I downloaded the file again but did not notice anything different. I searched for a second occurance in the showthread template but did not see one. The only duplicate occurance of anything in your instructions was in the showthread.php file. Is that what you were referring to?

This hack works at the Main Forum level but not at the Thread level. Here are some screen shots that might better explain what I'm referring to.

The top part of the image shows unhacked normal operation at Forum level.

The middle part of the image shows a Forum, after installing your hack, where the visitor does not have permission to post. Notice there is no New Thread button! Perfect.

The bottom part of the image shows an individual thread with the buttons still showing even though the visitor does not have permission to post there. What needs to be done to make those disappear? This also ties in to another hack somewhere on vb.org that hides the New Thread button on a Closed thread. Can all of these situations be covered in one hack?

DWZ
05-16-2002, 06:19 AM
augh! the color! it burns my eyes!

tubedogg
05-16-2002, 07:04 AM
Following the instructions for the second find&replace under "showthread template" in the file from will fix your problem.

inphinity
05-16-2002, 09:39 AM
nice hack :)

but correct me if i'm wrong but i think you missed some bits from the instructions

add two new templates:

showthread_threadbutton
<a href="newthread.php?s=$session[sessionhash]&action=newthread&forumid=$forum[forumid]"><img src="{ newthreadimage}" border="0" alt="Post New Thread"></a>

(remove space after { )

showthread_replybutton
<a href="newreply.php?s=$session[sessionhash]&action=newreply&threadid=$threadid"><img src="$replyclose" border="0" alt="Post A Reply"></a>

and in showthread.php i would probably add

$templatesused .= ',showthread_replybutton,showthread_threadbutton';

just under

// ################################################## ############################
// ############################# SHOW THREAD ####################################
// ################################################## ############################

$templatesused = 'showthread_ratingdisplay,postbit_search,postbit_b uddy,postbit_useremail,icq,aim,yahoo,postbit_homep age,postbit_profile,postbit_ip_show,postbit_ip_hid den,postbit,postb
it_sendpm,postbit_avatar,postbit_offline,postbit_o nline,postbit_editedby,postbit_signature,postbit_a ttachment,postbit_attachmentimage,showthread_admin options,showthread_threadrate,show
thread_pollresults_voted,showthread_pollresults_cl osed,showthread_firstunread,showthread_nextnewestt hread,showthread_nextoldestthread,forumrules,showt hread';

cessna140
05-16-2002, 04:55 PM
tubedogg,

Thanks for taking the time. I've got half of it working...

Originally posted by tubedogg
Following the instructions for the second find&replace under "showthread template" in the file from will fix your problem.

First, this hack does work at the forum level. :laugh:

The problem is, the new thread and reply buttons are still showing at the thread level as depicted in the bottom of the previously attached image. :disappointed:

Not to be a pain but, I have followed your instructions to the letter, several times, and can't get it to work. Obviously, I am missing something! Could I impose on you to write new instructions specifically to what I am not getting? Exactly what needs to be replaced and where in order to hide the new thread and reply buttons in threads that I do not have permission to post/reply?

Perhaps as inphinity suggests, there are more steps to this?

Again, thanks!

tubedogg
05-16-2002, 07:52 PM
This is taken verbatim from the instructions file and is what you need to do to make the thread buttons disappear.

__Find__
<!-- Thread nav and post images -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"><smallfont color="#EEEEFF" class="thtcolor"><b>Thread</b></smallfont></td>
<td><a href="newthread.php?s=$session[sessionhash]&action=newthread&forumid=$forum[forumid]"><img src="https://vborg.vbsupport.ru/images/newthread.gif" border="0" alt="Post New Thread"></a></td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td><a href="newreply.php?s=$session[sessionhash]&action=newreply&threadid=$threadid"><img src="$replyclose" border="0" alt="Post A Reply"></a></td>
</tr>
</table>
<!-- /Thread nav and post images -->
__Replace with__
<!-- Thread nav and post images -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%"><smallfont color="#EEEEFF" class="thtcolor"><b>Thread</b></smallfont></td>
<td>$threadbutton</td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td>$replybutton</td>
</tr>
</table>
<!-- /Thread nav and post images -->

__Find__
<td><a href="newthread.php?s=$session[sessionhash]&action=newthread&forumid=$forum[forumid]"><img src="https://vborg.vbsupport.ru/images/newthread.gif" border="0" alt="Post New Thread"></a></td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td><a href="newreply.php?s=$session[sessionhash]&action=newreply&threadid=$threadid"><img src="$replyclose" border="0" alt="Post A Reply"></a></td>
__Replace with__
<td>$threadbutton</td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td>$replybutton</td>

tubedogg
05-16-2002, 07:55 PM
I left off two instructions, for adding the showthread_threadbutton and showthread_replybutton templates. I've updated the instructions file.

cessna140
05-16-2002, 09:40 PM
I finally got it to work with inphinity's help!

Thanks inphinity for sending me the updated code. I thought I was cracking up, I knew there had to be more steps than I had. For some reason I could not download any of the updated versions even though I flushed my cache.

Thank you tubedogg for making the hack, works as advertised!

cessna140
05-17-2002, 03:23 AM
Here is what I get when logged in with permission to post/reply... the normal operation of a thread.

cessna140
05-17-2002, 03:25 AM
This is what I get when visiting without permission to post/reply. The New Thread and Reply buttons are gone from the top but not from the bottom...

tubedogg
05-17-2002, 04:34 AM
You apparently haven't completed this step. That's the only reason why it wouldn't work.
Originally posted by tubedogg
__Find__
<td><a href="newthread.php?s=$session[sessionhash]&action=newthread&forumid=$forum[forumid]"><img src="https://vborg.vbsupport.ru/images/newthread.gif" border="0" alt="Post New Thread"></a></td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td><a href="newreply.php?s=$session[sessionhash]&action=newreply&threadid=$threadid"><img src="$replyclose" border="0" alt="Post A Reply"></a></td>
__Replace with__
<td>$threadbutton</td>
<td><normalfont>&nbsp;&nbsp;</normalfont></td>
<td>$replybutton</td>

inphinity
05-17-2002, 09:01 AM
instructions look fine now :)
cessna140 try clearing your browser's cache and redownloading the instructions.
--
i was just thinking instead of _removing_ the buttons for the majority of boards replacing them with big _register_ buttons would probably be more beneificial for getting users to register ;)

Princeton
05-17-2002, 12:12 PM
inphinity,
Good suggestion :alien:

aidler
06-08-2002, 05:17 PM
Is it confirmed that this hack works with 2.2.6?? I installed the hack and had the following problem: The reply button was gone even for users who have the permission to reply to other's posts.

in addition I use the quick reply box hack and would like to have the quick reply box vanish as well when a user has no permission to post.

aidler
06-14-2002, 10:05 PM
Ok... no reply :angry:

/ UNINSTALL HACK /

Who need's a hack that doesn't work....very disappointing :disappointed:

Chris M
06-15-2002, 02:46 PM
aidler - The Quick Reply Box DOES dissapear when you dont have permission to post...

@The Dissapearing buttons - Are you sure you didnt make an error somewhere?

Nice hack btw...

*installs*

Satan

Birdie501
06-28-2002, 01:09 PM
Originally posted by aidler
Is it confirmed that this hack works with 2.2.6?? I installed the hack and had the following problem: The reply button was gone even for users who have the permission to reply to other's posts.

in addition I use the quick reply box hack and would like to have the quick reply box vanish as well when a user has no permission to post.

hi i still have 2.2.5 and still test my board offline. I also have the same problem. If i am logged in as admin, i see both buttons!
if i log in as user, there is only the new thread button!???
I have the quick reply box installed as well.

What should i do?

i think there is something wrong with this code.

-------------------------------------------------------------------------------------------------------------------
- - - - - - - - - - - - - - - = = = = = = = S H O W T H R E A D . P H P = = = = = = = - - - - - - - - - - - - - - -
-------------------------------------------------------------------------------------------------------------------
__Find around line 468__
updateuserforum($thread['forumid']);

__Right after that add__
// ****** //
$showthreadbutton = 1;
if (!$getperms['canpostnew']) {
$showthreadbutton = 0;
}

$showreplybutton = 1;
if (!$getperms['canreplyown'] or (!$getperms['canreplyothers'] and ($thread['postuserid']!=$bbuserinfo['userid'] or $bbuserinfo['userid'] == 0))) {
$showreplybutton = 0;
}
if (!$thread['open'] == 0 and ($bbuserinfo['userid'] == 0 or $bbuserinfo['usergroupid'] != 6 or !ismoderator($thread['forumid']))) {
$showreplybutton = 0;
}

if ($showthreadbutton == 1) {
eval("\$threadbutton = \"".gettemplate("showthread_threadbutton")."\";");
} else {
$threadbutton = "&nbsp;";
}
if ($showreplybutton == 1) {
eval("\$replybutton = \"".gettemplate("showthread_replybutton")."\";");
} else {
$replybutton = "&nbsp;";
}
// ****** //



Thanks for any help!
:confused:

Birdie501
07-02-2002, 11:57 PM
ok thanks for the help!

But i found a solution for me. I just changed the code of firefly's quick reply box to this:
now it works!

// ****** //

$showthreadbutton = 1;
if (!$getperms['canpostnew']) {
$showthreadbutton = 0;
}

$showreplybutton = 1;
if (($bbuserinfo['userid']!=$thread['postuserid']) and (!$getperms['canviewothers'] or !$getperms['canreplyothers'])) {
$showreplybutton = 0;
} elseif (!$getperms['canview'] or (!$getperms['canreplyown'] and $bbuserinfo['userid']==$thread['postuserid'])) {
$showreplybutton = 0;
} elseif (!$thread['open'] and !ismoderator($thread['forumid'],'canopenclose')) {
$showreplybutton = 0;
} else {
$showreplybutton = 1;
}


if ($showthreadbutton == 1) {
eval("\$threadbutton = \"".gettemplate("showthread_threadbutton")."\";");
} else {
$threadbutton = "&nbsp;";
}
if ($showreplybutton == 1) {
eval("\$replybutton = \"".gettemplate("showthread_replybutton")."\";");
} else {
$replybutton = "&nbsp;";
}
// ****** //

:bandit: