Skip to:
Content
Pages
Categories
Search
Top
Bottom

WordPress /author/ page and bbPress /user/ page


  • dalemiles
    Participant

    @dalemiles

    Hey guys.

    I’ve tried searching about this but not really been able to find a definitive answer, especially for my own situation.

    I currently have a live site, where users NEED to use WordPress default domain.com/author/username

    Currently when you go to the profile of a poster in the bbPress forum it takes you to a different user page domain.com/user/username

    I need this to direct to domain.com/author/username as the default WordPress profile contains information about the user (feedback ratings, post details + more – its a classified site).

    Now I’m not 100% fussed on whether the domain.com/author/username page displays post details, as the ‘forum’ I’ve having is a single forum and more like a general chat area of the site. I’m not looking to setup a fully fledged forum.

    However the most important thing is having their profiles direct to their author page instead of their bbPress user page.

    If there is code I can place in the author.php file (WordPress one) that will check their bbPress details regarding their posts, that would be great. I’ve tried copying the code from bbPress user-profile.php but that didn’t work.

    Can any one offer any assistance? I’d deeply appreciate it.

    Thanks

    bbPress: Version 2.5.8
    WordPress: Version 4.4.2
    Website: http://www.airsofttrader.co.nz (You can see the example of author pages, however bbPress is not installed on the live site – its installed locally.)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Something like this in your functions.php ?

    add_filter( 'bbp_pre_get_user_profile_url', 'casiepa_custom_author_link' );
    function casiepa_custom_author_link( $user_id ) {
    	return get_author_posts_url( $user_id, '' );
    }

    dalemiles
    Participant

    @dalemiles

    You sir are a legend, that worked perfectly.

    Would it be hard to put the user details onto my author page?
    (topics created, replies created then a list of each).

    I can create tabs at the bottom like on my current author pages and put the code to show the information in there.

    I’m afraid I won’t be able to help with that because you try to change the WordPress profile, and my knowledge is limited to bbPress profiles…


    dalemiles
    Participant

    @dalemiles

    Hi Pascal,

    Thanks, updating the wordpress profile is not a problem I can do that.

    However using the code from bbPress profile such as:

    <?php do_action( 'bbp_template_before_user_profile' ); ?>
    
    	<div id="bbp-user-profile" class="bbp-user-profile">
        <h1>View Users Trading Profile Here <?php get_the_author_id(); ?></h1>
       
    		<h2 class="entry-title"><?php _e( 'Profile', 'bbpress' ); ?></h2>
    		<div class="bbp-user-section">
    
    			<?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?>
    
    				<p class="bbp-user-description"><?php bbp_displayed_user_field( 'description' ); ?></p>
    
    			<?php endif; ?>
    
    			<p class="bbp-user-forum-role"><?php  printf( __( 'Role: %s',      'bbpress' ), bbp_get_user_display_role()    ); ?></p>
    			<p class="bbp-user-topic-count"><?php printf( __( 'Topics Started: %s',  'bbpress' ), bbp_get_user_topic_count_raw() ); ?></p>
    			<p class="bbp-user-reply-count"><?php printf( __( 'Replies Created: %s', 'bbpress' ), bbp_get_user_reply_count_raw() ); ?></p>
    		</div>
    	</div><!-- #bbp-author-topics-started -->
    
    	<?php do_action( 'bbp_template_after_user_profile' ); ?>

    added to my author.php doesn’t work.

    I presume its because its not tied to the bbPress ‘user’ profile?

    Correct, you are not in the users environment. You will have to add the user_ID so the function knows what user you refer to.

    bbp_get_user_topic_count_raw


    dalemiles
    Participant

    @dalemiles

    I don’t suppose you can tell me what I need to do to get the user_id that links up with the author profile?

    Thanks

    $current_user = wp_get_current_user();
    $user_id = $current_user->ID;
    if ( 0 == $user_id ) {
        // Not logged in.
    } else {
        // code from previous thread, use function like bbp_get_user_topic_count_raw($user_id)
    }

    Not tested ! But should be in that direction…

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Skip to toolbar