Skip to:
Content
Pages
Categories
Search
Top
Bottom

Replies Created & Subscribed Forums


  • quigley05
    Participant

    @quigley05

    I am having issues placing a current user’s ‘Replies Created’ and ‘Subscribed Forums’ within their unique templates. See below.

    ‘Replies Created’ (login testuser / test1234)
    https://obeii.com/discussions-replies-created/
    Code seems to just want to display all replies instead of the specific users. How can this be corrected to be filtered to that specific user?

    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_replies_created( $uid ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    <?php else : ?>
        <p><?php _e( 'You have not replied to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>	

    ‘Subscribed Forums’ (login testuser / test1234)
    https://obeii.com/discussions-subscriptions/
    It works fine for ‘Subscribed Topics’ below the item, however ‘Subscribed Forums’ comes up empty with no results. Any clue on why that is?

    <h2>Subscribed Forums</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_forum_subscriptions( $uid ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
        <?php bbp_get_template_part( 'loop', 'forums' ); ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
    <?php else : ?>
        <p><?php _e( 'You are not currently subscribed to any forums.', 'bbpress' ); ?></p>
    <?php endif; ?>
Viewing 18 replies - 1 through 18 (of 18 total)

  • quigley05
    Participant

    @quigley05

    Any ideas? I keep scratching my head on this one. The code couldn’t be more clear to pull all data from the current user but it seems to ignore it..

    Any help at all would be greatly appreciated. Thanks!


    Robin W
    Moderator

    @robin-w

    untested but try

    <?php add_filter ('bbp_before_has_replies_parse_args' , 'rew_filter_for_user' ) ; ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>

    and in your functions file put

    function rew_filter_for_user ($args) {
    //not sure if the next two lines are needed, so have commented out
    //global $current_user;
    //get_currentuserinfo();
    $uid = bbp_get_current_user_id();
    $args[‘author’] => $uid ;
    return $args

    }

    loop-replies from memory has the ‘no relies’ part in it, so you shouldn’t need the ‘if’ statement
    I’m really pushed at the moment hence no time to test, but if it doesn’t work come back, and if I get time I’ll load it to my test site and debug


    quigley05
    Participant

    @quigley05

    Hi Robin,

    Thanks for the quick response. Unfortunately this function caused errors for me and ultimately caused the website to hang so I reverted. Let me know how I can better help you troubleshoot this with me.

    Thanks again!


    Robin W
    Moderator

    @robin-w

    ok, quick debug of the function, so this won’t error (and will hopefully work!)

    function rew_filter_for_user ($args) {
     //not sure if the next two lines are needed, so have commented out
     //global $current_user;
     //get_currentuserinfo();
     $uid = bbp_get_current_user_id();
     $args[‘author’] = $uid ;
     return $args ;
    }
    

    quigley05
    Participant

    @quigley05

    Hi Robin,

    I’ve placed the following code into my page template:

    <?php add_filter ('bbp_before_has_replies_parse_args' , 'rew_filter_for_user' ) ; ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>

    I also placed the revised code into my theme functions:

    function rew_filter_for_user ($args) {
     //not sure if the next two lines are needed, so have commented out
     //global $current_user;
     //get_currentuserinfo();
     $uid = bbp_get_current_user_id();
     $args[‘author’] = $uid ;
     return $args ;
    }

    However, doing this results in a blank page for the user.


    Robin W
    Moderator

    @robin-w

    can you post the entire template for me please, and tell me which template it is replacing


    quigley05
    Participant

    @quigley05

    Hi Robin,

    The ‘Replies Created’ template is replacing the one originally within the buddypress profile section.
    (https://obeii.com/discussions-replies-created/) (testuser / test1234)

    <?php
    /*
    Template Name: Discussions Replies Created
    */
    get_header();
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    				
    <div id="bbpress-forums">
    	<?php do_action( 'bbp_template_before_user_replies' ); ?>
    
    	<div id="bbp-user-replies-created" class="bbp-user-replies-created">
    		<div class="bbp-user-section">
    
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_replies_created( $user_id = bp_loggedin_user_id() ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    <?php else : ?>
        <p><?php _e( 'You have not replied to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>	
    
    		</div>
    	</div>
    </div>				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    The ‘Subscribed Forums’ template is also replacing the one originally within the buddypress profile section. It also contains ‘Subscribed Topics’ using similar code and that sections works as expected.
    (https://obeii.com/discussions-subscriptions/) (testuser / test1234)

    <?php
    /*
    Template Name: Discussions Subscriptions
    */
    get_header();
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    <div id="bbpress-forums">				
    <div id="bbp-user-subscriptions" class="bbp-user-subscriptions">				
    				
    <h2>Subscribed Forums</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_forum_subscriptions( $uid ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
        <?php bbp_get_template_part( 'loop', 'forums' ); ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
    <?php else : ?>
        <p><?php _e( 'You are not currently subscribed to any forums.', 'bbpress' ); ?></p>
    <?php endif; ?>
    				
    <br><br>	
    				
    <h2>Subscribed Topics</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_topic_subscriptions( $uid ) ) : ?>
        <?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 _e( 'You are not currently subscribed to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>
    
    </div>
    </div>				
    				
    				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    Robin W
    Moderator

    @robin-w

    sorry, I have been tied up elsewhere, I will try and return to this in the next few days, but family business is keeping me away


    quigley05
    Participant

    @quigley05

    Thanks @nashraf. What exactly in the code did you change? It seems to cross check the same and deliver the same results unfortunately..

    Thanks again Robin and @nashraf for all the support on this.


    Robin W
    Moderator

    @robin-w

    nashraf was a spam post

    So where is buddypress is the replies created template stored – give me the full path, and where in your theme are you putting it – again the path (you can use example.com if you want)


    quigley05
    Participant

    @quigley05

    Hi Robin,

    If you are referring to the url path they live within:

    example.com/discussions/replies/

    example.com/discussions/subscriptions/


    Robin W
    Moderator

    @robin-w

    ok, can I ask what you are trying to achieve?

    where does this display ?

    is this in buddypress or bbpress screen?


    quigley05
    Participant

    @quigley05

    Hi Robin,

    I’m pasting what I’ve wrote in earlier messages as the issue hasn’t changed. Feel free to access these pages through the login as I think that will help clarify things.

    The ‘Replies Created’ template is replacing the one originally within the buddypress profile section. It currently displays a list of all global replies within the forum, versus just the current user’s replies.
    (https://obeii.com/discussions/replies/) (testuser / test1234)

    <?php
    /*
    Template Name: Discussions Replies Created
    */
    get_header();
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    				
    <div id="bbpress-forums">
    	<?php do_action( 'bbp_template_before_user_replies' ); ?>
    
    	<div id="bbp-user-replies-created" class="bbp-user-replies-created">
    		<div class="bbp-user-section">
    
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_replies_created( $user_id = bp_loggedin_user_id() ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    <?php else : ?>
        <p><?php _e( 'You have not replied to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>	
    
    		</div>
    	</div>
    </div>				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    The ‘Subscribed Forums’ template is also replacing the one originally within the Buddypress profile section. It currently ignores the current user and claims they have no content even though they do. The page also contains ‘Subscribed Topics’ using similar code, which that sections works as expected with no known issues.
    (https://obeii.com/discussions/subscriptions/) (testuser / test1234)

    <?php
    /*
    Template Name: Discussions Subscriptions
    */
    get_header();
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    <div id="bbpress-forums">				
    <div id="bbp-user-subscriptions" class="bbp-user-subscriptions">				
    				
    <h2>Subscribed Forums</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_forum_subscriptions( $uid ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
        <?php bbp_get_template_part( 'loop', 'forums' ); ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
    <?php else : ?>
        <p><?php _e( 'You are not currently subscribed to any forums.', 'bbpress' ); ?></p>
    <?php endif; ?>
    				
    <br><br>	
    				
    <h2>Subscribed Topics</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_topic_subscriptions( $uid ) ) : ?>
        <?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 _e( 'You are not currently subscribed to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>
    
    </div>
    </div>				
    				
    				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    Robin W
    Moderator

    @robin-w

    ok, I get that, but where are you placing the template within your site, and what is it called?


    quigley05
    Participant

    @quigley05

    Hi Robin,

    Not quite sure I understand the question. The template names are mentioned within the code I provided and they are located in a page I’ve created in the WordPress backend, not one that is already provided within Buddypress or BBpress.

    Would it be at all helpful to receive access to my backend? Hope this was helpful.


    Robin W
    Moderator

    @robin-w

    access wont help.

    I am trying to replicate your situation on my test site, where I have tools that do lots of things for me.

    So what I need is how you get to make https://obeii.com/discussions/replies/ do what it does.

    for instance

    create a page called x in wordpress, put this in it
    put the template file in folder y called z.php

    ie all the steps I need to recreate the issue. I can hopefully fix.


    quigley05
    Participant

    @quigley05

    1. I created a new template file titled discussions-replies and discussions-subscriptions under my WordPress child theme.

    2. I placed within discussions-replies the following code:

    <?php
    /*
    Template Name: Discussions Replies Created
    */
    get_header();
    
    // Page options
    $header = ghostpool_option( 'page_header' ) == 'default' ? ghostpool_option( 'page_page_header' ) : ghostpool_option( 'page_header' );
    $height = ghostpool_option( 'page_header_height', 'padding-bottom' ) != '' ? ghostpool_option( 'page_header_height', 'padding-bottom' ) : ghostpool_option( 'page_page_header_height', 'height' );
    $format = ghostpool_option( 'blog_format' );
    $style = ghostpool_option( 'blog_style' );
    $alignment = ghostpool_option( 'blog_alignment' );
    $cats = ghostpool_option( 'blog_cats' ) ? implode( ',', ghostpool_option( 'blog_cats' ) ) : '';
    $post_types = ghostpool_option( 'blog_post_types' ) ? implode( ',', ghostpool_option( 'blog_post_types' ) ) : ghostpool_option( 'blog_post_types' );
    $orderby = ghostpool_option( 'blog_orderby' );
    $per_page = ghostpool_option( 'blog_per_page' );
    $offset = ghostpool_option( 'blog_offset' );
    $image_size = ghostpool_option( 'blog_image_size' );
    $content_display = ghostpool_option( 'blog_content_display' );	
    $excerpt_length = ghostpool_option( 'blog_excerpt_length' );
    $meta_author = ghostpool_option( 'blog_meta', 'author' );
    $meta_date = ghostpool_option( 'blog_meta', 'date' );
    $meta_comment_count = ghostpool_option( 'blog_meta', 'comment_count' );
    $meta_views = ghostpool_option( 'blog_meta', 'views' );
    $meta_likes = ghostpool_option( 'blog_meta', 'likes' );
    $meta_cats = ghostpool_option( 'blog_meta', 'cats' );
    $meta_tags = ghostpool_option( 'blog_meta', 'tags' );
    $read_more_link = ghostpool_option( 'blog_read_more_link' );
    $pagination = 'page-numbers';
    
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    				
    <div id="bbpress-forums">
    	<?php do_action( 'bbp_template_before_user_replies' ); ?>
    
    	<div id="bbp-user-replies-created" class="bbp-user-replies-created">
    		<div class="bbp-user-section">
    
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_replies_created( $user_id = bp_loggedin_user_id() ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    <?php else : ?>
        <p><?php _e( 'You have not replied to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>	
    
    		</div>
    	</div>
    </div>				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    In discussions-subscriptions template I inserted the following code:

    <?php
    /*
    Template Name: Discussions Subscriptions
    */
    get_header();
    
    // Page options
    $header = ghostpool_option( 'page_header' ) == 'default' ? ghostpool_option( 'page_page_header' ) : ghostpool_option( 'page_header' );
    $height = ghostpool_option( 'page_header_height', 'padding-bottom' ) != '' ? ghostpool_option( 'page_header_height', 'padding-bottom' ) : ghostpool_option( 'page_page_header_height', 'height' );
    $format = ghostpool_option( 'blog_format' );
    $style = ghostpool_option( 'blog_style' );
    $alignment = ghostpool_option( 'blog_alignment' );
    $cats = ghostpool_option( 'blog_cats' ) ? implode( ',', ghostpool_option( 'blog_cats' ) ) : '';
    $post_types = ghostpool_option( 'blog_post_types' ) ? implode( ',', ghostpool_option( 'blog_post_types' ) ) : ghostpool_option( 'blog_post_types' );
    $orderby = ghostpool_option( 'blog_orderby' );
    $per_page = ghostpool_option( 'blog_per_page' );
    $offset = ghostpool_option( 'blog_offset' );
    $image_size = ghostpool_option( 'blog_image_size' );
    $content_display = ghostpool_option( 'blog_content_display' );	
    $excerpt_length = ghostpool_option( 'blog_excerpt_length' );
    $meta_author = ghostpool_option( 'blog_meta', 'author' );
    $meta_date = ghostpool_option( 'blog_meta', 'date' );
    $meta_comment_count = ghostpool_option( 'blog_meta', 'comment_count' );
    $meta_views = ghostpool_option( 'blog_meta', 'views' );
    $meta_likes = ghostpool_option( 'blog_meta', 'likes' );
    $meta_cats = ghostpool_option( 'blog_meta', 'cats' );
    $meta_tags = ghostpool_option( 'blog_meta', 'tags' );
    $read_more_link = ghostpool_option( 'blog_read_more_link' );
    $pagination = 'page-numbers';
    
    ?>
    
    <div class="sub-nav-container">
    	<div class="sub-nav-pagetitle">
    		<h1><?php the_title(); ?></h1>
    	</div>
    	<div class="sub-nav-about-menu">
    		<?php wp_nav_menu( array( 'theme_location' => 'sub-nav-discuss-menu', 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'sub-nav-discuss-menu', 'fallback_cb' => 'null', 'walker' => new Ghostpool_Custom_Menu ) ); ?>
    	</div>
    	<div class="sub-nav-extramenu">
    	</div>
    </div>
    
    <div id="gp-content-wrapper" class="gp-container">
    
    	<?php do_action( 'ghostpool_begin_content_wrapper' ); ?>
    			
    	<div id="gp-inner-container">
    		
    		<div id="gp-content">
    
    			<div class="gp-entry-content">
    				
    <div id="bbpress-forums">				
    <div id="bbp-user-subscriptions" class="bbp-user-subscriptions">				
    				
    <h2>Subscribed Forums</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_forum_subscriptions( $uid ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
        <?php bbp_get_template_part( 'loop', 'forums' ); ?>
        <?php bbp_get_template_part( 'pagination', 'forums' ); ?>
    <?php else : ?>
        <p><?php _e( 'You are not currently subscribed to any forums.', 'bbpress' ); ?></p>
    <?php endif; ?>
    				
    <br><br>	
    				
    <h2>Subscribed Topics</h2>				
    <?php global $current_user; get_currentuserinfo(); $uid = bbp_get_current_user_id(); ?>
    <?php if ( bbp_get_user_topic_subscriptions( $uid ) ) : ?>
        <?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 _e( 'You are not currently subscribed to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>
    
    </div>
    </div>				
    				
    				
    				
    			</div>
    			
    		</div>
    			
    		<?php get_sidebar( 'left' ); ?>
    
    		<?php get_sidebar( 'right' ); ?>
    
    	</div>
    	
    	<?php do_action( 'ghostpool_end_content_wrapper' ); ?>
    				
    	<div class="gp-clear"></div>
    	
    </div>
    
    <?php get_footer(); ?>

    3. I then created two new pages with WordPress under their parent named “Discussions”, one page titled Replies and the other Subscriptions. I then assigned each page to their proper template that I just had created.

    4. Now when I load the pages, the code is asking for a current user, however it ignores and shows on Replies all replies made by all users; on Subscriptions it shows that the user has made NO subscriptions, even though they have.


    Robin W
    Moderator

    @robin-w

    ok, so this works on my test site

    in discussions-replies

    
    <?php add_filter ('bbp_before_has_replies_parse_args' , 'rew_filter_for_user' ) ?>
    <?php if ( bbp_get_user_replies_created( $user_id = bp_loggedin_user_id() ) ) : ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
        <?php bbp_get_template_part( 'loop', 'replies' ); ?>
        <?php bbp_get_template_part( 'pagination', 'replies' ); ?>
    <?php else : ?>
        <p><?php _e( 'You have not replied to any topics.', 'bbpress' ); ?></p>
    <?php endif; ?>	

    and in functions

    function rew_filter_for_user ($args) {
     $uid = bbp_get_current_user_id();
     $args['author'] = $uid ;
     return $args ;
    }

    let me know if it works on yours

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