i running ipb , using plugin called ibeconomy, after user purchases , award shop , uses error. warning: illegal string offset 'error' /ibeconomy/sources/shop_items/award_item.php on line 196.
if ( ! $returnme['error'] )
here code, i'm not sure going on.
/** * (e34) ibeconomy * shop item: award item */ if ( ! defined( 'in_ipb' ) ) { print "<h1>incorrect access</h1>you cannot access file directly. if have upgraded, make sure upgraded relevant files."; exit(); } class class_shop_item implements ibeconomy_shop_item { protected $registry; protected $db; protected $settings; protected $request; protected $lang; protected $member; protected $cache; /** * class entry point */ public function __construct( ipsregistry $registry ) { $this->registry = ipsregistry::instance(); $this->db = $this->registry->db(); $this->settings =& $this->registry->fetchsettings(); $this->request =& $this->registry->fetchrequest(); $this->lang = $this->registry->getclass('class_localization'); $this->member = $this->registry->member(); $this->memberdata =& $this->registry->member()->fetchmemberdata(); $this->cache = $this->registry->cache(); $this->caches =& $this->registry->cache()->fetchcaches(); } //*************************// //($%^ admin stuff ^%$)// //*************************// /** * send "stock" title */ public function title() { return $this->lang->words['award_item']; } /** * send "stock" description */ public function description() { return $this->lang->words['award_description']; } /** * need pick self or others applicable? */ public function otherorself() { return true; } /** * send settings */ public function extra_settings() { $itemsettings = array( 0 => array( 'form_type' => 'formdropdown', 'field' => 'si_extra_settings_1', 'words' => $this->lang->words['which_award'], 'type' => 'awards' ), 1 => array( 'form_type' => 'formmultidropdown', 'field' => 'si_protected_g', 'words' => $this->lang->words['protected_groups'], 'desc' => $this->lang->words['cannot_be_done_to_groups'], 'type' => 'groups' ), 2 => array( 'form_type' => 'forminput', 'field' => 'si_extra_settings_2', 'words' => $this->lang->words['reason_for_award'], ) ); return $itemsettings; } //*************************// //($%^ public stuff ^%$)// //*************************// /** * using item html */ public function usingitem($theitem) { $itemhtml = array(); #need member name input? if ( $theitem['si_other_users'] ) { $itemhtml[] = array('text' => $this->lang->words['input_member_name'], 'inputs' => "<input type='text' size='30' name='mem_name' id='mem_name1' />"); if ( $theitem['si_allow_user_pm'] ) { $itemhtml[] = array('text' => $this->lang->words['input_message']."<br /><span class='desc'>{$this->lang->words['optional_message']}</span>", 'inputs' => "<textarea size='50' cols='40' rows='5' wrap='soft' name='message' id='message' class='multitext'></textarea>"); } } return $itemhtml; } /** * use item */ public function useitem($theitem,$myportitem) { #init $returnme = ''; $memname = $this->request['mem_name']; $usrmessage = trim(ipstext::gettextclass( 'bbcode' )->stripbadwords( $this->request['message'] )); $msg2send = ''; #no member? if ( $theitem['si_other_users'] ) { #input? if ( !$memname ) { $returnme['error'] = $this->lang->words['no_member_entered']; } else { #load item recipient $damember = ipsmember::load( $memname, 'all', 'displayname' ); } #no 1 found? if ( !$returnme['error'] && !$damember['member_id'] ) { $returnme['error'] = $this->lang->words['no_member_found_by_id']; } #your own self, when not allowed? if ( !$returnme['error'] && $damember['member_id'] == $this->memberdata['member_id'] ) { $returnme['error'] = $this->lang->words['item_cannot_be_done_on_self']; } #member in protected group? if ( !$returnme['error'] && in_array( $damember['member_group_id'], explode(',', $theitem['si_protected_g']) ) ) { $returnme['error'] = $this->lang->words['member_in_protected_group']; } #send message item use? if ( $theitem['si_allow_user_pm'] && $usrmessage != "" ) { $msg2send = $usrmessage; $sender = $this->memberdata['member_id']; } else if ( trim($theitem['si_default_pm']) != "" ) { $msg2send = trim($theitem['si_default_pm']); } } else { $damember = $this->memberdata; } #reason "award" , award? $reason = $theitem['si_extra_settings_2']; $catandawardid = explode('_', $theitem['si_extra_settings_1']); if ($this->settings['awds_system_status'] === '0' || $this->settings['awds_system_status'] === '1') { $award = $this->db->buildandfetch( array( 'select' => '*', 'from' => 'inv_awards', 'where' => 'id = ' . $catandawardid[1], ) ); $awardname = $award['name']; } else { $awardname = $this->caches['awards_cat_cache'][ $catandawardid[0] ]['awards'][ $catandawardid[1] ]['awards_name']; } #no errors, use it! if ( ! $returnme['error'] ) { #use $this->douseitem($damember['member_id'], $reason, $theitem['si_extra_settings_1']); #send pm if ( $msg2send != '' ) { $title = sprintf( $this->lang->words['shop_item_used_on_you'], $theitem['si_title'] ); $this->registry->ecoclass->sendpm($damember['member_id'] , '', 0, '', 'generic', $msg2send, $title, $sender, $awardname ); } #finish $this->registry->ecoclass->finishupitemuse($theitem,$myportitem,$damember['members_display_name'] != $this->memberdata['members_display_name'] ? $damember['members_display_name'] : ''); #add redirect text $returnme['redirect_text'] = $this->lang->words['item_has_been_added'] ; } return $returnme; } /** * use item execution */ public function douseitem($member_id, $awards_reason, $awardidandcat) { #add "award" mid's profile. $awarder_id = ($member_id != $this->memberdata['member_id']) ? $this->memberdata['member_id'] : $this->settings['eco_shopitems_pm_sender']; $app_cache = $this->cache->getcache('app_cache'); $pinawards = $app_cache['awards']; $jawards = $app_cache['jawards']; #get reason ready parsing ipstext::gettextclass('bbcode')->parse_html = 0; ipstext::gettextclass('bbcode')->parse_nl2br = 1; ipstext::gettextclass('bbcode')->parse_smilies = 1; ipstext::gettextclass('bbcode')->parse_bbcode = 1; ipstext::gettextclass('bbcode')->parsing_section= 'awards_reason'; $awards_reason = ipstext::gettextclass('bbcode')->predbparse( $awards_reason ); $lang = $this->lang->words['awards_system_give']; $awarded_date = date('y-m-d h:i:s'); #get award id of award being given #explode $awards_action around '_' $action_array = explode('_',$awardidandcat); $cat_id = $action_array[0]; $award_id = $action_array[1]; //which awards system using? inv perhaps? if ($jawards['app_enabled']) { if(!$this->registry->isclassloaded('admin_jawards_functions')) { require_once( ipslib::getappdir( 'jawards' ) . "/sources/classes/jawards/class_jawards.php" ); require_once( ipslib::getappdir( 'jawards' ) . "/sources/classes/jawards/admin_jawards_functions.php" ); $classtoload = ipslib::loadlibrary( ipslib::getappdir( 'jawards' ) . "/sources/classes/jawards/admin_jawards_functions.php", "admin_jawards_functions", 'jawards' ); $this->registry->setclass( 'admin_jawards_functions', new $classtoload( $this->registry ) ); } $this->registry->getclass('admin_jawards_functions')->giveaward($award_id, $member_id, $awards_reason); } //nope, using pin else { if(!$this->registry->isclassloaded('classawards')) { require_once( ipslib::getappdir( 'awards' ) . "/sources/classes/classawards.php" ); $classtoload = ipslib::loadlibrary( ipslib::getappdir( 'awards' ) . "/sources/classes/classawards.php", "class_awards", 'awards' ); $this->registry->setclass( 'classawards', new $classtoload( $this->registry ) ); } $this->registry->getclass( 'classawards' )->addaward($award_id, $member_id, $awarder_id, $awards_reason); } } }
you initialized $returnme empty string, you're trying use associative array. should initialize empty array. change line:
$returnme = ''; to:
$returnme = array();
Comments
Post a Comment