vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Simple plugin help? (https://vborg.vbsupport.ru/showthread.php?t=97916)

Rebecca217 10-08-2005 11:54 PM

Simple plugin help?
 
Hello,

I'm trying to port a simple hack over to 3.5. My PHP knowledge is sorely lacking, and I was hoping someone could tell me where I'm going wrong in this code, then point me in the right direction on how to fix it.

Basically, the point of this plugin is:

- Check if the user is in a "critforum." If they aren't in one of the excluded usergroups, then:
- Check how many "critpoints" the user has
- If they have more "critpoints" than $cost, allow them to start a new thread. If not, give the error message


PHP Code:


// CRITIQUE CREDIT HACK - SECTION 1 - hook newthread_start

// Groups Exempted from the critpoint system

$exceptions = array();

// Forums IDs where critpoints apply

$critforums = array(4);

// Critpoint cost of each critique

$cost 2;


$critpoints $bbuserinfo['credits'];

if (
$critpoints $cost && !in_array($vbulletin->userinfo["usergroupid"], $exceptions))

{

eval(
standard_error(fetch_error('not_enough_critpoints')));



I think this is probably very easy, but I don't have the programming knowledge to pull it off. :o I greatly appreciate any help you gurus can offer!

Rebecca

Marco van Herwaarden 10-09-2005 07:17 AM

PHP Code:

$critpoints $bbuserinfo['credits']; 

change to
PHP Code:

$critpoints $vbulletin->userinfo['credits']; 


Rebecca217 10-10-2005 11:59 PM

Excellent, thank you so much! :) It's checking the points correctly now.

One more question: How can I format the code correctly so that it also checks (and only executes on) forums in the $critforums array?

Rebecca

Guest190829 10-11-2005 01:04 AM

This should help

http://us2.php.net/manual/en/function.in-array.php


All times are GMT. The time now is 05:02 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.00933 seconds
  • Memory Usage 1,721KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)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