Support » Plugin: User Activity Log » Error creating database entry

  • wp 5.2.3
    ual 0.10.1

    I am seeing a lot of errors like that one below in the error log.
    Anyway to correct it?

    [07-Sep-2019 00:14:39 UTC] WordPress database error Column ‘object_type’ cannot be null for query INSERT INTO wp_ualp_user_activity (post_id, post_title, user_id, user_name, user_role, user_email, ip_address, modified_date, object_type, action) VALUES (217136, ‘Auto Draft’, 0, ”, ”, ”, ‘’, ‘2019-09-06 17:14:39’, NULL, ‘delete ‘) made by do_action_ref_array(‘wp_scheduled_auto_draft_delete’), WP_Hook->do_action, WP_Hook->apply_filters, wp_delete_auto_drafts, wp_delete_post, do_action(‘before_delete_post’), WP_Hook->do_action, WP_Hook->apply_filters, ual_shook_delete_post, ual_get_activity_function, ual_user_activity_add, W3TC\DbCache_Wpdb->insert, W3TC\DbCache_WpdbInjection_QueryCaching->insert, W3TC\_CallUnderlying->insert, W3TC\DbCache_Wpdb->insert, W3TC\DbCache_WpdbInjection->insert, W3TC\DbCache_Wpdb->default_insert, W3TC\DbCache_Wpdb->query, W3TC\DbCache_WpdbInjection->query, W3TC\DbCache_Wpdb->default_query

Viewing 1 replies (of 1 total)
  • Plugin Contributor Sanjay Dabhoya


    Hi @jimoe

    Sorry for the inconvenience caused to you.

    Find and replace ual_user_activity_add function for user_functions.php file.

    if (!function_exists(‘ual_user_activity_add’)) {

    function ual_user_activity_add($post_id, $post_title, $obj_type, $current_user_id, $current_user, $user_role, $user_mail, $modified_date, $ip, $action) {
    global $wpdb;
    $table_name = $wpdb->prefix . “ualp_user_activity”;
    $post_title = addslashes($post_title);
    if($obj_type == ”) {
    $obj_type = ‘post’;
    $insert_query = $wpdb->insert(
    ‘post_id’ => $post_id,
    ‘post_title’ => $post_title,
    ‘user_id’ => $current_user_id,
    ‘user_name’ => $current_user,
    ‘user_role’ => $user_role,
    ‘user_email’ => $user_mail,
    ‘ip_address’ => $ip,
    ‘modified_date’ => $modified_date,
    ‘object_type’ => $obj_type,
    ‘action’ => $action,

    If still your issue exists, let us know.

    More details on code level you can reach us via slack.

    Thank you

Viewing 1 replies (of 1 total)
  • The topic ‘Error creating database entry’ is closed to new replies.