Ticket #1227: 1227.patch

File 1227.patch, 2.1 KB (added by Nightgunner5, 2 years ago)

Allow users to decide whether the name and avatar should link to the profile or the website.

  • bb-admin/options-reading.php

     
    3333                'title' => __( 'Items per page' ), 
    3434                'class' => 'short', 
    3535                'note' => __( 'Number of topics, posts or tags to show per page.' ), 
     36        ), 
     37        'name_link_profile' => array( 
     38                'title' => __( 'Link name to' ), 
     39                'type' => 'radio', 
     40                'options' => array( 
     41                        0 => __( 'Profile' ), 
     42                        1 => __( 'Website' ) 
     43                ) 
    3644        ) 
    3745); 
    3846 
  • bb-includes/functions.bb-meta.php

     
    475475                'plugin_cookie_paths', 
    476476                'wp_roles_map', 
    477477                'gmt_offset', 
    478                 'timezone_string' 
     478                'timezone_string', 
     479                'name_link_profile' 
    479480        ); 
    480481 
    481482        // Check that these aren't already in the cache 
  • bb-includes/functions.bb-template.php

     
    17401740} 
    17411741 
    17421742function post_author_link( $post_id = 0 ) { 
    1743         if ( $link = get_user_link( get_post_author_id( $post_id ) ) ) { 
     1743        if ( $link = ( bb_get_option( 'name_link_profile' ) ? get_user_profile_link( get_post_author_id( $post_id ) ) : get_user_link( get_post_author_id( $post_id ) ) ) ) { 
    17441744                echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>'; 
    17451745        } elseif ( $link = bb_get_post_meta( 'pingback_uri' )) { 
    17461746                echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>'; 
     
    17621762                return false; 
    17631763         
    17641764        $author_id = get_post_author_id( $post_id ); 
    1765         if ( $link = get_user_link( $author_id ) ) { 
     1765        if ( $link = ( bb_get_option( 'name_link_profile' ) ? get_user_profile_link( $author_id ) : get_user_link( $author_id ) ) ) { 
    17661766                echo '<a href="' . esc_attr( $link ) . '">' . bb_get_avatar( $author_id, $size, $default ) . '</a>'; 
    17671767        } else { 
    17681768                echo bb_get_avatar( $author_id, $size, $default );