Skip to:
Content
Pages
Categories
Search
Top
Bottom

Pagination no-ajax bug


  • ripulkr
    Participant

    @ripulkr

    If I want to add custom members per page for a group and disable the ajax pagination.
    The pagination stops working. The same issue occurs in my custom module built on similar lines to that of BP Groups.
    The issue is replicable in Twenty Fifteen and BuddyPress 2.1.1

    Please suggest how to fix this, or approach it alternate way.

Viewing 2 replies - 1 through 2 (of 2 total)

  • r-a-y
    Keymaster

    @r-a-y

    This should be fixed when BuddyPress 2.2 is out:
    https://buddypress.trac.wordpress.org/ticket/5967

    If you have a testing environment, you can test out 2.2-beta 2:

    BuddyPress 2.2 – Beta 2


    ripulkr
    Participant

    @ripulkr

    For now, I have implemented this fix :

    add_filter('bp_get_messages_pagination','correct_buddypress_pagination');
    add_filter('bp_get_members_pagination_links','correct_buddypress_pagination');
    add_filter('bp_course_get_item_pagination','correct_buddypress_pagination');
    function correct_buddypress_pagination($pagination){
    	global $items_template;
    	if($_GET['items_page'] || $_GET['mlpage'] || $_GET['mpage']){
    		preg_match_all('/.+(mlpage|items_page|mpage).([1-9]+).+([1-9]+).+/',$pagination, $matches);
    		if(isset($matches[2]) && isset($matches[3])){
    			if(is_array($matches[2]) && count($matches[2])){
    				foreach($matches[2] as $k=>$match){
    
    					if($match != $matches[3][$k]){
    						$search =$matches[1][$k]."=".$match."'>".$matches[3][$k];
    						$replace=$matches[1][$k]."=".$matches[3][$k]."'>".$matches[3][$k];
    						$pagination = str_replace($search,$replace,$pagination);
    					}
    				}
    			}
    		}
    	}
    	return $pagination;
    }

    I guess it should not have any impact when BuddyPress 2.2 update is released.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pagination no-ajax bug’ is closed to new replies.
Skip to toolbar