• Resolved microsleep

    (@microsleep)


    Hello,

    I am running the latest version of WordPress (3.0.2) on a local server. I want to try/use Popularity Contest plugin, but each time I attempt to active it, I have an error message which says:

    Plugin could not be activated because it triggered a fatal error.
    
    Incorrect table name '' on line: 255

    Here is the function written in these lines:

    $result = mysql_query("
    			CREATE TABLE <code>$wpdb->ak_popularity_options</code> (
    				<code>option_name</code> VARCHAR( 50 ) NOT NULL,
    				<code>option_value</code> VARCHAR( 50 ) NOT NULL
    			)
    		", $wpdb->dbh) or die(mysql_error().' on line: '.__LINE__);
    		if (!$result) {
    			return false;
    		}

    I can also tell you that my MySQL settings look like this:

    /** The name of the database for WordPress */
    define('DB_NAME', 'wordpress');

    Your help will be much appreciated — do you have any ideas?

Viewing 15 replies - 16 through 30 (of 33 total)
  • RP is this why I’m not able to change the number values to calculate the ‘popularity’ rankings because I used the wp prefix??

    The plugin works fine after I inputted the above SQL but now I can’t change the number values on my dashboard. What other prefix do I need to enter in here? Or how would I find out which table prefix I’m currently using..

    All of my tables in myadmin start with wp prefix so I don’t think this is the problem. Anybody having the same issues with change the default popularity values for the plugin?

    I autoinstalled the version of wordpress that I’m testing on, so it created tables with a prefix of wp_randomstring_ wordpress is looking for the random string as well..

    I’ve got the tables functional, even got it to not display pages, but it’s not recording page views at all (I’ve got the correct author setting and have hit the site from various computers/phones) It’s also only showing a specific five pages in widgets (I’ve swapped out the different ones available, and faked data in the mysql table for the others but to no avail) I have one post that I commented on 30 times, but because it isn’t one of the specific posts it doesn’t display.. (it’s in the same category, same tags as another post that is displaying) Regardless, if I can’t actually get it to count pageviews what good is it?

    I’m going to keep fidgeting with it, but if anyone has any ideas I’d love to hear them.

    Thanks to those who provided information, I was also able to get this working. For those who need a quick few steps, here’s what to do:

    To make it a bit easier for others, you can do the following.

    Access phpMyAdmin for the hosting account (domain) you’ve installed you WordPress. Select the correct database for your specific WordPress installation. Select the “SQL” tab in the top navigation.

    In the text box entitled, “Run SQL query/queries on database…”, place each block of code (see the two blocks below) and then select “Go” (it’s a button on the far right).

    ******
    MAKE SURE you substitute the first part of the table name that says “wp”, to the table_prefix that you set in your wp-config.php file. Many people lave it as “wp” (but that is not secure), often it’s changed to something else (to improve security).
    ******

    CREATE TABLEwp_ak_popularity` (
    post_id INT( 11 ) NOT NULL ,
    total INT( 11 ) NOT NULL ,
    feed_views INT( 11 ) NOT NULL ,
    home_views INT( 11 ) NOT NULL ,
    archive_views INT( 11 ) NOT NULL ,
    category_views INT( 11 ) NOT NULL ,
    tag_views INT( 11 ) NOT NULL ,
    single_views INT( 11 ) NOT NULL ,
    searcher_views INT( 11 ) NOT NULL ,
    comments INT( 11 ) NOT NULL ,
    pingbacks INT( 11 ) NOT NULL ,
    trackbacks INT( 11 ) NOT NULL ,
    last_modified DATETIME NOT NULL ,
    KEY post_id ( post_id )
    )`

    and

    CREATE TABLEwp_ak_popularity_options` (
    option_name VARCHAR( 50 ) NOT NULL,
    option_value VARCHAR( 50 ) NOT NULL
    )`

    NOTE: This forum is altering the syntax of the code. You can see the correct code here: https://rogerwheatley.com/how-to-get-popularity-contest-working-in-wordpress-3-0-4/

    Is anybody else unable to change popularity values in the admin section? The plugin is also not registering any counts for page views, it’s only registering counts for comments and pingbacks.

    If so, anybody have a fix?

    Yeah it`s working for 3.04 as BloggerSavvy posted

    Is anybody else unable to change popularity values in the admin section? The plugin is also not registering any counts for page views, it’s only registering counts for comments and pingbacks.

    If so, anybody have a fix?

    Plugin is working..The problem maybe is you are trying to update it through self browser I mean viewing pages only one or you have comments on some pages, they are weighter than viewing.. Maybe on your admin CP in plagin`s settings on top ‘Ignore views by site authors:’ checking ‘Yes’ – change it to ‘No’ and you will be able to do first steps I defined.

    I havent seen this:( Its still broken and unfixed.. The same problem as well as everybody improperly counting

    Thank you sMartyDs!!

    I had a go at the plugin and i think there is mistake in
    the way plugin calls the table prefix just find line
    below function check_install() that says this

    $result = mysql_query("SHOW TABLES LIKE '{$wpdb->prefix}ak_popularity%'", $wpdb->dbh);

    and change it into

    $result = mysql_query("SHOW TABLES LIKE '".$wpdb->prefix."ak_popularity%'", $wpdb->dbh);

    that fixes activate reactivate as i discovered every time you reactivete this plugin it tries to create tables that are already there

    now problem eith error on lines 250-255
    actualy it is the way mysql_query is made passing $wpdb variable as part of a string is not a good idea wordpress codex gave me solution to that.
    find the line that says

    $result = mysql_query("
    CREATE TABLE <code>$wpdb->ak_popularity_options</code> (
    <code>option_name</code> VARCHAR( 50 ) NOT NULL,
    <code>option_value</code> VARCHAR( 50 ) NOT NULL
    )
    ", $wpdb->dbh) or die(mysql_error().' on line: '.__LINE__);

    and change it to:

    CREATE TABLE <code>".$wpdb->prefix."ak_popularity_options</code> (
    <code>option_name</code> VARCHAR( 50 ) NOT NULL,
    <code>option_value</code> VARCHAR( 50 ) NOT NULL
    )
    ", $wpdb->dbh) or die(mysql_error().' on line: '.__LINE__);

    and again couple of lines below find ones that say :

    $result = mysql_query("
    CREATE TABLE <code>$wpdb->ak_popularity</code> (

    change them to

    $result = mysql_query("
    CREATE TABLE <code>".$wpdb->prefix."ak_popularity</code> (

    Hope that helps it definately helped me … im using latest wordpress on my server.
    I will look into other issues a bit later as it is 6 am and i need to catch some sleep LOL

    actually the code above is messed up and instead of
    ‘ there are < code > and < /code >
    it should look like this
    First change:
    where it says:

    $result = mysql_query("
    CREATE TABLE '$wpdb->ak_popularity_options' (
    'option_name' VARCHAR( 50 ) NOT NULL,
    'option_value' VARCHAR( 50 ) NOT NULL
    )

    Should be:

    $result = mysql_query("
    CREATE TABLE '".$wpdb->prefix."ak_popularity_options' (
    'option_name' VARCHAR( 50 ) NOT NULL,
    'option_value' VARCHAR( 50 ) NOT NULL
    )

    and
    second change:
    where it says:

    $result = mysql_query("
    CREATE TABLE '$wpdb->ak_popularity' (

    should be:

    $result = mysql_query("
    CREATE TABLE '".$wpdb->prefix."ak_popularity' (

    Sorry for that i haven’t noticed after pasting from PhpED
    that my straight ticks were converted into backticks.

    The very first change of function check install from the post above is correct so no point of pasting it again here.

    cheers

    I’m done with this plugin it’s driving me crazy. I can’t change the values because they revert back to the default and also it’s not even computing the default values correctly either.

    Until this plugin is fixed I’m done with it!!!

    I registered just to reply to this thread. Thank you sMartyDs, I have never done a SQL command, but ran the code you provided and it worked like a charm. I use this plugin without issues on other sites and needed it here after showing the client. THANK YOU !!

    That was useful, thanks!

    @bloggersavvy – Thank you! Worked like a charm.
    https://rogerwheatley.com/how-to-get-popularity-contest-working-in-wordpress-3-0-4/

    I tried @giraffe2011’s fix first and it appeared to work – plugin activated but the plugin did not activate, on the second try I got the same table error again.

Viewing 15 replies - 16 through 30 (of 33 total)
  • The topic ‘[Plugin: Popularity Contest] Unable to activate in WordPress 3.0.2’ is closed to new replies.