Skip to:
Content

bbPress.org

Changeset 2974


Ignore:
Timestamp:
04/01/2011 04:01:31 AM (15 years ago)
Author:
johnjamesjacoby
Message:

Full audit of user/topic/reply/view permalinks. Use $wp_rewrite->using_permalinks() method in place of $wp_rewrite->permalink_structure. See r2973

Location:
branches/plugin/bbp-includes
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-general-template.php

    r2970 r2974  
    978978                        return home_url();
    979979
    980                 if ( !empty( $wp_rewrite->permalink_structure ) ) {
    981                         $url = $wp_rewrite->front . $bbp->view_slug . '/' . $view;
     980                // Pretty permalinks
     981                if ( $wp_rewrite->using_permalinks() ) {
     982                        $url = $wp_rewrite->root . $bbp->view_slug . '/' . $view;
    982983                        $url = home_url( user_trailingslashit( $url ) );
     984
     985                // Unpretty permalinks
    983986                } else {
    984987                        $url = add_query_arg( array( 'bbp_view' => $view ), home_url( '/' ) );
  • branches/plugin/bbp-includes/bbp-reply-template.php

    r2972 r2974  
    13231323                        return;
    13241324
    1325                 if ( empty( $wp_rewrite->permalink_structure ) ) {
     1325                // Pretty permalinks
     1326                if ( $wp_rewrite->using_permalinks() ) {
     1327                        $url = $wp_rewrite->root . $bbp->reply_slug . '/' . $reply->post_name . '/edit';
     1328                        $url = home_url( user_trailingslashit( $url ) );
     1329
     1330                // Unpretty permalinks
     1331                } else {
    13261332                        $url = add_query_arg( array( bbp_get_reply_post_type() => $reply->post_name, 'edit' => '1' ), home_url( '/' ) );
    1327                 } else {
    1328                         $url = $wp_rewrite->front . $bbp->reply_slug . '/' . $reply->post_name . '/edit';
    1329                         $url = home_url( user_trailingslashit( $url ) );
    13301333                }
    13311334
  • branches/plugin/bbp-includes/bbp-topic-template.php

    r2972 r2974  
    19041904                        return;
    19051905
    1906                 if ( empty( $wp_rewrite->permalink_structure ) ) {
     1906                // Pretty permalinks
     1907                if ( $wp_rewrite->using_permalinks() ) {
     1908                        $url = $wp_rewrite->root . $bbp->topic_slug . '/' . $topic->post_name . '/edit';
     1909                        $url = home_url( user_trailingslashit( $url ) );
     1910
     1911                // Unpretty permalinks
     1912                } else {
    19071913                        $url = add_query_arg( array( bbp_get_topic_post_type() => $topic->post_name, 'edit' => '1' ), home_url( '/' ) );
    1908                 } else {
    1909                         $url = $wp_rewrite->front . $bbp->topic_slug . '/' . $topic->post_name . '/edit';
    1910                         $url = home_url( user_trailingslashit( $url ) );
    19111914                }
    19121915
  • branches/plugin/bbp-includes/bbp-user-template.php

    r2973 r2974  
    247247         */
    248248        function bbp_get_user_profile_url( $user_id = 0, $user_nicename = '' ) {
    249                 global $bbp;
     249                global $wp_rewrite, $bbp;
    250250
    251251                // Use displayed user ID if there is one, and one isn't requested
     
    253253                        return false;
    254254
    255                 // No pretty permalinks
    256                 if ( empty( $wp_rewrite->permalink_structure ) ) {
    257                         $url = add_query_arg( array( 'bbp_user' => $user_id ), home_url( '/' ) );
    258 
    259                 // Get URL safe user slug
    260                 } else {
    261                         $url = $bbp->user_slug . '/%bbp_user%';
    262 
     255                // Pretty permalinks
     256                if ( $wp_rewrite->using_permalinks() ) {
     257                        $url = $wp_rewrite->root . $bbp->user_slug . '/%bbp_user%';
     258
     259                        // Get username if not passed
    263260                        if ( empty( $user_nicename ) ) {
    264261                                $user = get_userdata( $user_id );
    265                                 if ( !empty( $user->user_nicename ) )
     262                                if ( !empty( $user->user_nicename ) ) {
    266263                                        $user_nicename = $user->user_nicename;
     264                                }
    267265                        }
    268266
    269267                        $url = str_replace( '%bbp_user%', $user_nicename, $url );
    270268                        $url = home_url( user_trailingslashit( $url ) );
     269
     270                // Unpretty permalinks
     271                } else {
     272                        $url = add_query_arg( array( 'bbp_user' => $user_id ), home_url( '/' ) );
    271273                }
    272274
     
    341343                        return;
    342344
    343                 if ( empty( $wp_rewrite->permalink_structure ) ) {
    344                         $url = add_query_arg( array( 'bbp_user' => $user_id, 'edit' => '1' ), home_url( '/' ) );
    345                 } else {
    346                         $url = $wp_rewrite->front . $bbp->user_slug . '/%bbp_user%/edit';
    347 
     345                // Pretty permalinks
     346                if ( $wp_rewrite->using_permalinks() ) {
     347                        $url = $wp_rewrite->root . $bbp->user_slug . '/%bbp_user%/edit';
     348
     349                        // Get username if not passed
    348350                        if ( empty( $user_nicename ) ) {
    349351                                $user = get_userdata( $user_id );
    350                                 if ( !empty( $user->user_nicename ) )
     352                                if ( !empty( $user->user_nicename ) ) {
    351353                                        $user_nicename = $user->user_nicename;
     354                                }
    352355                        }
    353356
    354357                        $url = str_replace( '%bbp_user%', $user_nicename, $url );
    355358                        $url = home_url( user_trailingslashit( $url ) );
     359
     360                // Unpretty permalinks
     361                } else {
     362                        $url = add_query_arg( array( 'bbp_user' => $user_id, 'edit' => '1' ), home_url( '/' ) );
    356363                }
    357364
Note: See TracChangeset for help on using the changeset viewer.