WordPress.org

Ready to get started?Download WordPress

Forums

Achievements for WordPress
[resolved] Bug Report: Needs updating for WP 3.5 (15 posts)

  1. Prometheus Fire
    Member
    Posted 1 year ago #

    Just updated to WP 3.5 and Achievements is now throwing the same error that a lot of other plugins started giving with 3.5. Reporting this so it can hopefully get a quick fix to get it back on track.

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/myaccoutn/public_html/wp-content/plugins/achievements/includes/achievements-core.php on line 453 and defined in /home/myaccount/public_html/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/myaccount/public_html/wp-content/plugins/achievements/includes/achievements-classes.php on line 676 and defined in /home/myaccount/public_html/wp-includes/wp-db.php on line 990

    http://wordpress.org/extend/plugins/achievements/

  2. maineyak
    Member
    Posted 1 year ago #

    I have had a few plugins trigger these errors with 3.5. The author needs to read this:
    http://make.wordpress.org/core/2012/12/12/php-warning-missing-argument-2-for-wpdb-prepare/

  3. VegasKev88
    Member
    Posted 1 year ago #

    Just jumping in to offer an update. On another thread Paul (dev for Achievements) notified another user with the same problem, that he is in the process for updating the plugin for WP 3.5 and BP 1.6/1.7

    The recent changes in WP and BP were extremely large and apparently have caused a significant amount of conflicts with several plugins. Paul is very active in BP Community, so I'm sure a fix is only a very short time away.

  4. charlielove
    Member
    Posted 1 year ago #

    The fix is easy:

    Edit achievements-classes.php line 676 from

    $admin_sql = $wpdb->prepare( "AND (is_active = 1 OR is_active = 2)" );

    to be

    $admin_sql = $wpdb->prepare( "AND (is_active = 1 OR is_active = 2)", NULL );

    And Edit
    achievements-core.php line 453 from

    $actions = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)" ) );

    to

    $actions = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT action.name FROM {$bp->achievements->table_achievements} as achievement, {$bp->achievements->table_actions} as action WHERE achievement.action_id = action.id AND achievement.action_id != -1 AND (achievement.is_active = 1 OR achievement.is_active = 2)",NULL ) );

    The $wpdb->prepare expects an additional parameter to adding the NULL makes to work as it did previously.

  5. Norm
    Member
    Posted 1 year ago #

    FYI.

    There are many other instances of the prepare expectations. But if you add ", NULL" in similar places where the errors occur then the plugin gets back to work. If the plugin author wants a copy of my updated files to push toward an update I'd be happy to pass along.

  6. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    If you want to email me a copy of the modified versions of the 2.* version of Achievements to clear these notices, I'll gladly release the version. paul@byotos.com

  7. solcjoye
    Member
    Posted 1 year ago #

    From a 99.9% Newb perspective (I use WP to build a teaching tool for my classroom and am moving it to WP after using ELGG for a couple of years) Charlielove's method above worked perfectly for me. I have not thoroughly tested Achievements and their use yet, but the error messages on top of the screen are gone, and the plugin SEEMS to be functioning correctly as of right now.... just FYI.

    Thank you all for the plugin and support!

  8. teorourke
    Member
    Posted 1 year ago #

    I've done the above fix and it all worked fine until I navigated to the achievements directory. There it shows the familiar error with a few different details.

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/84/7713384/html/wp-content/plugins/achievements/includes/achievements-classes.php on line 448 and defined in /home/content/84/7713384/html/wp-includes/wp-db.php on line 990

    Warning: Missing argument 2 for wpdb::prepare(), called in /home/content/84/7713384/html/wp-content/plugins/achievements/includes/achievements-classes.php on line 449 and defined in /home/content/84/7713384/html/wp-includes/wp-db.php on line 990

    Any workaround for these errors?

  9. solcjoye
    Member
    Posted 1 year ago #

    Yup, I've got the same issue as teorourke, all errors disappear and functionality seems to work fine, but the errors due show yup in the achievements directory...

  10. maxgoldberg
    Member
    Posted 1 year ago #

    everything worked for me after editing the achievements-core and achievements-classes, THANK YOU SO MUCH for posting this fix. it was so bad before i fixed it, i couldn't even access my wp-admin. i ended up going through my ftp file manager to make the changes. it was tense, but ultimately smoothly implemented. thanks again, hope this helps other people, and welcome to wordpress 3.5 everybody :D

  11. solcjoye
    Member
    Posted 1 year ago #

    Not wanting to dig in and randomly place , NULL into the 30-some odd "prepare expectations" (which ones to edit or not is WAY beyond me...) looking at maineyak's link the first section:

    First, if you’re a user and you want to get rid of these errors, you should turn off the displaying of errors in PHP. There are many ways to do this, such as in php.ini, .htaccess, etc. For this, you can just put this in wp-config.php. (Note that hiding errors on production sites is good practice anyway.)

    @ini_set('display_errors', 0);

    This SEEMS to have worked... BUT I am not 100% sure this is a good idea? Correct me if I am wrong, but this is basically telling the ENTIRE WP site to turn OFF error messages? Is this an OK fix until an Achievements update is put out? Thanks,

  12. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    I've just released version 2.4 of achievements which fixes these errors. Thanks for everyone's patience.

  13. maxgoldberg
    Member
    Posted 1 year ago #

    Paul, thanks, please see my reply from 2 days ago, I've already edited the achievements-core and achievements-classes, is there anything I should do or change before updating to 2.4?

    thx

  14. Paul Gibbs
    BuddyPress Lead Developer
    Plugin Author

    Posted 1 year ago #

    Hi maxgoldberg,

    As long as you didn't make any other changes to files in the Achievements plugin, you should be safe to update.

  15. maxgoldberg
    Member
    Posted 1 year ago #

    Great, I updated and seems to be working fine.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.