SMF 2.0 Manual Install Instructions

Just in case the install package doesn't work for you. For some reason, some people always get FTP Required messages when installing the package.

1. Unarchive the TAR file

The first thing you need to do is unarchive the TAR file. This can be done with several programs, but the most popular are WinRAR and 7-Zip. Extract all the files to a folder on your computer, such as your desktop

2. Copy new files to SMF installation

There are some files that you need to copy to your SMF installation. You'll also need to create the directories that these files go in to. These are:

That's all the files you'll need to copy. Now, for the next step:

3. Database edits.

SMFShop requires some edits to be performed to your SMF database. Luckily, this is automated, so you can't make any mistakes ;)

Simply copy the installScript.php file to your forum's directory. Then run it. For example, if your forum is at http://www.example.com/forum, then you'd go to http://www.example.com/forum/installScript.php. Understand? Good!

 

3. Edit some files

Some of the SMF files need to be edited for SMFShop. Follow the instructions below CAREFULLY, and make backups. Any mistakes you make can affect your forum (stop it working), so be careful! 

Another thing you need to be careful of is whether you need to replace the code you find, or add some more code underneath it. Make sure to read carefully!

OK, let's begin!

Open /index.php

Search for:

'.xml' => array('News.php', 'ShowXmlFeed'),

Add after:

	//Begin Shop MOD 0.2 code
   'shop' => array('shop/Shop.php', 'Shop'),
   'shop_general' => array('shop/ShopAdmin.php', 'ShopGeneral'),
   'shop_inventory' => array('shop/ShopAdmin.php', 'ShopInventory'),
   'shop_items_add' => array('shop/ShopAdmin.php', 'ShopItemsAdd'),
   'shop_items_edit' => array('shop/ShopAdmin.php', 'ShopItemsEdit'),
   //Begin SMFShop MOD 2.0 (Build 8) code
   'shop_restock' => array('shop/ShopAdmin.php', 'ShopRestock'),
   //END SMFShop MOD code 
   //END SHOP MOD

Save and close. Open Sources/RemoveTopic.php

Search for:

			while ($rowMembers = mysql_fetch_assoc($requestMembers))
updateMemberData($rowMembers['ID_MEMBER'], array('posts' => 'posts - ' . $rowMembers['posts']));

Replace with:

			//while ($rowMembers = mysql_fetch_assoc($requestMembers))
// updateMemberData($rowMembers['ID_MEMBER'], array('posts' => 'posts - ' . $rowMembers['posts']));

//BEGIN SMFShop 2.0 (Build 8) MOD code
while ($rowMembers = mysql_fetch_assoc($requestMembers)) {
updateMemberData($rowMembers['ID_MEMBER'], array('posts' => 'posts - ' . $rowMembers['posts']));
global $modSettings;
db_query("UPDATE {$db_prefix}members
SET money = money - {$modSettings['shopPointsPerPost']}
WHERE ID_MEMBER = {$rowMembers['ID_MEMBER']}
LIMIT 1", __FILE__, __LINE__);
//END SMFShop 2.0 code

Search for:

	if (!empty($row['ID_MEMBER']) && $decreasePostCount && empty($row['countPosts']))
updateMemberData($row['ID_MEMBER'], array('posts' => '-'));

Add below:

		//BEGIN SMFShop New Version (Build 8) MOD code
db_query("UPDATE {$db_prefix}members
SET money = money - {$modSettings['shopPointsPerPost']}
WHERE ID_MEMBER = {$row['ID_MEMBER']}
LIMIT 1", __FILE__, __LINE__);
//END SMFShop New Version code

Save and close. Open Subs.php

Search for:

	validateSession();

Add after:

	//Begin Shop MOD 0.2 Code
loadLanguage('Shop');
if (allowedTo('shop_admin'))
$context['admin_areas']['shop'] = array (
'title' => $txt['shop_admin'],
'areas' => array(
'shop_general' => "<a href='$scripturl?action=shop_general'>{$txt['shop_admin_general']}</a>",
'shop_inventory' => "<a href='$scripturl?action=shop_inventory'>{$txt['shop_admin_inventory']}</a>",
'shop_items' => $txt['shop_admin_items'],
'shop_items_add' => "|--- <a href='$scripturl?action=shop_items_add'>{$txt['shop_admin_items_add']}</a>",
'shop_items_edit' => "'--- <a href='$scripturl?action=shop_items_edit'>{$txt['shop_admin_items_edit']}</a>",
//Begin SMFShop 2.0 (Build 8) MOD code
'shop_restock' => "<a href='$scripturl?action=shop_restock'>{$txt['shop_admin_restock']}</a>",
//END SMFShop MOD Code
)
);
//End Shop MOD


Save and close. Open Themes/default/Display.template.php

Search for:

			// Show how many posts they have made.
echo '
', $txt[26], ': ', $message['member']['posts'], '<br />
<br />';

Replace with:

 // Show how many posts they have made.
   //			echo '
   //								', $txt[26], ': ', $message['member']['posts'], '<br />
   //								<br />';
   
   //BEGIN Shop MOD 0.2 Code
   echo '
   ', $txt[26], ': ', $message['member']['posts'], '<br />
   ';
   
   //I couldn't find where all these $message['member'][whatever] variables
   //are set, so I just send an extra database query to get the member's
   //money. Can someone tell me where (file and line) the $message variables
   //are set?
   global $ID_MEMBER, $db_prefix;
   
   $result_money = db_query("SELECT money
   FROM {$db_prefix}members
   WHERE ID_MEMBER = {$message['member']['id']}
   LIMIT 1", __FILE__, __LINE__);
   $row_money = mysql_fetch_array($result_money, MYSQL_ASSOC);
   
   echo $modSettings['shopCurrencyPrefix'].$row_money['money'].$modSettings['shopCurrencySuffix']."<br><br>";
   //END SHOP MOD
   
   
   //BEGIN SMFShop MOD 1.31 (Build 7) CODE
   echo "<a href='$scripturl?action=shop;do=invother2;member={$message['member']['username']}'>View Inventory</a><br>";
   //END SMFShop MOD 1.31 code
 

Save and close. Open Themes/default/index.template.php

Search for:

				<a href="', $scripturl, '?action=calendar">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/calendar.gif" alt="' . $txt['calendar24'] . '" style="margin: 2px 0;" border="0" />' : $txt['calendar24']), '</a>', $context['menu_separator'];
 

Add after:

    //BEGIN Shop MOD 0.2 Code
//BEGIN SMFShop 2.0 (Build 8) MOD Code
loadLanguage('Shop');
//END SMFShop MOD code
echo "<a href='{$scripturl}?action=shop'>", ($settings['use_image_buttons'] ? "<img src='{$settings['images_url']}/{$context['user']['language']}/shop.gif' alt='{$txt['shop']}' style='margin: 2px 0;' border='0' />" : $txt['shop']), "</a>{$context['menu_separator']}";
//END SHOP MOD

Save and close.

There are also some sections that are different, depending on what version of SMFShop you have. The section below is for SMF 1.0 - 1.0.5. If you're using SMF 1.1, then please see the section below it.

 

The below section is for SMF 1.0 - 1.0.5. See under it for SMF 1.1!

 

Open Sources/Post.php

Search for:

$newTopic = true;

Add after:

		//BEGIN SMFShop Shop MOD 1.3 (Build 6) code
$result_shop = db_query("SELECT countMoney
FROM {$db_prefix}boards
WHERE ID_BOARD = $board
LIMIT 1", __FILE__, __LINE__);
$row_shop = mysql_fetch_array($result_shop, MYSQL_ASSOC);

if (isset($row_shop['countMoney']) && $row_shop['countMoney'] == "1") {
$result_shop = db_query("UPDATE {$db_prefix}members
SET money = money + {$modSettings['shopPointsPerTopic']}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);
}
//END Shop MOD code

Search for:

 // They've posted, so they can make the view count go up one if they really want. (this is to keep views >= replies...)
   $_SESSION['last_read_topic'] = 0;
   
   $newTopic = false;

Add after:

		//BEGIN SMFShop Shop MOD 1.3 (Build 6) code
$result_shop = db_query("SELECT countMoney
FROM {$db_prefix}boards
WHERE ID_BOARD = $board
LIMIT 1", __FILE__, __LINE__);
$row_shop = mysql_fetch_array($result_shop, MYSQL_ASSOC);

if (isset($row_shop['countMoney']) && $row_shop['countMoney'] == "1") {
$result_shop = db_query("UPDATE {$db_prefix}members
SET money = money + {$modSettings['shopPointsPerPost']}
WHERE ID_MEMBER = {$ID_MEMBER}
LIMIT 1", __FILE__, __LINE__);
}
//END Shop MOD code

Save and close. Open Sources/ManageBoards.php

Search for:

override_theme' => 0,

Add after:

			//BEGIN SMFShop Shop MOD 1.3 (Build 6) code
'countMoney' => 1,
//END Shop MOD

Search for:

$_POST['override_theme'] = isset($_POST['override_theme']) ? '1' : '0';

Add after:

		//BEGIN SMFShop Shop MOD 1.3 (Build 6) code
$_POST['countMoney'] = isset($_POST['countMoney']) ? '1' : '0';
//END Shop MOD

Search for:

override_theme = $_POST[override_theme]

Add after:

, countMoney = $_POST[countMoney]

Search for:

c.canCollapse

Add after:

, b.countMoney

Search for:

'override_theme' => $row['override_theme'],

Add after:

				//BEGIN SMFShop Shop MOD 1.3 (Build 6) code
'countMoney' => $row['countMoney'],
//END Shop MOD

Save and close. Open Themes/default/ManageBoards.template.php

Search for:

<input type="checkbox" name="override_theme"', $context['board']['override_theme'] ? ' checked="checked"' : '', ' class="check" />
</td>
</tr>';

Add after:

 
    //BEGIN SMFShop Shop MOD 1.3 (Build 6) code
loadLanguage("Shop");
echo ' <tr>
<td>
<b>', $txt['shop_count_points'], '</b><br />
', $txt['shop_count_points_msg'], '<br /><br />
</td>
<td valign="top" align="right">
<input type="checkbox" name="countMoney"', $context['board']['countMoney'] ? ' checked="checked"' : '', ' class="check" />
</td>
</tr>';
//END SHOP MOD
 

End SMF 1.0 section. The below section is for SMF 1.1. See above it for SMF 1.0!

Open Sources/ManageBoards.php

Search for:

'override_theme' => 0,

Add after:

'countMoney' => 1, 

Save and close. Open Sources/Subs-Boards.php

Search for:

	// Should the board theme override the user preferred theme?
if (isset($boardOptions['override_theme']))
$boardUpdates[] = 'override_theme = ' . ($boardOptions['override_theme'] ? '1' : '0');

Add after:

                //BEGIN SMFShop Shop MOD 1.3 (Build 6) code
// Should posts in this board give credits?
if (isset($boardOptions['countMoney']))
$boardUpdates[] = 'countMoney = ' . ($boardOptions['override_theme'] ? '1' : '0');
//End Shop MOD

Search for:

'override_theme' => false,

Add after:

'countMoney' => 1,

Search for:

b.override_theme,

Add after:

b.countMoney,

Search for:

'override_theme' => $row['override_theme'],

Add after:

'countMoney' => $row['countMoney'],

Save and close. Open Themes/default/ManageBoards.template.php

Search for:

<input type="checkbox" name="override_theme"', $context['board']['override_theme'] ? ' checked="checked"' : '', ' class="check" />
</td>
</tr>';

Add after:

    //BEGIN SMFShop Shop MOD 1.3 (Build 6) code
loadLanguage("Shop");
echo ' <tr>
<td>
<b>', $txt['shop_count_points'], '</b><br />
', $txt['shop_count_points_msg'], '<br /><br />
</td>
<td valign="top" align="right">
<input type="checkbox" name="countMoney"', $context['board']['countMoney'] ? ' checked="checked"' : '', ' class="check" />
</td>
</tr>';
//END SHOP MOD
End of SMF 1.1 section.

That's all! Your SMFShop installation should now work! If it doesn't, please feel free to contact me at dan15 --[at]-- tpg [--dot--] com [--dot--] au.