vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Hide Post Buttons (https://vborg.vbsupport.ru/showthread.php?t=38682)

tubedogg 05-15-2002 10:00 PM

Hide Post Buttons
 
Another small hack, this one requested by cessna140.

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:
Quote:

---------------------------------------------------------------
= = = = = = = 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,

Quote:

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.

Quote:

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
PHP Code:

<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
PHP Code:

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

and in showthread.php i would probably add

PHP Code:

$templatesused .= ',showthread_replybutton,showthread_threadbutton'

just under

PHP Code:

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

$templatesused 'showthread_ratingdisplay,postbit_search,postbit_buddy,postbit_useremail,icq,aim,yahoo,postbit_homepage,postbit_profile,postbit_ip_show,postbit_ip_hidden,postbit,postb
it_sendpm,postbit_avatar,postbit_offline,postbit_online,postbit_editedby,postbit_signature,postbit_attachment,postbit_attachmentimage,showthread_adminoptions,showthread_threadrate,show
thread_pollresults_voted,showthread_pollresults_closed,showthread_firstunread,showthread_nextnewestthread,showthread_nextoldestthread,forumrules,showthread'



cessna140 05-16-2002 04:55 PM

tubedogg,

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


Quote:

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__
Code:

        <!-- 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__
Code:

        <!-- 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__
Code:

                <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__
Code:

                <td>$threadbutton</td>
                <td><normalfont>&nbsp;&nbsp;</normalfont></td>
                <td>$replybutton</td>



All times are GMT. The time now is 03:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01071 seconds
  • Memory Usage 1,768KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (4)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete