BuddyDev

Search

[Resolved] Pagination not working with Shortcodes in Profile Tabs Plugin

Tagged: 

  • Participant
    Level: Initiated
    Posts: 10
    Admin smallbizsupport on #24117

    I create a New Tab “Forum Posts under the Forums slug

    I add Shortcode for a single Forum [bbp-single-forum id=1643]

    The 1st page shown is good, showing 5 Topics at https://incahoot.org/members/user1/forums/forumposts/

    The “Next” pagination link takes me to

    https://incahoot.org/page/2/

    Which just takes me tome my homwe page

    What do I do to make the pagination work?

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24121

    Hi,
    Thank you for reporting it.

    It is a bug in bbPress shortcode. Their pagination code doe snot work with current page(if permalink is enabled).

    Please add following to your wp-content/plugins/bp-custom.php
    or in your theme’s function.php

    
    
    add_filter( 'bbp_before_bbp_topic_pagination_parse_args', function ( $args ) {
    
    	if ( ! function_exists( 'bp_is_user' ) || ! bp_is_user() ) {
    		return $args;
    	}
    	$args['base'] = add_query_arg( 'paged', '%#%' );
    
    	return $args;
    } );
    
    

    That should fix the pagination. Please let me know if it works or not?

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Admin smallbizsupport on #24249

    Hi Brajesh

    Your code produced this error:

    Your PHP code changes were rolled back due to an error on line 732 of file wp-content/themes/evolve/functions.php. Please fix and try saving again.

    syntax error, unexpected ‘&’

    The code I entered was

    /*
    From Brajesh. Fix pagination problem with Buddypress shortcodes
    ————————————— */
    add_filter( 'bbp_before_bbp_topic_pagination_parse_args', function ( $args ) {

    if ( ! function_exists( 'bp_is_user' ) || ! bp_is_user() ) {
    return $args;
    }
    $args['base'] = add_query_arg( 'paged', '%#%' );

    return $args;
    } );

    Can you fix please?

    Thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24251

    Hi,
    It seems you copied the code from forum email notification. The error is you copied entity encoded code.

    Please copy the code from my post above and use it.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24252

    The forum email notifications get encoded and that’s why you received the error.

    Regards
    Brajesh

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24344

    Hi,
    Please use this code instead. This will work.

    add_filter( 'bbp_topic_pagination', function ( $args ) {
    
    	if ( ! function_exists( 'bp_is_user' ) || ! bp_is_user() ) {
    		//return $args;
    	}
    	$args['base'] = add_query_arg( 'paged', '%#%' );
    
    	return $args;
    } );
    
    

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 10
    Admin smallbizsupport on #24433
    This reply has been marked as private.
  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24434
    This reply has been marked as private.
  • Participant
    Level: Initiated
    Posts: 10
    Admin smallbizsupport on #24435

    Sorted it, thanks

  • Keymaster
    (BuddyDev Team)
    Posts: 22213
    Brajesh Singh on #24436

    Thank you for the update. I am glad it is resolved.

    Regards
    Brajesh

The topic ‘ [Resolved] Pagination not working with Shortcodes in Profile Tabs Plugin’ is closed to new replies.

This topic is: resolved