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 conditional that requires min. post count and min. number days registered (https://vborg.vbsupport.ru/showthread.php?t=270708)

TROLL 09-22-2011 03:43 AM

Help with conditional that requires min. post count and min. number days registered
 
Hello, hopefully someone familiar with PHP can help me with what is likely a very simple question...

I am using the Easy Forms modification to standardize my Classifieds section which has been working great. This modification has a field for "Form Hook: Form Start:" which I am trying to utilize with a conditional to filter who may start a thread in my classifieds section.

I am looking to allow new threads to be posted by users who both:
1) have 30 posts or more
2) have been registered for 30 days or more

I am looking to not allow new threads to be posted by users who either:
1) have less than 30 posts
2) have been registered for less than 30 days

The code I was trying to use (and is incorrect) is:
PHP Code:

if($vbulletin->userinfo['posts'] < 30 OR $vbulletin->userinfo['joindate'] < TIMENOW - (86400 30))
{
$errormessage "You do not have permission to create a thread in the Personal Marketplace because you need a post count of at least 30 and to have been a member for at least 30 days to create a thread here.";
eval(
'print_output("' fetch_template('STANDARD_ERROR') . '");');


My guess is that this is identifying users who have less than 30 posts correctly, but it is identifying users who have been registered for more than 30 days? I am not sure, but it is blocking members who meet both of my desired terms so I know that I have it wrong somewhere.
Can someone take a look and let me know what I have mixed up here? Unfortunately my PHP knowledge is limited so I can't figure it out solo.

Thanks a lot,
Bryan

kh99 09-22-2011 05:46 AM

"Registered less than 30 days" would be $vbulletin->userinfo['joindate'] greater than TIMENOW - (86400 * 30), not less than.

TROLL 09-22-2011 11:52 PM

thank you sir, i just applied that change to my site


All times are GMT. The time now is 03:28 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.00917 seconds
  • Memory Usage 1,715KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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