I am trying to create a letter archive for the users on their buddypress profile page. The letters are displayed in the profile page tab, but the pagination is not working.

$contest_args = array(
    'per_page'   => 5,
    'user_id'    => bp_displayed_user_id(),
    'page'       => $page,
    'action'     => 'activity_update',
    'meta_query' => array(
            'key'     => 'contest_id',
            'compare' => 'NOT EXISTS',

$activities_template = new BP_Activity_Template($contest_args);

I use bp_activity_pagination_count() for pagination count and bp_pagination_links for pagination links. But the pagination count and pagination links are not working.

Here is the code:

<h2 class="text-center mt-3 mb-5"><?php echo bp_core_get_username(bp_displayed_user_id()); ?>'s Letters</h2>

if ( bp_has_activities($contest_args) ) : ?>
    <div id="pag-top" class="pagination w-100 d-flex justify-content-between align-items-center mb-3">
        <div class="pag-count" id="group-dir-count-top">
        <?php echo bp_get_activity_pagination_count( ); ?>

        <div class="pagination-links" id="group-dir-pag-top">
            <?php echo bp_get_activity_pagination_links(); ?>          

    <div class="letters d-flex flex-wrap">
        <?php while ( bp_activities() ) : bp_the_activity(); ?>
        <?php    echo get_contest_entry_lockup(bp_get_activity_id());?>
<?php         endwhile; ?>

    <div id="pag-bottom" class="pagination w-100 d-flex justify-content-between align-items-center mb-5">
        <div class="pag-count" id="group-dir-count-bottom">
            <?php echo bp_get_activity_pagination_count(); ?>
        <div class="pagination-links" id="group-dir-pag-bottom">
            <?php echo bp_get_activity_pagination_links(); ?>

<?php else : ?>
        <h2><?php echo bp_core_get_username(bp_displayed_user_id()); ?> hasn't written a letter yet.</h2>
<?php endif;


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.