Ticket #1227: 1277.diff

File 1277.diff, 3.9 KB (added by GautamGupta, 2 years ago)

Better Patch

  • bb-admin/options-reading.php

     
    11<?php 
    22 
    3 require_once('admin.php'); 
     3require_once( 'admin.php' ); 
    44 
    55if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) && $_POST['action'] == 'update') { 
    66         
     
    2424        exit; 
    2525} 
    2626 
    27 if ( !empty($_GET['updated']) ) { 
    28         bb_admin_notice( __( '<strong>Settings saved.</strong>' ) ); 
    29 } 
     27if ( !empty( $_GET['updated'] ) ) 
     28        bb_admin_notice( '<strong>' . __( 'Settings saved.' ) . '</strong>' ); 
    3029 
    3130$reading_options = array( 
    3231        'page_topics' => array( 
    3332                'title' => __( 'Items per page' ), 
    3433                'class' => 'short', 
    35                 'note' => __( 'Number of topics, posts or tags to show per page.' ), 
     34                'note' => __( 'Number of topics, posts or tags to show per page.' ) 
     35        ), 
     36        'name_link_profile' => array( 
     37                'title' => __( 'Link name to' ), 
     38                'type' => 'radio', 
     39                'options' => array( 
     40                        0 => __( 'Website' ), 
     41                        1 => __( 'Profile' ) 
     42                ), 
     43                'note' => __( 'What should the user\'s name link to on the topic page? The user\'s title would automatically get linked to the option you don\'t choose. By default, the user\'s name is linked to his/her website.' ) 
    3644        ) 
    3745); 
    3846 
     
    4452 
    4553<div class="wrap"> 
    4654 
    47 <h2><?php _e('Reading Settings'); ?></h2> 
     55<h2><?php _e( 'Reading Settings' ); ?></h2> 
    4856<?php do_action( 'bb_admin_notices' ); ?> 
    4957 
    50 <form class="settings" method="post" action="<?php bb_uri('bb-admin/options-reading.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN); ?>"> 
     58<form class="settings" method="post" action="<?php bb_uri( 'bb-admin/options-reading.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ); ?>"> 
    5159        <fieldset> 
    5260<?php 
    5361foreach ( $reading_options as $option => $args ) { 
     
    5866        <fieldset class="submit"> 
    5967                <?php bb_nonce_field( 'options-reading-update' ); ?> 
    6068                <input type="hidden" name="action" value="update" /> 
    61                 <input class="submit" type="submit" name="submit" value="<?php _e('Save Changes') ?>" /> 
     69                <input class="submit" type="submit" name="submit" value="<?php _e( 'Save Changes' ) ?>" /> 
    6270        </fieldset> 
    6371</form> 
    6472 
  • bb-includes/functions.bb-meta.php

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

     
    17541754} 
    17551755 
    17561756function post_author_link( $post_id = 0 ) { 
    1757         if ( $link = get_user_link( get_post_author_id( $post_id ) ) ) { 
     1757        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 ) ) ) ) { 
    17581758                echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>'; 
    17591759        } elseif ( $link = bb_get_post_meta( 'pingback_uri' )) { 
    17601760                echo '<a href="' . esc_attr( $link ) . '">' . get_post_author( $post_id ) . '</a>'; 
     
    21442144                        $r = __('PingBack'); 
    21452145                else 
    21462146                        $r = __('Unregistered'); // This should never happen 
    2147         } else 
    2148                 $r = '<a href="' . esc_attr( get_user_profile_link( get_post_author_id( $post_id ) ) ) . '">' . $title . '</a>'; 
     2147        } else { 
     2148                if ( $link = bb_get_option( 'name_link_profile' ) ? get_user_link( get_post_author_id( $post_id ) ) : get_user_profile_link( get_post_author_id( $post_id ) ) ) 
     2149                        $r = '<a href="' . esc_attr( $link ) . '">' . $title . '</a>'; 
     2150                else 
     2151                        $r = $title; 
     2152        } 
    21492153 
    21502154        return apply_filters( 'get_post_author_title_link', $r, get_post_id( $post_id ) ); 
    21512155}