If you have recently tried to install the Sticky Menu plugin you will have noticed that it does not create a table in the database as it should. Here is the fix, for anyone who is interested. Just open the stickymenu.php file and replace the entire stickymenu_install() function with the one below.
PHP:
- # ———————————-
- function stickymenu_install() {
- # ———————————-
- if (!current_user_can(“manage_options”)) {
- return;
- };
- $table_name = $wpdb->prefix . ’stickymenu’;
- if ($wpdb->get_var(“show tables like ‘$table_name’”) != $table_name) {
- # Create DB table
- $sql = “CREATE TABLE $table_name (
- id int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
- pid VARCHAR(55) NOT NULL,
- name VARCHAR(55) NOT NULL,
- link VARCHAR(255) NOT NULL,
- menu VARCHAR(55) NOT NULL,
- class VARCHAR(55) NOT NULL,
- weight int(11) NOT NULL DEFAULT ‘0′,
- disabled TINYINT NOT NULL DEFAULT ‘0′,
- UNIQUE KEY id (id)
- ) TYPE = MYISAM;”;
- require_once(ABSPATH.‘wp-admin/includes/upgrade.php’);
- dbDelta($sql);
- } else {
- if ($wpdb->get_var(“show columns from $table_name like ‘class’”) != ‘class’) {
- # This column ‘class’ was added in release 1.4
- $column_name = ‘class’;
- $sql = “ALTER TABLE $table_name ADD $column_name VARCHAR(55) NOT NULL”;
- $wpdb->query($sql);
- require_once(ABSPATH.‘wp-admin/includes/upgrade.php’);
- };
- if ($wpdb->get_var(“show columns from $table_name like ‘pid’”) != ‘pid’) {
- # This column ‘pid’ will be needed in release 1.5
- $column_name = ‘pid’;
- $sql = “ALTER TABLE $table_name ADD $column_name VARCHAR(55) NOT NULL”;
- $wpdb->query($sql);
- require_once(ABSPATH.‘wp-admin/includes/upgrade.php’);
- };
- };
UPDATE: Because of the way Wordpress handles quotes you can’t just copy and paste this code. You will have to change the quotes from their curly counterparts back to the straight quotes, or copy the code from the file below.
8 Comments
Parse error: syntax error, unexpected T_STRING in /home/upsta11/public_html/campbethel/wp-content/plugins/stickymenu/stickymenu.php on line 94
Somewhere around your line 91 or 92
Hi, i get the same error message as Neil
Any suggestions?
thanks for your help,
chris
I added an alternate file for you to copy from. It is most likely the curly quotes that Wordpress loves to put into everything.
Hi,
I’m currently running WP 2.6.5, and I’ve tried this fix which still isn’t working for me. I click ’save’ and am simply redirected to the Sticky submenu with no menus saved.
Hey Sean, Let me have a look at it and see what I can find out. Were you able to fix it?
Hi Dustin
Similar issue. Fix did not work though I applied it from flat file.
I am using WP v2.6.2 soon to UG to the just relased to WP v2.6.5
Best
Hi all
Resolved.
It worked after I deactivated and reactivated the plug-in…
Best
@JaC - That’s a great point that I forgot to mention. You have to reactivate the plugin because it only creates the database tables when it is installed.
@sean - Did you try reactivating?
One Trackback
[...] Sticky Menu Installation Fix for WordPress 2.6 [...]