Log in

View Full Version : Simple plugin help?


Rebecca217
10-08-2005, 11:54 PM
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




// 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_critpo ints')));

}



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
$critpoints = $bbuserinfo['credits'];
change to
$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