Author Topic: Item that PMs Script Not Working  (Read 1964 times)

Bookworm

  • Guest
Item that PMs Script Not Working
« on: February 05, 2008, 06:24:10 am »
Hi,

I have written a script that PMs me with information a user enteres into a text box. The idea is that the users can purchase items for a separate game I run, which I will then add to their accounts. There are no errors as far as I can see, but I'm getting this error: 'ERROR: Could not create instance of 'pmitem' item!' at the add/edit/delete screen. I'm using SMF 1.1.1 and Shop 3.0.

Here's my code:

Code: [Select]
<?php

/**********************************************\
| SMFSHOP (Shop MOD for Simple Machines Forum) |
|         (c) 2006 DanSoft Australia           |
|      http://www.dansoftaustralia.net/        |
\**********************************************/

//An item which notifies me that someone wants something...
//Created by Bookworm... not related to DanSoft at all. Really. Seriously.

//wsgp can be exchanged for any item name
class item_wsgp extends itemTemplate {
    
    function 
getItemDetails() {
    

//iiiittt's me! Don't change please.
$this->authorName "Bookworm";
$this->authorEmail "bookworm9405@gmail.com";

          
// The name of the item
          
$this->name "1,000,000 Gold Coins";
          
          
// The item's description
          
$this->desc "Gives the account of your choosing 1 million WorldScape coins!";
          
          
// The item's price
          
$this->price 100000;

        
//UNCHANGABLE VALUES:
          // Whether inputs are required by this item. In this case, we get some inputs,
          // so set this to 'true'.
          
$this->require_input true;
          
$this->can_use_item true;
    } 

//People can decide who to give the item too
//Makes for a lovely birthday gift!
    
function getUseInput() {
        return 
"To what user would you like send this reward? <input type='text' name='question' />";
$useraccount $_GET["question"];
    }

//Now, the item order is PMed to mineself (well,
//user account one on the forums... which is usually
//that forum's admin). 
      
function onUse() {
      

      
//SMF variables galore
        
global $db_prefix$ID_MEMBER$item_info$user;

        
//Who the PM will be sent from
        
$pmfrom = array(
            
'id' => 1,
            
'name' => '1mil GP Request',
            
'username' => 'Item Requsition Request'
        
);
        
        
//who the PM will be sent to (user 1, thaat's me)
        
$pmto = array(
            
'to' => array(1), 
            
'bcc' => array()
        );
        
        
//What the PM's gonna say to me
$message_array = array("{$user} has purchased 1mil coins for the account {$useraccount}");

//Now let's actually send the PM
sendpm($pmto'Item Request'$message_array 0$pmfrom);

//That's all, folks.
}}

?>


Offline Daniel15

Re: Item that PMs Script Not Working
« Reply #1 on: February 15, 2008, 07:08:02 am »
Quote
class item_wsgp
The item filename needs to be the same as the last bit of the class name. So, either rename the file to wsgp.php, or change that line to class item_pmitem