Changeset 3560
- Timestamp:
- 06/23/2016 04:19:52 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
r929 r3560 264 264 265 265 $can_vote = self::user_can_vote( get_current_user_id(), $comment_id ); 266 $logged_in = is_user_logged_in(); 266 267 $comment_link = get_comment_link( $comment_id ); 267 268 $nonce = wp_create_nonce( 'user-note-vote-' . $comment_id ); 269 $disabled_str = __( 'Voting for this note is disabled', 'wporg' ); 270 $log_in_str = __( 'You must log in to vote on the helpfulness of this note', 'wporg' ); 271 $log_in_url = add_query_arg( 'redirect_to', urlencode( $comment_link ), 'https://login.wordpress.org' ); 268 272 269 273 echo '<div class="user-note-voting" data-nonce="' . esc_attr( $nonce ) . '">'; … … 277 281 $tag = $user_upvoted ? 'span' : 'a'; 278 282 } else { 279 $title = ! is_user_logged_in() ? 280 __( 'You must log in to vote on the helpfulness of this note', 'wporg' ) : 281 ''; 282 $tag = 'span'; 283 $title = ! $logged_in ? $log_in_str : $disabled_str; 284 $tag = $logged_in ? 'span' : 'a'; 283 285 } 284 286 echo "<{$tag} " … … 287 289 . '" data-id="' . esc_attr( $comment_id ) 288 290 . '" data-vote="up'; 289 if ( ! $user_upvoted ) { 290 echo '" href="' 291 . esc_url( add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'up' ), $comment_link ) ); 291 if ( 'a' === $tag ) { 292 $up_url = $logged_in ? 293 add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'up' ), $comment_link ) : 294 $log_in_url; 295 echo '" href="' . esc_url( $up_url ); 292 296 } 293 297 echo '">'; … … 315 319 $tag = $user_downvoted ? 'span' : 'a'; 316 320 } else { 317 $title = ! is_user_logged_in() ? 318 __( 'You must log in to vote on the helpfulness of this note', 'wporg' ) : 319 ''; 320 $tag = 'span'; 321 $title = ! $logged_in ? $log_in_str : $disabled_str; 322 $tag = $logged_in ? 'span' : 'a'; 321 323 } 322 324 echo "<{$tag} " … … 325 327 . '" data-id="' . esc_attr( $comment_id ) 326 328 . '" data-vote="down'; 327 if ( ! $user_downvoted ) { 328 echo '" href="' 329 . esc_url( add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'down' ), $comment_link ) ); 329 if ( 'a' === $tag ) { 330 $down_url = $logged_in ? 331 add_query_arg( array( '_wpnonce' => $nonce , 'comment' => $comment_id, 'vote' => 'down' ), $comment_link ) : 332 $log_in_url; 333 echo '" href="' . esc_url( $down_url ); 330 334 } 331 335 echo '">';
Note: See TracChangeset
for help on using the changeset viewer.