Changeset 3786 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php
- Timestamp:
- 08/09/2016 03:44:26 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php
r3753 r3786 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' ); … … 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; … … 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; … … 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
Note: See TracChangeset
for help on using the changeset viewer.