Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter MathiasP

    (@mathiasp)

    You just need to fix the wti_like_post_ajax.php

    $user_ID = get_current_user_id();
    if ( $task == "like" ) {
    				if ( $has_already_voted ) {
    					$query = "UPDATE {$wpdb->prefix}wti_like_post SET ";
    					$query .= "value = value + 1, ";
    					$query .= "date_time = '" . date( 'Y-m-d H:i:s' ) . "' ";
    					$query .= "WHERE post_id = '" . $post_id . "' AND ";
    					$query .= "ip = '$ip'";
    				} else {
    					$query = "INSERT INTO {$wpdb->prefix}wti_like_post SET ";
    					$query .= "post_id = '" . $post_id . "', ";
    					$query .= "value = '1', ";
    					$query .= "date_time = '" . date( 'Y-m-d H:i:s' ) . "', ";
    					$query .= "ip = '$ip', ";
                        $query .= "user_id = '$user_ID'";
    				}
    			} else {
    				if ( $has_already_voted ) {
    					$query = "UPDATE {$wpdb->prefix}wti_like_post SET ";
    					$query .= "value = value - 1, ";
    					$query .= "date_time = '" . date( 'Y-m-d H:i:s' ) . "' ";
    					$query .= "WHERE post_id = '" . $post_id . "' AND ";
    					$query .= "ip = '$ip'";
    				} else {
    					$query = "INSERT INTO {$wpdb->prefix}wti_like_post SET ";
    					$query .= "post_id = '" . $post_id . "', ";
    					$query .= "value = '-1', ";
    					$query .= "date_time = '" . date( 'Y-m-d H:i:s' ) . "', ";
    					$query .= "ip = '$ip', ";
                        $query .= "user_id = '$user_ID'";
    				}
    			}
    Plugin Author webtechideas

    (@webtechideas)

    Tracking users based on user id is a functionality in the PRO Version only and that’s the reason this user id is not recorded in the free version. Since you know what needs to be changed, please change that if you need.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘User ID is set to 0 in database’ is closed to new replies.