Forum Replies Created

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

    (@mathiasp)

    Great thx!

    Thread Starter MathiasP

    (@mathiasp)

    Totally, thank you!

    Thread Starter MathiasP

    (@mathiasp)

    Uh yeah the – did it 😉 thx

    Thread Starter MathiasP

    (@mathiasp)

    Hey, review for a good plugin 🙂

    one more question:

    I tried to implement the minimum filter but it doesn’t work the way I need it

    Here is my code:

    function user_stats_set_minimum_points($minimum, $type){
        if ( 'substract' === $type ) {
            $minimum = 5000;
        }
        return $minimum;
    }
    add_filter('wordpoints_points_minimum','user_stats_set_minimum_points',10,2);

    If I now substract points with

    wordpoints_subtract_points($user_id, 200, 'substract', 'training_event_winner');

    the log shows (+) 5000 Points for the user in substract points type.

    What I need is: If I use wordpoints_substract_points in the Points type substract (let’s say 200) just substract the points even if the user has 0 Points in that points type

    p.s.: I dont even need a limit just substract some points if need to.

    is it possible with this filter?

    I hope you unterstand my question 🙂

    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'";
    				}
    			}
    Thread Starter MathiasP

    (@mathiasp)

    Thank you. I think I will use WTI Like posts to realize that. Thanks for the quick answer and I hope u will implement the function in a future update.. but as I recognized u have a lot of work to do 🙂

    Forum: Plugins
    In reply to: [WordPoints] "Likes" Hook
    MathiasP

    (@mathiasp)

    Hey robint,

    did you just get the Hook working well?
    I need to realize the same thing (see the newest topic in this support section)

    Maybe you can help me with that?

    Mathias

Viewing 7 replies - 1 through 7 (of 7 total)