Multi-DB and Twitter Tools – writing to the correct database

I’m trying to configure Alex King’s Twitter Tools plugin on my WMPU install, where I have multi-DB also installed.

– The ‘wp_xx_ak_twitter’ table (where xx is the blog number) gets created correctly in the correct database. I verified this in phpMyAdmin.

– BUT the twitter posts are not being written to the database at all.

– I tried it on a both a regular DB blog and a VIP DB blog.

– I can manually copy each tweet into the database via phpMyAdmin, but that’s no fun

To troubleshoot, I tried the plugin on my other WPMU install (no multi-db), and it works fine.

Has anyone else seen this issue? I imagine it’s a simple change to the twitter-tools.php file to get it to write to the correct database.

  • James Farmer
    • Founder & Chair (honest)

    We have twitter tools on edublogs.org (as a single plugin) and it works – but I have to admit that it’s been far from bug free! Also it’s an older version…

    “- I can manually copy each tweet into the database via phpMyAdmin, but that’s no fun”

    Agreed :slight_smile:

  • drmike
    • DEV MAN’s Mascot

    But I want to watch the pretty young animated dancing girls again. :slight_smile:

    Just realized my test bed doesn’t have the multidb installed. Oops.

    Silly dumb question. In the back of my mind, I seem to remember something about $wpdb->prefix not working fully on wpmu. Isn’t something else used now?

    When you say “twitter posts” you mean content coming from twitter that’s trying to be posted on your blogs, right? As posts or digests or both?

  • zipnguyen
    • Flash Drive

    I have a sister-problem to this which is I’ve installed the Twitter Tool by Alex King; everything works as it should whereby, I can post from my blog page or dashboard, which then updates my twitter account and automatically posts on the twitter account, the “Tweet” shows up as a blog post, which is how I set it up in the settings page, BUT it doesn’t show up in the sidebar eventhough the widget is there. In the sidebar is reads, “No tweets available at the moment. More updates here…” And when you click on the “More updates here” part it takes you to my Twitter posts which is correct.

    Has anyone dealt with this problem? you can see my site and blogs at ndcom.com and my test blog is ndcom.com/ninhnguyen

    Thanks all.

  • nickd32
    • The Incredible Code Injector

    @drmike My issue is the same as @zipnguyen’s. I don’t create a new WP post when I post a tweet; rather, I’m just trying to get the tweets to show up in the sidebar via the <?php aktt_latest_tweet(); ?> or the <?php aktt_sidebar_tweets(); ?> functions.

    It seems the root of the problem is that none of the tweets are being written to the database.

  • zipnguyen
    • Flash Drive

    @nickd32. Ok figured out the problem, we’re supposed to install it in wpmu plugins folder and not regular plugin folder AND we used a fixed found on this article: http://sholsinger.com/archive/2009/03/twitter-tools-does-not-display-recent-tweets/

    Now, if you visit my test blog at ndcom.com/ninhnguyen you’ll notice my current tweets show up. So this is our setup and how it works my brother and I installed twitter tools by Alex King (in the correct folder this time), then we configured it so we can post from the dashboard or the blog itself; the posts hit our blog, then show up in the sidebar (by adding the widget); we then installed “twitter to wire” SO NOW, when we post from our blog, it shows up as a blog post (if you want it this way), then it shows up on our twitter accounts, and then makes the roung trip back to our wire.

    So you if you read my test blog at ndcom.com/ninhnguyen you’ll notice that the posts hit the blog as a post AND on the sidebar, and if you go to twitter.com/zipnguyen you’ll see the same posts and if you go to my wire in BuddyPress, you’ll notice that same posts there. It also shows up on the “sitewide activity” in BuddyPress.

    My brother, Dennis, would reply or make a comment to my blog post, then it would show up (as you configure in twitter-tools settings page) on my blog as a comment, then hit twitter as an “@zipnguyen” reply, which then posts to my wire.

    Also, my brother has other blogs (personal and experimental) and when he posts from his blog from ndcom.com it will post the same things on his personal and experimental blogs at http://dennis.webhop.net and http://dennis.webhop.net/mai_tube and this all hits his “wire” on buddypress.

    Talk about “getting the message across…”

    This is pretty cool – and I’d like to mention that I got the autosuggest, youtube, and flickr features from the http://bp-dev.org plugins to work. You can check out my profile see the YouTube aggregation, hit “see all” and you’ll see how the screen goes black and the YouTube vids play; then you can do searches from that lightbox and never leave the buddypress site.

    This is getting exciting!!!!!!!!

    Thanks everyone – I’m glad I can contribute a little something.

  • nickd32
    • The Incredible Code Injector

    @zipnguyen – I tried your solution, but this doesn’t seem to work for me. (Still frustrated… grrr…:wink:

    1. I don’t necessarily want every blog in my wpmu install to be hooked up to Twitter. Only select blogs. That lends itself to installing Twitter Tools in the /plugins/ folder — not the /mu-plugins/ folder.

    2. I tried installing in /mu-plugins/ anyway like you suggested, and it reads the correct table (just like it did when it was installed in /plugins/). However, the main issue persists — The plugin still won’t update the wp_xx_ak_twitter table! All I get are the old tweets I put in manually.

    3. The article you linked to only talks about manually setting up the wp_ak_twitter table. That isn’t the issue, as this table appears to get set up just fine when installed in /plugins/.

    Any help? I’m seriously pulling my hair out here.

  • nickd32
    • The Incredible Code Injector

    OK, just checked my PHP error logs, and here’s a clue:

    [20-Apr-2009 03:44:08] WordPress database error Table
    'wpmu_d.wp_18_ak_twitter' doesn't exist for query
    INSERT INTO wp_18_ak_twitter
    ( tw_id
    , tw_text
    , tw_reply_username
    , tw_reply_tweet
    , tw_created_at
    , modified
    )

    • In this instance, I have blog 18 in a VIP database called ‘wpmu_vip_1’
    • When I activate the plugin, the ‘wp_18_ak_twitter’ table gets created properly in the vip database
    • However, the The multi-db code is telling the plugin to write to the ‘wpmu_d’ database

    Of course, there is no such table in ‘wpmu_d’ so I get the error.

    QUESTION: how can I get the plugin to write to the correct DB ?

  • cagora
    • Flash Drive

    I have lifestream installed, but really wanted to get Twitter Tools up as well so that we can feed into posts.

    I tried the edublogs hack

    https://vvpmudev.com/forums/topic/edublogs-twitter-tools#post-9445

    but keep getting:

    Fatal error: Cannot redeclare aktt_widget() (previously declared in /home/cagorabi/public_html/wp-content/plugins/twitter-tools/twitter-tools.php:906) in /home/cagorabi/public_html/wp-content/plugins/twitter-tools/twitter-tools.php on line 906

    erropr message. Any clues anyone?

  • cagora
    • Flash Drive

    no, it’s quite odd; this plugin and the mybloglog get the same function redeclare issues and i am sure that i have no double plugins, i changed the first function to (function_name)2 just to see and it gives the same error.