Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Allow Daily Video Points
- * Allow users to gain points for watching the same video every 24 hours
- * @version 1.0
- */
- function mycred_pro_daily_video_view( $has_entry, $reference, $ref_id, $user_id, $data, $type ) {
- if ( $reference == 'watching_video' ) {
- global $wpdb, $mycred;
- $check = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$mycred->log_table} WHERE user_id = %d AND ref = %s AND data = %s AND ctype = %s AND time > %d;", $user_id, $reference, $data, $type, ( current_time( 'timestamp' ) - DAY_IN_SECONDS ) ) );
- if ( $check === NULL )
- return false;
- return true;
- }
- }
- add_filter( 'mycred_has_entry', 'mycred_pro_daily_video_view', 10, 6 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement