vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   TIMENOW in Plugins (https://vborg.vbsupport.ru/showthread.php?t=281709)

SnakeV 04-18-2012 01:10 AM

TIMENOW in Plugins
 
Hello,

I have the following code on hook threadfpdata_presave:

Code:

if($vbulletin->userinfo['joindate'] > TIMENOW - (86400 * 1))
{
        $this->set('visible', 0);
}

However the if statement doesn't not want to work, i have a similar if on editpost_start and works perfect, but on this other hook doesn't want to work. How can i workaround this?

Thanks

kh99 04-18-2012 01:21 AM

I think this should work:

Code:

if($this->registry->userinfo['joindate'] > TIMENOW - (86400 * 1))
{
        $this->set('visible', 0);
}


SnakeV 04-18-2012 01:45 AM

Thanks, it works great!

I was also trying to put an if in the same plugin for check forumid i used if ($foruminfo['forumid'] == 4) and if ($threadinfo['forumid'] == 4) but it doesn't want to work. Any Idea?

Thank you again.

Pandemikk 04-18-2012 02:24 AM

Those variables might not be in scope.

Use global and see if they're there.

SnakeV 04-18-2012 04:19 PM

It looks like that it's not available in this hook, what i can do for get it working?

Thanks

---

Got it working with: if ($GLOBALS['forumid'] == X)

Pandemikk 04-18-2012 07:27 PM

I would recommend not using $GLOBALS.

Try using global $forumid;

Does that give the same result?

Zachery 04-18-2012 09:49 PM

I don't see whats wrong with using the superglobal array.

Pandemikk 04-18-2012 11:01 PM

Same reason you should use the input cleaner instead of their respective superglobals.

Zachery 04-19-2012 12:57 AM

Yours is the same thing, to my basic understanding, it just requires more lines. That bit should have already been passed though a cleaner, and he isn't taking any real user input, just checking if it is X. That data isn't going into the database.


All times are GMT. The time now is 04:04 PM.

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.01002 seconds
  • Memory Usage 1,718KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete