Database Error with Chat Plugin resulting in a bug in the admin area?

I installed the latest Chat plugin and suddenly when I activate it, I am not able to add any link in any post anymore. The input fields and checkboxes simply are unresponsive. I had a look at the server log and found there are several db errors. Even I can't think why this should have an effect on the general post edit field, the chat plugin is the one that breaks it.
Here is one of the errors I see in the log:

FastCGI: server "/var/run/hcgi/400458" stderr: WordPress-Database-Error Duplicate key name 'last_polled' f\xc3\xbcr Abfrage ALTER TABLE wp_wpmudev_chat_users ADD KEYlast_polled(last_polled) von activate_plugin, do_action('activate_wordpress-chat/wordpress-chat.php'), call_user_func_array, WPMUDEV_Chat->install, dbDelta, referer: http://www.zauber-kreis.ch/wp/wp-admin/admin.php?page=wpmudev-plugins

  • Paul
    • The Green Incsub

    @Charltan,

    Have you tried deactivate then activate the plugin? Do you still see the error? If the error is still there I advise you to get into your host CPanel and manually drop the database table. Then when you reactivate the plugin it will be recreated.

    Had you installed any of the earlier Chat 2.0 beta versions?

  • Paul
    • The Green Incsub

    Even I can't think why this should have an effect on the general post edit field, the chat plugin is the one that breaks it.

    Honestly I don't know how this would break the other options. But then again the Chat does a lot of AJAX calls even in wp-admin. Try going to your User profile. There are some options at the bottom where you can disable Chat within wp-admin

  • Charltan
    • Site Builder, Child of Zeus

    Hi Paul
    Yes, I suspect there are several small DB problems (the wp_options table is huge!). But if you invested many hours of work to adjust everything, you don't want to make a clean install and start all over (when possible).
    Yes, I deactivated/deleted the plugin, dropped the chat tables in phpMyAdmin and even the chat entries in other tables, and made a clean install. Didn't help.
    And yes: I had a pre 2 installation of the chat plugin installed.

  • Paul
    • The Green Incsub

    @Charltan,

    Hmm. So when you activate the plugin manually it will load an option from the wp_options table to check if the database needs to be updates.

    Try running the following.

    SELECT * FROM wp_options WHERE option_name LIKE 'wpmudev-chat-version'

    The version returned should be '2.0'. This is most current value. Since the DB structure has not changed since the initial 2.0 release. If the option version is less '2.0' this will run the dbDelta comment to update the database tables. Once the db update runs it sets the wp_option value to the current, again '2.0'.

    Optionally you can manually run the SL to create the table

    CREATE TABLE wp_wpmudev_chat_users (
      	<code>blog_id</code> bigint(20) unsigned NOT NULL,
      	<code>chat_id</code> varchar(40) NOT NULL,
      	<code>auth_hash</code> varchar(50) NOT NULL,
      	<code>name</code> varchar(255) NOT NULL,
      	<code>avatar</code> varchar(255) NOT NULL,
      	<code>moderator</code> varchar(255) NOT NULL,
      	<code>last_polled</code> timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
      	<code>entered</code> timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
      	<code>ip_address</code> varchar(39) NOT NULL DEFAULT '',
      	PRIMARY KEY (<code>blog_id</code>,<code>chat_id</code>,<code>auth_hash</code>),
      	KEY <code>blog_id</code> (<code>blog_id</code>),
      	KEY <code>chat_id</code> (<code>chat_id</code>),
      	KEY <code>auth_hash</code> (<code>auth_hash</code>),
      	KEY <code>last_polled</code> (<code>last_polled</code>)
    	) ENGINE = InnoDB

    Let me know. Thanks for your patience.

  • Charltan
    • Site Builder, Child of Zeus

    Hi Paul
    I did as you suggested including manually creating the table but the problem resists: I can't add any link in my posts via the add link button. The input fields and the checkbox can't be clicked. Firebug didn't show me any error so it doesn't seem to be a regular conflict (e.g. js scripts).

  • Paul
    • The Green Incsub

    @Charltan,

    At this point I'm not sure what if going on. I'm not seeing this on any of my own development site. Would it be possible to just get access to the site and let me dig around to see if I can uncover something? Can send the account info via the contact for like on the Snapshot thread.

    And probably should just go ahead with wp-admin access as well as access to the database.Will also need FTP in case I need to make changes to chat to test things.

    Paul

  • Charltan
    • Site Builder, Child of Zeus

    @Paul
    Thanks for your help so far. I decided to start all over and give it a try with a clean installation. I hope I have it working in a few hours and can tell you if all my problems were installation related (e.g. corrupt db).

  • Charltan
    • Site Builder, Child of Zeus

    OK, so I made a clean fresh install of WordPress and only installed and activated the Chat plugin. Same error: whenever you want to insert a link in a post, you can't enter the URL or click the "Open in new window" checkbox. The only other activated plugins are: WPMU Dashboard and BuddyPress. No additional theme is installed and activated. So I have to assume the problem actually is the Chat plugin.
    WP 3.5.1, BuddyPress 1.7.2

  • Paul
    • The Green Incsub

    @Charltan,

    What about the database errors? Are those still occurring?

    Give me some details on the "Same error: whenever you want to insert a link in a post, you can't enter the URL or click the "Open in new window" checkbox."

    So I'm on the Post editor form. Are you using the visual editor? Can you provide a screenshot so I can try and reproduce this within my BP site?

  • Paul
    • The Green Incsub

    @Charltan,

    So just looking into this on my end. Running WP 3.6 beta3 and latest BuddyPress 1.7.2 and default BP theme.

    1. I go to an existing post. Make sure I'm viewing the 'Visual' editor tab.
    2. I then highlight some text then click the link button on the toolbar.
    3. I see the popup for the link. I enter in some text for the URL and Title. Then set the checkbox for the open link in new window.
    4. Click the Add Link blue button.

    Everything seems to work fine on my end. I've tried this on 4 of my dev site this morning. All 4 are different hosts, GoDaddy, WPEngine, Site5 and Media Temple. All have the same results.

    Sorry but the issue you are having is not obvious to me. So I'm not sure what to recommend for a solution.

  • Charltan
    • Site Builder, Child of Zeus

    @Paul
    Exactly this is what I mean. I can't input text in the URL field. I have a different installation of wordpress where the problem does not occur. The only differences are:

    - German version of WP on the non-working site. But the difference should only be in the added localized files as far as I know.
    - Shared Server of ISP may be different (but same company)

    Any idea what I should try next?

  • Paul
    • The Green Incsub

    @Charltan,

    First try blocking chat on that specific page/post edit URL.

    Go to Chat > Settings Common then to the 'WP Admin' tab. Select 'Hide on Admin URLs' from the dropdown. Then copy the URL from the Page/Post edit. Leave off the query string parts. You want just the URL. for example

    http://your-domain.com/wp-admin/post.php

    Not

    http://your-domain.com/wp-admin/post.php?post=1&action=edit

    IF you still cannot add the link. Then try disabling Chat all together. Go to your User Profile. At the bottom are some settings to disable Chat within wp-admin. See image. This will in effect disable loading of the Chat JavaScript.

    At the moment there is not a way to disable chat for all users within wp-admin.

  • Charltan
    • Site Builder, Child of Zeus

    OK, when adding the following URLs I expected the chat (in the admin bar) to go away:
    http://www.zauber-kreis.ch/wp/wp-admin/post-new.php
    http://www.zauber-kreis.ch/wp/wp-admin/edit.php
    http://www.zauber-kreis.ch/wp/wp-admin/post.php

    But the icon is still there on those pages AND I still can't add a link. Then I deactivated the chat from my admin profile and still: can't add the link. Only when I deactivate the plugin, the Add Link window acts normal. What does this behavior tell you?

  • Paul
    • The Green Incsub

    @Charltan,

    I still suspect this is a JavaScript somehow. Again not able to reproduce on any of my sites. One more thing to try.

    1. Reactivate Chat.
    2. Go to Chat > Settings Page. Then to the 'WYSIWYG Button' tab. On this tab uncheck the Post Type checkboxes. This is what added the toolbar bottom to the Post editor form. Might be having some conflict. See images.

    If this doesn't work then again I need to request access so I can try and see if there is some JavaScript conflict or something causing this.

  • Charltan
    • Site Builder, Child of Zeus

    @Paul
    So I unchecked all boxes, went to a post and the button is still there. Shouldn't it be gone?

    Then I enabled the WP Debug mode and received the following notices:

    Notice: Undefined index: tinymce_roles in /home/zauberla/www/zauber-kreis.ch/wordpress/wp-content/plugins/wordpress-chat/wordpress-chat.php on line 758
    
    Notice: Undefined index: tinymce_post_types in /home/zauberla/www/zauber-kreis.ch/wordpress/wp-content/plugins/wordpress-chat/wordpress-chat.php on line 759

    This seems to be because I just deactivated the post types and administrator chat button but I don't know if this has anything else to do with the problem.

    The test system is open for you and you should be able to register here:

    http://www.zauber-kreis.ch/wordpress/register/

    To see the behavior you can add a new event (post type):
    http://www.zauber-kreis.ch/wordpress/wp-admin/post-new.php?post_type=incsub_event

    I let the debug mode on. If you need to migrate your account to an admin account, let me know it.

    Chris

  • Charltan
    • Site Builder, Child of Zeus

    btw: I manually set the tinymce button off by commenting out the lines where the show variable is set to true (in the wordpress-chat.php file). The button has gone but still it isn't possible to enter a URL. So, the problem doesn't seem to be tiny_mce (button) related.

  • Paul
    • The Green Incsub

    @Charltan,

    Well then please reset the Chat code back to its original. I don't want to try and debug something that was changed. Will register and try to login now.

    I'm also seeing another Notice at the top of the register page

    "Notice: Undefined index: chat_wp_toolbar in /home/zauberla/www/zauber-kreis.ch/wordpress/wp-content/plugins/wordpress-chat/wordpress-chat.php on line 1376"

    And to be clear thee are Notices not really errors. This is information from PHP to let you know some variable was not initialized before using. Still I'll clean it up.

  • Paul
    • The Green Incsub

    @Charltan,

    So earlier you mentioned only the Chat plugin was. But obviously you have the Events+ plugins enabled also. I see the issue. not sure on the solution. Going to try installing the Events+ plugins and see if I can test locally.

    Looking at the JavaScript being loaded. Looks like some Chat JS files are still there. Not sure if this is something with the code you changed or something with the plugin. Looking into the code. Thanks.

    BTW, I'm assuming you see all the Notices output from the Events+ plugin.

  • Paul
    • The Green Incsub

    @Charltan,

    Still working on the code change to prevent the chat JS from loading like it should. Should be ready in the morning for beta.

    Still even on my own system running the Events+ plugin and with all the PHP Notices showing I'm still able to create the links. So not sure any of this will solve your issue. Something is just not right. What other plugins are you running?Could it be something with the theme?

  • Paul
    • The Green Incsub

    More notes for myself. First image is from Firebug showing all the JS files loaded on member's site. Second image is Firebug showing all JS files loaded on my local development site. Both images are from the Events+ Add New post type editor screen with the link popup showing.

    Confused.

  • Charltan
    • Site Builder, Child of Zeus

    Hi Paul
    I just gained you admin access, just in case you want to further have a look at the settings.
    I reverted the code right after I have tried it out. The events+ plugin has been installed because of another problem I have and Patrick was looking at it, but the problem is not related as far as I can see (it still exists when the events+ plugin is disabled and it existed before the events plugin was installed).
    Sure those are PHP notices but I thought maybe there may still be any clue to the problem.
    The problem is theme and plugin independent. The theme used here is the default twenty twelve theme and the only installed plugins are: BuddyPress, WPMUDev Dashboard, Events+ and Chat.

    It is bed time over here in switzerland so you may not hear from me for the next few hours :wink:

  • Charltan
    • Site Builder, Child of Zeus

    @Paul
    OK, seems I got it: the "Add Link" button is set to disabled, when no start/end dates are defined yet. When you set a date, you can add the link!
    Either this should be made very clear to the end user (e.g. by triggering a note) or this behavior should be corrected (e.g. the event can be edited and saved but not published). So as far as it seems the new beta actually does work, hurray!
    I will make some more tests during the next 2-3 days and let you know the results.

    Thanks a lot for the terrific support!

  • Paul
    • The Green Incsub

    @Charltan,

    From your last post I'm not sure what you mean be start/end dates. I don't see a start/end on the link popup. Unless you mean the Post itself.

    Interesting thing not. I had been testing on WP 3.5.1 and 3.6-Beta3 version. This afternoon I setup a new install for WP 3.5.2 and sure enough I'm now getting the Link popup like on your site where I can enter text into either field.

    So at least I can now get the issue. Now just need to figure out what is causing it.

    Thanks.

  • Charltan
    • Site Builder, Child of Zeus

    @Paul
    I don't mean the "Add Link" window. I am talking about the start/end dates of events (using the events+ plugin). So, the problem is not "Chat" related and I wanted to stress this out. As far as I can tell, the new version works fine now, so I will mark this topic as resolved. When I find any further problem, I will re-open it.
    Thanks for your fast and professional support!

    Chris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.