vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Help with redirect and localdate (https://vborg.vbsupport.ru/showthread.php?t=46332)

Boofo 12-03-2002 07:32 AM

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. :)

Xenon 12-03-2002 03:59 PM

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 ;)

Boofo 12-03-2002 05:40 PM

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?

Boofo 12-03-2002 06:02 PM

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")."\");");
      }
    }


Xenon 12-04-2002 11:44 AM

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

Boofo 12-04-2002 06:13 PM

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. :)

Xenon 12-04-2002 08:17 PM

yes alright so :)

ups, forgot a bracket *gg*

no there is no limit there

threads in newthread.php
think that's a bit impossible ;)

Boofo 12-04-2002 08:43 PM

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. ;)

Xenon 12-05-2002 01:10 PM

:)
np, you're welcome as always :)

Boofo 12-05-2002 02:22 PM

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? :)


All times are GMT. The time now is 11:20 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.02580 seconds
  • Memory Usage 1,769KB
  • 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
  • (3)bbcode_code_printable
  • (8)bbcode_php_printable
  • (1)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