Random Ranting (195) · Gadgets & Tech (15) · Anime & Otaku (11) · Watches & Horology (46) · Movies & TV (6) · Photography (3)



Latest Posts Recent Comments Comrades


My blog is worth $4,516.32.
How much is your blog worth?


Bug Fixes: FreePress Tagboard

The crappy FreePress Tagboard has been ganked and the original AJAX plugin has replaced it. Even though I fixed a few problems, the FP version simply has too many bugs :S

Wow, this is really tempting me to get into php seriously. Mind you, I haven’t used php properly in a couple years and am very rusty but thanks to it’s ANSI C like syntax I achieved a few things today :D

First up, like an idiot I deleted the ‘FP Tagboard’ place holder post (stored as private) and so the tagboard just wouldn’t work…even if you activate or deactivate the plugin…I’ll later on look to integrate this fix into the plugin!

My fix is as follows,

/*
File: tagboardFix.php
Description: Recreates the 'FP Tagboard' place holder page if you delete it by mistake :p
Author: Michael de Silva
Author URI: http://www.bsodmike.com
Version: 1.0

For used with the Tagboard Widget (http://freepressblog.org/plugins/Tagboard).

// README
Simply place this file in the 'wp-content/plugins/freepress' folder and browse to with your browser (well duh, and it better be firefox!), and it will recreate teh placeholder page!
*/

require( dirname(__FILE__) . '/../../../wp-config.php' );
require_once( dirname(__FILE__) . '/freepressSharedFunctions.php' );

nocache_headers();

$MUblog_ID = trim($_POST['MUblog_ID']);

function fix () {
// NOTE: this depends on users being able to comment on private posts, which doesn't seem right and may change in the future
// If so, switch 'private' to 'static' to use a page instead
$comment_post_ID = fp_insert_newPost('FP Tagboard','This is a placeholder page for the tagboard comments.','private');
update_option('widget_fp_tagboard_postid', $comment_post_ID);

// Default shoutbox color config
add_option('shoutbox_use_textarea','true');
add_option('shoutbox_fade_from', "666666");
add_option('shoutbox_fade_to', "FFFFFF");
add_option('shoutbox_update_seconds', 4000);
add_option('shoutbox_fade_length', 1500);
add_option('shoutbox_text_color', "333333");
add_option('shoutbox_name_color', "0066CC");
add_option('shoutbox_regisitered_only', '0');

$comment_author = 'JaredB';
$comment_author_email = '';
$comment_author_url = 'http://freepressblog.org';
$comment_content = 'Congratulations, your tagboard is now installed!';
$comment_type = '';

$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type');

$comment_id = wp_insert_comment( $commentdata );
return(1);
}

if (fix() == TRUE)
{
echo "Tagboard fixed boss!";
}
else
{
echo "Oops, I think I just wet myself :S";
}
?>

The second fix affects the Tagboard plugin page in the WP Cpanel. It displays this error, which is a known bug,

There have been

WordPress database error: [Table 'bsodmi2_wpdb.wp_liveshoutbox' doesn't exist]
SELECT id FROM wp_liveshoutbox ORDER BY id DESC LIMIT 1

messages in this tagboard

My fix resulted in editing the tagboardWidget.php file,

There have been //$results = $wpdb->get_var(”SELECT id FROM “.$table_prefix.”liveshoutbox ORDER BY id DESC LIMIT 1″);
$commentPostID = intval(fp_GetOption(’widget_fp_tagboard_postid’,0));
$sql = “SELECT comment_ID AS id,comment_date AS time,comment_author AS name,comment_content AS text,comment_author_url AS url,comment_post_ID FROM “.$table_prefix.”comments WHERE comment_post_ID = ‘$commentPostID’ AND comment_approved = ‘1′ ORDER BY comment_ID DESC LIMIT ” . fp_tagboard_getNumberOfComments();
$results = $wpdb->get_results($sql);
echo sizeof($results); ?>
messages in this tagboard

…and you can see the line that I have commented out :D

Related Posts & Articles

  • Xcode 2.4.1 Available on Apple Developer Connection
  • Xcode 2.4.1, a minor update to Xcode 2.4, is available for download on the Apple Developer Connection. Excerpts from the Release Notes are included below. This update is recommended for people using...
  • Reliable DNS Forgery in 2008
  • I am not the original author of this content and have mirrored the original article as found here. It is a result of this discussion at . I am not responsible for the use of this information; it is ...


Google Search


RSS/Meta Articles