Ticket #1755: 1755.1.patch
| File 1755.1.patch, 2.7 KB (added by , 10 years ago) |
|---|
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php
298 298 $comment_link = get_comment_link( $comment_id ); 299 299 $nonce = wp_create_nonce( 'user-note-vote-' . $comment_id ); 300 300 $disabled_str = __( 'Voting for this note is disabled', 'wporg' ); 301 $cancel_str = __( 'Click to cancel your vote', 'wporg' ); 301 302 $log_in_str = __( 'You must log in to vote on the helpfulness of this note', 'wporg' ); 302 303 $log_in_url = add_query_arg( 'redirect_to', urlencode( $comment_link ), 'https://login.wordpress.org' ); 303 304 … … 310 311 // Up vote link 311 312 $user_upvoted = self::has_user_upvoted_comment( $comment_id ); 312 313 if ( $can_vote ) { 314 $cancel = $user_upvoted ? '. ' . $cancel_str . '.' : ''; 313 315 $title = $user_upvoted ? 314 __( 'You have voted to indicate this note was helpful', 'wporg' ) :316 __( 'You have voted to indicate this note was helpful', 'wporg' ) . $cancel : 315 317 __( 'Vote up if this note was helpful', 'wporg' ); 316 $tag = $user_upvoted ? 'span' :'a';318 $tag = 'a'; 317 319 } else { 318 320 $title = ! $logged_in ? $log_in_str : $disabled_str; 319 321 $tag = $logged_in ? 'span' : 'a'; … … 350 352 // Down vote link 351 353 $user_downvoted = ( $user_upvoted ? false : self::has_user_downvoted_comment( $comment_id ) ); 352 354 if ( $can_vote ) { 355 $cancel = $user_downvoted ? '. ' . $cancel_str . '.' : ''; 353 356 $title = $user_downvoted ? 354 __( 'You have voted to indicate this note was not helpful', 'wporg' ) :357 __( 'You have voted to indicate this note was not helpful', 'wporg' ) . $cancel : 355 358 __( 'Vote down if this note was not helpful', 'wporg' ); 356 $tag = $user_downvoted ? 'span' :'a';359 $tag = 'a'; 357 360 } else { 358 361 $title = ! $logged_in ? $log_in_str : $disabled_str; 359 362 $tag = $logged_in ? 'span' : 'a'; … … 485 488 // Get list of people who cast the same vote. 486 489 $add_to_list = get_comment_meta( $comment_id, $add_to, true ); 487 490 488 // Don't do anything if user isrecasting the same vote as before.491 // Remove user from list if recasting the same vote as before. 489 492 if ( in_array( $user_id, (array) $add_to_list ) ) { 490 return false; 493 unset( $add_to_list[ array_search( $user_id, $add_to_list ) ] ); 494 update_comment_meta( $comment_id, $add_to, $add_to_list ); 495 return true; 491 496 } 492 497 493 498 // If the user had previously cast the opposite vote, undo that older vote.