Skip to:
Content
Pages
Categories
Search
Top
Bottom

Integrating User’s ‘Topics Started’ ‘Replies Created’.. on a page


  • quigley05
    Participant

    @quigley05

    I’m customizing my buddypress/bbpress user pages to be taken out of their traditional framework and placing that data on indvidual pages. However, when I do this the code has issues recognizing the current user and automatically ignores the logged in user. Does anyone know how to resolve this issue?

    URL: http://obeii.com/discussions-topics-started/

    CODE: (topics started)

    <?php do_action( 'bbp_template_before_user_topics_created' ); ?>
    
    	<div id="bbp-user-topics-started" class="bbp-user-topics-started">
    		<div class="bbp-user-section">
    
    			<?php if ( bbp_get_user_topics_started() ) : ?>
    
    				<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
    
    				<?php bbp_get_template_part( 'loop',       'topics' ); ?>
    
    				<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
    
    			<?php else : ?>
    
    				<p><?php bbp_is_user_home() ? _e( 'You have not started any topics.', 'bbpress' ) : _e( 'This user has not started any topics.', 'bbpress' ); ?></p>
    
    			<?php endif; ?>
    
    		</div>
    	</div><!-- #bbp-user-topics-started -->
    
    <?php do_action( 'bbp_template_after_user_topics_created' ); ?>
Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W
    Moderator

    @robin-w

    untested, but try

    <?php do_action( 'bbp_template_before_user_topics_created' ); ?>
    
    	<div id="bbp-user-topics-started" class="bbp-user-topics-started">
    		<div class="bbp-user-section">
    
    <?php $user_id = get_current_user_id() ; ?>
    
    			<?php if ( bbp_get_user_topics_started($user_id ) ) : ?>
    
    				<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
    
    				<?php bbp_get_template_part( 'loop',       'topics' ); ?>
    
    				<?php bbp_get_template_part( 'pagination', 'topics' ); ?>
    
    			<?php else : ?>
    
    				<p><?php bbp_is_user_home() ? _e( 'You have not started any topics.', 'bbpress' ) : _e( 'This user has not started any topics.', 'bbpress' ); ?></p>
    
    			<?php endif; ?>
    
    		</div>
    	</div><!-- #bbp-user-topics-started -->
    
    <?php do_action( 'bbp_template_after_user_topics_created' ); ?>

    This sets the user up as current user


    quigley05
    Participant

    @quigley05

    Amazing. It worked! Thank you so much.


    Robin W
    Moderator

    @robin-w

    no problem, glad to have helped


    quigley05
    Participant

    @quigley05

    Hi Robin, Oddly enough the Subscribed forums is the only chunk that has issues with this setup. It ignores the current user with the below code. See result at https://obeii.com/discussions-subscriptions/

    	<?php do_action( 'bbp_template_before_user_subscriptions' ); ?>
    
    	<?php if ( bbp_is_subscriptions_active() ) : ?>
    
    		<?php if ( bbp_is_user_home() || current_user_can( 'edit_users' ) ) : ?>
    
    			<div id="bbp-user-subscriptions" class="bbp-user-subscriptions">
    				<h2 class="entry-title"><?php _e( 'Subscribed Forums', 'bbpress' ); ?></h2>
    				<div class="bbp-user-section">
    					
    <?php $user_id = get_current_user_id() ; ?>
    
    					<?php if ( bbp_get_user_forum_subscriptions($user_id) ) : ?>
    
    						<?php bbp_get_template_part( 'loop', 'forums' ); ?>
    
    					<?php else : ?>
    
    						<p><?php bbp_is_user_home() ? _e( 'You are not currently subscribed to any forums.', 'bbpress' ) : _e( 'This user is not currently subscribed to any forums.', 'bbpress' ); ?></p>
    
    					<?php endif; ?>
    
    				</div>
    
    		<?php endif; ?>
    
    	<?php endif; ?>
    
    	<?php do_action( 'bbp_template_after_user_subscriptions' ); ?>

    Robin W
    Moderator

    @robin-w

    so what does it do?

    display nothing
    display You are not currently subscribed to any forums
    or what?


    quigley05
    Participant

    @quigley05

    Hi Robin,

    It just ignores the current user field and says “This user is not currently subscribed to any forums.”

    See result here: https://obeii.com/discussions-subscriptions/


    josh.grisdale
    Participant

    @joshgrisdale

    I want to do this for Subscribed Forums as well, but having the same issue where it says there are no Subscribed Forums…

    was there an answer to this?

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