Ahhh! I see
} elseif ($_GET['do'] == "senditems") {
Thats line 966. If you use any good text editor, it can display line numbers. Looking at that line, as well as line 964
}
You'll see you ended the last elseif statment twice, in effect ending the larger function. When it then can across another elseif it didn't know what to do.
Anyways, there were a few errors in my coee. Should look like
elseif($_GET['do'] == "senditems") {
$context['linktree'][] = array(
'url' => "$scripturl?action=shop;do=senditems",
'name' => $txt['shop_send_money'],
);
$context['shop_trade_items'] = "";
$result = db_query("SELECT it.name, inv.id AS ivid, inv.trading
FROM {$db_prefix}shop_inventory AS inv, {$db_prefix}shop_items AS it
WHERE inv.ownerid = {$ID_MEMBER} AND inv.itemid = it.id AND inv.trading = 0
GROUP BY it.id
ORDER BY it.name ASC ", __FILE__, __LINE__);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
$context['shop_trade_items'] .= "
<option value ={$row['ivid']}>{$row['name']}</option>";
}
$context['sub_template'] = "sendItems";
loadTemplate('Shop');
} elseif($_GET['do'] == "senditems2") {
$context['linktree'][] = array(
'url' => "$scripturl?action=shop;do=senditems2",
'name' => $txt['shop_send_money'],
);
$result = db_query("SELECT ID_MEMBER
FROM {$db_prefix}members
WHERE memberName = '{$_POST['membername']}'", __FILE__, __LINE__);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$newowner = $row['ID_MEMBER'];
$result = db_query("SELECT ownerid, itemid
FROM {$db_prefix}shop_inventory
WHERE id = '{$_POST['giftid']}'", __FILE__, __LINE__);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$itemid = $row['itemid'];
if ($row['ownerid'] !== $ID_MEMBER) {
die($txt['shop_use_others_item']);
}
else {
$result = db_query("UPDATE {$db_prefix}shop_inventory
SET ownerid = $newowner
WHERE id = '{$_POST['giftid']}'", __FILE__, __LINE__);
$context['shop_buy_message'] = "Item succesfully transfered!";
$result = db_query("SELECT name
FROM {$db_prefix}shop_items
WHERE id = {$itemid}", __FILE__, __LINE__);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$name = $row['name'];
$result = db_query("SELECT memberName
FROM {$db_prefix}members
WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__);
$row = mysql_fetch_array($result, MYSQL_ASSOC);
$target = $row['memberName'];
$pmfrom = array(
'id' => '1',
'name' => 'Clucky',
'username' => 'Clucky'
);
$pmto = array(
'to' => array($newowner),
'bcc' => array()
);
sendpm($pmto, 'You have been sent an item!', "{$target} has sent you an {$name}. Isn't that nice of them? [i]You do not need to reply to this automated message[/i]", 0, $pmfrom);
}
$context['sub_template'] = "message";
loadTemplate('Shop');
}
Basically the .= adds stuff on. So if $dog was the string "Puppy" then $dog .= "dog" would make $dog "Puppydog". We need this to get the drop down menu to work, but I forgot to set the varaible equal to the null string before hand. While the code read fine and all that, it isn't a really good thing to do and generated an error in the logs ever time you tried to send items.