I am not a coder...suck at it and this code is rather bad. However incase anyone wants to improve or if it gives ideas here you go:
I downloaded the awards mod from the SMF website
http://custom.simplemachines.org/mods/index.php?mod=475. This allows the admin to assign awards to users. I created (again rather poorly written) an item in my smfshop. It allows users to purchase an award. I set the quantity to 1 to make them rare.
Code Below:
<?php
if (!defined('SMF'))
die('Hacking attempt...');
class item_ninjapirate extends itemTemplate
{
function getItemDetails()
{
$this->authorName = 'Swiftburn';
$this->authorWeb = 'http://www.lanaholics.org/';
$this->authorEmail = 'swiftburn@lanaholics.org';
$this->name = 'Ninja Pirate Award';
$this->desc = 'Give yourself the Ninja Pirate Award';
$this->price = 17250;
$this->require_input = false;
$this->can_use_item = true;
$this->addInput_editable = false;
}
function onUse()
{
global $db_prefix, $ID_MEMBER, $item_info;
$today = date("Y-m-d");
srand ((double) microtime() * 1000000);
$random_number = rand(1000,9999);
db_query("
INSERT INTO {$db_prefix}awards_members
(ID_AWARD_MEMBER, ID_AWARD, ID_MEMBER, dateReceived, favorite)
VALUES('{$random_number}{$ID_MEMBER}', '[color=red]8'[/color], '{$ID_MEMBER}', '{$today}', '0' ) ")
// WHERE ID_MEMBER = {$ID_MEMBER}", __FILE__, __LINE__)
or die(mysql_error());
return 'Successfully Awarded Medal';
}
}
?>
You have to change the red 8 to the item number of your medal. Putting th emouse over each medal gives you the ID. The award mod requires a random number for ID_AWARD_MEMBER so i used a crude randomizing script. Again this code is bad and so-so just wanted to post to give people ideas. Cheers and thanks for all the items everyone posted they are great. Oh and the SMF Shop is great too !