SMF Links Package for SMF Forum

I replaced the SMF Links Directory Lite package on an SMF Forum with SMF Links by vbgamer45. The latter package allows subcategories for links and works with links that point to non-Windows systems by default, unlike SMF Links Directory Lite, which I had to manually edit to get it to work with links that pointed to websites on Linux and other non-Windows servers, due to the mod's coding that converted the case of links to all lowercase characters - see SMF Links Directory Mod Bug.

When I tried the feature by clicking on Links on a forum webpage, I saw the message below, though:

Unknown column 'l.rating' in 'field list'
File: /home/jdoe/public_html/somedomain/forum/Sources/Links2.php
Line: 206

I checked Links2.php and found the following code on line 206.


$dbresult = $smcFunc['db_query']('', "
                        SELECT 
                                l.ID_LINK, l.rating, l.title,l.date, m.real_name, l.ID_MEMBER, l.description,l.hits 
                        FROM {db_prefix}links AS l 
                        LEFT JOIN {db_prefix}members AS m ON (l.ID_MEMBER = m.ID_MEMBER)  
                        WHERE l.approved = 1 ORDER BY l.rating DESC LIMIT 5");

Since the database prefix I used for the database for the forum was the default smf_, the table that was being used in the database was smf_links as shown by FROM {db_prefix}links. When I looked at the actual table structure, I did not find the fields that Links2.php was expecting. I found the following field names.

id_link
name
description
cat_id
views
author
comments
url
date
approved
total_rages
alexa
pagerank

The database for the forum had the following tables with smf_links in the name.

smf_links
smf_links_bans
smf_links_cat
smf_links_categories
smf_links_catperm
smf_links_comments
smf_links_rating

The prior links package, SMF Links Directory Lite 1.0 had apparently not deleted the tables it created when it was installed when I uninstalled it. I checked the db_links.php file that came with it, which contained code executed when it was installed to see what databases it installed. I saw it created the following databases:

{db_prefix}links
{db_prefix}links_bans
{db_prefix}links_categories
{db_prefix}links_comments

I.e., both that prior links package and the one I just installed, SMF Links, expected to use a table named smf_links. The new links package couldn't create that table with its fields, since the table already existed. It did create the following tables:

smf_links_cat
smf_links_catperm
smf_links_rating

I uninstalled the package and then, using phpMyAdmin, deleted, i.e., "dropped", all of the smf_links and other tables whose names began with smf_links. I then reinstalled the package.

Valid HTML 4.01 Transitional

Created: Sunday, July 31, 2011