• Resolved prometee

    (@prometee)


    Hello,

    We are importing subscribers with our own code using the helpers in the plugin.
    We detect a bug when inserting new user_list. When we do :

    $modelUL = WYSIJA::get('user_list', 'model');
    $ret = $modelUL->insert($user_list);

    $ret variable always return false because insert return is affected to $wpdb->insert_id (helpers/model.php:697). For normal tables this is expected return value but this table doesn’t have primary_key so we suggest in this case to not return insert_id but $wpdb->num_rows instead;
    So the fix is to replace the line 697 of helpers/model.php file to :

    $resultSave = $this->wpdb->insert_id === false
        ? $resultSave
        : $this->wpdb->insert_id;

    Before this line $resultSave contains $wpdb->num_rows provided by WP_DB::query return value.

    Sincerely,

    https://www.ads-software.com/plugins/wysija-newsletters/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘User List – insert always return false’ is closed to new replies.