WordPress.org

Ready to get started?Download WordPress

Forums

Project Tasks
[resolved] a bug: missing argument for wpdb::prepare() (3 posts)

  1. crysman
    Member
    Posted 11 months ago #

    Just right after installation I got this Warning:

    Warning: Missing argument 2 for wpdb::prepare(), called in /var/www/cmsfinal/wp-content/plugins/project-tasks/files/project-tasks-data.php on line 190 and defined in /var/www/cmsfinal/wp-includes/wp-db.php on line 992

    What is worse, I cannot even create a new task. It just gets stuck and keeps loading...

    I've emptied the cache, but have not tried to disable all other plugins... Anything to be done?

    http://wordpress.org/plugins/project-tasks/

  2. s3abro
    Member
    Posted 9 months ago #

    to make plugin work on WP 3.6.1

    edit project-tasks-data.php and find and replace
    (line 190)

    $user_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY $wpdb->users.ID ASC" ));

    into

    $user_ids = $wpdb->get_col( "SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY $wpdb->users.ID ASC" );

    edit project-tasks-form.php and find and replace
    (line 130)

    <link rel="stylesheet" type="text/css" href="<?php echo '/wp-content/plugins/' . str_replace( '.php', '.css', plugin_basename(__FILE__)) ?>" />

    into

    <link rel="stylesheet" type="text/css" href="<?php echo WP_PLUGIN_URL . '/' . dirname( plugin_basename(__FILE__) ) . '/project-tasks.css' ?>" />

    (line 132)

    <script type='text/javascript' src='<?php echo '/wp-content/plugins/' . str_replace( '.php', '.js', plugin_basename(__FILE__)) ?>'></script>

    into

    <script type='text/javascript' src='<?php echo WP_PLUGIN_URL . '/' . dirname( plugin_basename(__FILE__) ) . '/project-tasks.js' ?>'></script>

    (line 512)

    $target_exists = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $this->data->task_relation_table_name . ' WHERE task=' . $task_id . ' AND target_type=\'' . $targets_type . '\' AND target_id=\'' . $targets_id . '\';'));

    into

    $target_exists = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM ' . $this->data->task_relation_table_name . ' WHERE task = %d AND target_type = %s AND target_id = %p', $task_id, $targets_type, $targets_id ));

    (line 542)

    $db_task_item_columns['log'] = $wpdb->get_var($wpdb->prepare('SELECT log FROM ' . $this->data->tasks_table_name . ' WHERE id=' . $task_id . ';')) . $task_log;

    into

    $db_task_item_columns['log'] = $wpdb->get_var($wpdb->prepare('SELECT log FROM ' . $this->data->tasks_table_name . ' WHERE id = %d', $task_id)) . $task_log;

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

  3. stratoponjak
    Member
    Plugin Author

    Posted 2 months ago #

    Thank you!

    This should work in the latest version 0.9.2.

Reply

You must log in to post.

About this Plugin

About this Topic