Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • jeffw
  • andy

Support for: Mingle – Multi-purpose WordPress Theme

Mingle (WordPress)

Public Group  |  active 7 months ago ago
Viewing post 1 to 15 (18 total posts)

(solved) BuddyPress Load More button not working

  • ciara

    said

    The “Load More” link at the bottom of the activity streams is not working. If you click it, the page reloads with the current stream and the link disappears. Any thoughts on why this would not be working would be greatly appreciated.

  • andy

    said

    This is the result of BuddyPress using a parent/child relationships in the DOM manipulation to locate the insert position of the new items. If you alter the BP template files at all by creating a new HTML container it will cause the JavaScript function to fail. I’m sure it’s something they’re planning to improve. For now you can use the code below to do a more efficient method that doesn’t rely on DOM relationships but class names instead.

    Open “activity/activity-loop.php” and add this at the end of the file:

    <script type="text/javascript">
    /* Fix for BP default "load more" */
    if (jq) {
      // remove the default BP click event
      jq('ul.activity-list li.load-more a').unbind('click'); 
      // Assign a new click behavior for 'load more' (again, necessary because of dumb references to containers like "#content")
      jq('ul.activity-list li.load-more a').click(function() {
        $parent = jq(this).parent('li.load-more');
        $parent.addClass('loading');
     
        if ( null == jq.cookie('bp-activity-oldestpage') )
          jq.cookie('bp-activity-oldestpage', 1, {path: '/'} );
      
        var oldest_page = ( jq.cookie('bp-activity-oldestpage') * 1 ) + 1;
      
        jq.post( ajaxurl, {
          action: 'activity_get_older_updates',
          'cookie': encodeURIComponent(document.cookie),
          'page': oldest_page
        },
        function(response) {
          $parent.removeClass('loading');
          jq.cookie( 'bp-activity-oldestpage', oldest_page, {path: '/'} );
          jq("div.activity ul.activity-list").append(response.contents);
      
          $parent.hide();
        }, 'json' );
        
        return false;
      });
    }
    </script>

    Please let me know if you have any problems.

  • webshow

    said

    Perfect, worked for me also ! Thank you.

  • mymktp1

    said

    Just wanted to say thank you and show my appreciation … this worked for me too.!

  • kantibit

    said

    @andy: I added the code as you suggest, but it doesn’t work on my site. Anything else I should check or do?

  • jeffw

    said

    @kantibit Andy is on vacation for a week starting today. As you can see, Andy’s fix worked for three people so I think he will not be revisiting this topic. I recommend you put it all back the way it was and then try again. Take your time, you have plenty of it, it will be at least seven days before Andy will see your post. ;)

  • kantibit

    said

    @jeffw Thanks for your quick response. I think when you get more time than you need, things just fall in place. I copy-pasted the code again, and it works fine now! :-)

    Enjoy your holiday, Andy!

  • andy

    said

    @kantibit

    Glad to hear it worked, and thanks for the well wishes. The vacation was great, and very much needed. I’m back now and ready for action!

  • kantibit

    said

    @andy – Glad to hear you had a great vacation. I’m looking forward to mine! :-)

  • peeld

    said

    This worked like a charm for me as well, thanks!

  • fogarty

    said

    Hey,
    Sorry to bother but been turning this around and around with no positive results so far and would really need help here… :-(
    WP 3.4 – BP 1.5.6
    When adding the script I finally get the loading event but never get any more content
    - Works find with all plugins and default theme
    - Don’t work with Mingle, even with all plugins deactivated

    By tracking in dev tools on Safari I see all the script being executed and values being correct but never get the response…

    thanks for the help,
    Cheers,

  • wais

    said

    Solved my problem too, thx guys you are great!!

    Wais

Viewing post 1 to 15 (18 total posts)
Topic tags: activity stream, Load More