Support Forum

database error Table _sfbuddies

CG Central Geek
Central Geek
Member

Hi,

I’m new here. I have searched the world wide web from top to bottom for the best forum plugin for WP. According to my research and the experience so far, SimplePress seems to be that plugin. Thank you for it.

I am happy to see that the forums here are quite active and interaction is fast, that is nice to see.

I am having one issue so far. I noticed when posting topics there has been a database error message showing up. Then when I tried to add buddies in the PM section, nothing happened. I happened to be looking in the error_log today and found the following. I did a search through the SP files and plugin files and sfbuddies only showed up one time. I don’t know what to make of the following error. Any insight would be greatly appreciated.

Thank you in advance. (I have xxxxx’d the database prefixes.)

WordPress database error Table ‘xxxxxx_sfbuddies’ doesn’t exist for query SELECT buddy_id FROM xxxxxx_sfbuddies WHERE user_id=1 made by require(‘wp-blog-header.php’), wp, WP->main, do_action_ref_array, call_user_func_array, sp_is_forum_page, sp_load_current_user, sp_get_user, spUser->__construct, do_action_ref_array, call_user_func_array, sp_pm_add_to_user_class, spdb_select

19 Answers

New Answer

MP Mr Papa
Mr Papa
Member

Thanks for the kind words!

can you tell me which version of SP and the PM plugin you are using?

CG Central Geek
Central Geek
Member

Hi Mr. Papa,

I downloaded the SP plugin on September 8th it’s version 5.3.1.

I downloaded the PM plugin on September 9th it’s version 2.0.2.

I presume it is the latest release. I just got it set up yesterday.

MP Mr Papa
Mr Papa
Member

odd… can you try deactivating the pm plugin… and then reactivating… see if that will cause the table to get built…

CG Central Geek
Central Geek
Member

I went and deactivated the pm plugin, activated it again and still there is no sfbuddies table in the database. I just checked to verify, it’s not there.

I might add, as a side note, the install instructions on this site say that there is a readme file in the download of the plugin.. I sure couldn’t find it. Can you tell me where it is?

CG Central Geek
Central Geek
Member

I just had a look through the files for the pm plugin.

There is something missing (from what I can tell)

In the sp-pm-plugin.php file, there is the following:

define(‘SPPMBUDDIES’,        SF_PREFIX.’sfbuddies’);

Then in sp-pm-install.php, unlike all of the other defined tables, there is no:

CREATE TABLE IF NOT EXISTS “.SPPMBUDDIES.”

That CREATE TABLE IF NOT EXISTS, is there for every other table but not that one.

In the sp-pm-upgrade.php that instruction does exist.

            CREATE TABLE IF NOT EXISTS “.SPPMBUDDIES.” (
                id bigint(20) NOT NULL auto_increment,
                user_id bigint(20) NOT NULL,
                buddy_id bigint(20) NOT NULL,
                PRIMARY KEY  (id),
                KEY user_idx (user_id),
                KEY buddy_idx (buddy_id)
            ) ENGINE=MyISAM “.spdb_charset().”;”;

 

But it sure is not in the install.php file.

I’m not real good at coding, so I am not going to attempt to code in what should be there. If you could tell me what to place in the code, or provide a corrected sp-pm-install.php file, I will sure be happy to start over with it..

Thanks

YS Yellow Swordfish
Yellow Swordfish
Member

Let me do some research into the code of you will. And I will come back to you.

CG Central Geek
Central Geek
Member

Thanks Yellow Swordfish,

Much appreciated. I hope I am correct in what I think I was seeing there..

YS Yellow Swordfish
Yellow Swordfish
Member

Yes you are and that is my fault for which I apologise. It missed the code scrutiny I am afraid to say. Mainly because we needed to get an update out quickly and this got dragged in with it.

Would you be able to create that table manually – which is all that is needed? Or do you want me to provide a SQL script…?

CG Central Geek
Central Geek
Member

I copied from the upgrade file the script to create the table.

        # need new table for buddies
        $sql = “
            CREATE TABLE IF NOT EXISTS “.SPPMBUDDIES.” (
                id bigint(20) NOT NULL auto_increment,
                user_id bigint(20) NOT NULL,
                buddy_id bigint(20) NOT NULL,
                PRIMARY KEY  (id),
                KEY user_idx (user_id),
                KEY buddy_idx (buddy_id)
            ) ENGINE=MyISAM “.spdb_charset().”;”;
        spdb_query($sql);       

 

And placed it at line 73.

Then I copied and pasted the following

        if (!in_array(SPPMBUDDIES, $tables)) $tables[] = SPPMBUDDIES;

at the new line 216 right under

        if (!in_array(SPPMADVERSARIES, $tables)) $tables[] = SPPMADVERSARIES;

Then I uninstalled the plugin and activated it again. The table is created now. However, sfbuddies and sfadversaries tables have no rows.

I went to the frontend and attempted to add buddies, and noting it happening. The script says that the buddies have been saved, but none show up in either the send PM or the Manage Buddies.

I went back to the db and looked in the table, and there are still no rows in sfbuddies.

I thought maybe the rows might be created upon first use, but that didn’t happen.

I am not quite sure where to look to make the rows created, and to update so that the buddies are actually saved to the database.

Thanks,

 

YS Yellow Swordfish
Yellow Swordfish
Member

Well there are no rows created when you create the table but I will look into whether they are saving OK from the pm compose form and the profile… they certainly were the other day when I last used them…

actually – can you then try and save a buddy in your profile form and then take a look in the forum admin > toolbox > error log to see if there is an appropriate entry about this. You might want to clear the log before you try it actually… less confusing if it starts empty!

CG Central Geek
Central Geek
Member

I did as requested. The only error showing up is the following (repeatedly):

file: xxxxx/wp-content/sp-resources/forum-plugins/problem-with-post-edit-buttonide-poster/sp-hide-poster-plugin.php

line: 229

function: sp_hide_poster_topic_records

Notice | Trying to get property of non-object

 

I think that might be for another thread.

I went to Profile >>Buddies and Adversaries >> Manage Buddies. I entered the display name of the person I wanted to add as a buddy. I clicked “Add New Buddies”. The dropdown showed at the top “Buddies updated”. The name disappeared from the box and the notice is still there that says “You currently have no buddies” frown

I go to the error log in Toolbox and there is still only that one error (above).

I went to Manage Adversaries and picked a user and clicked “Update Adversaries” and it works. I can have enemies, but not friends.. That could be a good thing.. I might even get used to it.. lol laugh

So, the routine for adding Adversaries works, where can I find that routine and then copy it for adding buddies?

I might be able to do that, since I figured out how to copy the other and paste it in..

 

 

YS Yellow Swordfish
Yellow Swordfish
Member

mmm – it is certainly working fine for me on this site and on my test site.
So you have any other forum operations that do not function correctly? Can you try turning on a script console and seeing of there are any scripting errors being reported when you try thius?

CG Central Geek
Central Geek
Member

I need to take care of some other business and will be back in a few hours.

In firebug, I do see some jQuery errors going on. I will check that when I return and report back.

Thanks

AS Adam Smith
Adam Smith
Member

Hey SwordFish,

I’m also receiving the same error using the PM plugin; 

function: sp_pm_add_to_user_class
error: Table ‘ali0708_Service.wp_sfbuddies’ doesn’t exist

SELECT buddy_id FROM wp_sfbuddies WHERE user_id=2

Any quick fixes? The plugin seems to work fine apart from the constant error when pages are refreshed.

Thanks,

Adam.