![]() |
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. :) |
hmm, not sure if i understood right
open newreply.php find PHP Code:
PHP Code:
and replace the xx with the special forumid ;) |
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? |
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); Code:
$permissions=getpermissions($forumid); |
last one first ;)
PHP Code:
so, first one now do you mean do it by multiple threads or multiple forums? forums: instead of this PHP Code:
PHP Code:
replace xx, yy and zz |
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)) for newreply.php: PHP Code:
PHP Code:
newreply.php PHP Code:
And thank you again, Stefan. :) |
yes alright so :)
ups, forgot a bracket *gg* no there is no limit there threads in newthread.php think that's a bit impossible ;) |
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. ;)
|
:)
np, you're welcome as always :) |
Can I ask another favor? :)
This is from the first message: Quote:
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? :) |
oh, congratulations, if i understand that right :)
hmm, you have to use the vbdate function and then just use the normal datefunction syntax for it, it'll automatically checks the timezone of a user and so on.. |
Quote:
You understood ir tight. Twins boys. :) And thank you for the congratulations. Quote:
Code:
$post['localtime'] = date($timeformat, time()+($post['timezoneoffset']-$timeoffset)*3600); |
things you want to show up in every post belong to functions.php
section getpostbit ;) |
Is the code above correct for getting the day? Putting it there won't work for the forumhome page though, will it?
|
$post['localday'] = date("D", time()+($post['timezoneoffset']-$timeoffset)*3600);
would be correct for displaying for Example "Sun" |
Ahhh, ok, I see now. The D is just the php code for how you want the day to show up. That's pretty simple. I should have known that one. See what happens when you are away too long? :) Last question, I figured out that to have it show up on the forumhome, I need to put it in the index.php file. Can you tell me where it would need to go in there, please? Or is there a way to include it in the timezone variable?
|
as you don't need it anywhere else, jsut put it before this line:
PHP Code:
|
I'd like to be bale to do it globally for all of the timezone variables on all of the pages. Can it be done that way?
|
you can just change the standart date/time format in vb-options for that...
|
Sorry about this. :) I'm not explaining myself very well. I don't want all of the date and times like that, only for the forumhome timezones that are also at the bottom of each page. The Forums and Threads listings would be too long with all of that.
|
ahh i see what you mean now ;)
open global.php find PHP Code:
|
Thank you. Now all I need to know is how you mean the "format string". Do I need to set it up somewhere else first? I'm sorry to sound so simple on this, but it has me totally baffled. :)
|
instead of $timeformat use this (f.e.) string:
PHP Code:
|
Ok, but will that work according to the users offset?
|
yes it will, because vbdate function is used ^^
|
Thank you, it worked. here's what I have now:
Code:
$timenow=vbdate("g:i a, D, M j, Y",time()); 12:22 pm on Sun, Dec 8, 2002. instead of: 12:22 pm, Sun, Dec 8, 2002. |
hmm, try this one:
PHP Code:
|
Perfect! Worked like a charm. Thank you very much, kind sir. :)
I need to ask, though, what are the 2 periods for in the code? |
well, you have to divide the code, because the formatstring would be converted into numbers or other things
vbdate("g:i a", time()) gives out: "12:22 pm" . " on " . adds the " on " to the string and vbdate("D, M j, Y",time()); adds the "Sun, Dec 8, 2002" |
Ahh, ok, that makes sense now. Would it also work like this?
$timenow=vbdate("g:i a", time())." on ".vbdate("D, M j, Y",time()); or do the spaces have to be there, too? |
yes it would also work, spaces are just visual, it's like the vb3 coding structure i try to implement to my mind ;)
|
All times are GMT. The time now is 04:18 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|