Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 12-03-2002, 07:32 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Help with redirect and localdate

Can someone please tell me how to send a redirect message to a user when they try to click on NEW THREAD or POST REPLY in a forum that is not open for posting to registered users? I'd like it to work like it does here at vb.org (i.e. the following):

Sorry! This forum is not accepting new posts.

I have a forum set up for a program hints, tips and tricks and the only ones allowed to post there are the mods of the forum and the Admin and Supermod. It is an information forum only.

Also, can you please also tell me how to get the users date (offset according to time offset and day of the week to display in $timezone.

I guess I've been away a little too long. This is elementary stuff, I know.
Reply With Quote
  #2  
Old 12-03-2002, 03:59 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmm, not sure if i understood right

open newreply.php find
PHP Code:
if (($bbuserinfo['userid']!=$threadinfo['postuserid'] or $bbuserinfo['userid']==0) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
  
show_nopermission();

change it to:
PHP Code:
if (($bbuserinfo['userid']!=$threadinfo['postuserid'] or $bbuserinfo['userid']==0) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
  if(
$threadinfo['forumid'] != xx
  {
    
show_nopermission();
  } else {
    eval(
"standarderror(\"".gettemplate("error_cannotposthere")."\");");
  }

then create a template error_cannotposthere with the wanted text..
and replace the xx with the special forumid
Reply With Quote
  #3  
Old 12-03-2002, 05:40 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you Stefan, that is exactly what I was looking for. You have once again been proven to be "The Man!"

How can I do it for multiple threads? I have about 6 I need it for right now. Also, I need to do it for the newthread, too. Would that be the same code?
Reply With Quote
  #4  
Old 12-03-2002, 06:02 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Stefan, is this the code I need for the newthread.php? I wanted to run it by you to make sure I did it right?

find (first instance of code):

Code:
   $permissions=getpermissions($forumid);
    if (!$permissions[canview] or !$permissions[canpostnew]) {
			show_nopermission();
    }
change it to:

Code:
 $permissions=getpermissions($forumid);
    if (!$permissions[canview] or !$permissions[canpostnew]) {
    if($foruminfo['forumid'] != 13)
     {
        show_nopermission();
      } else {
       eval("standarderror(\"".gettemplate("error_cannotposthere")."\");");
      }
    }
Reply With Quote
  #5  
Old 12-04-2002, 11:44 AM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

last one first

PHP Code:
$permissions=getpermissions($forumid);
    if (!
$permissions[canview] or !$permissions[canpostnew]) {
    if(
$forumid != 13)
     {
        
show_nopermission();
      } else {
       eval(
"standarderror(\"".gettemplate("error_cannotposthere")."\");");
      }
    } 
$forumid can be used here as you can see in the first line of the block but then its correct

so, first one now
do you mean do it by multiple threads or multiple forums?

forums:

instead of this
PHP Code:
if($threadinfo['forumid'] != xx
use this:
PHP Code:
if(!in_array($threadinfo['forumid'], array(xxyyzz)) 
for threads just change the forumid by threadid
replace xx, yy and zz
Reply With Quote
  #6  
Old 12-04-2002, 06:13 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you again, sir. I got a parser error at first but got it figured out. There needed to be another right bracket at the end of the line.

Code:
if(!in_array($threadinfo['forumid'], array(xx, yy, zz))
I want to be sure I have this right now. Here's what I ended up with:

for newreply.php:

PHP Code:
$permissions=getpermissions($threadinfo[forumid]);
if ((
$bbuserinfo['userid']!=$threadinfo['postuserid'] or $bbuserinfo['userid']==0) and (!$permissions['canviewothers'] or !$permissions['canreplyothers'])) {
  if(!
in_array($threadinfo['forumid'], array(13153,4,5,6,7,8)))
  {
    
show_nopermission();
  } else {
    eval(
"standarderror(\"".gettemplate("error_cannotposthere")."\");");
  }

and for newthread.php:

PHP Code:
$permissions=getpermissions($forumid);
    if (!
$permissions[canview] or !$permissions[canpostnew]) {
    if(!
in_array($forumid, array(13153,4,5,6,7,8)))
     {
        
show_nopermission();
      } else {
       eval(
"standarderror(\"".gettemplate("error_cannotposthere")."\");");
      }
    } 
and for threads instead of forums, it would be:

newreply.php

PHP Code:
if(!in_array($threadinfo['threadid'], array(13153,4,5,6,7,8))) 
right? Is there a limit to the amount of forum or thread IDs you can have in the one array statement?

And thank you again, Stefan.
Reply With Quote
  #7  
Old 12-04-2002, 08:17 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes alright so

ups, forgot a bracket *gg*

no there is no limit there

threads in newthread.php
think that's a bit impossible
Reply With Quote
  #8  
Old 12-04-2002, 08:43 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You're right, my mistake. I guess I just got so caught up in it, I wasn't thinking again. On doing threads, I would have no need to worry about the forums array. I edited the post above. Thanks again for all of the help in this.
Reply With Quote
  #9  
Old 12-05-2002, 01:10 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default


np, you're welcome as always
Reply With Quote
  #10  
Old 12-05-2002, 02:22 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can I ask another favor?

This is from the first message:

Quote:
Also, can you please also tell me how to get the users date (offset according to time offset and day of the week to display in $timezone.
I'd like it to show up like:

7:33 am on Saturday, Dec 7, 2002

or something to that effect. I don't know about anyone else, but since the twins arrived 3 weeks ago, I don't know what day it is or even the time, most of the time, anymore. But only in a good way, you know what I mean?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:27 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.04552 seconds
  • Memory Usage 2,288KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (8)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete