Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to get Group updates count using group id


  • mohammad-mursaleen
    Participant

    @mohammad-mursaleen

    Have searched and tried a lot. Looking to get count of total updates posted on group by its members.

    For Example;

    function get_total_updates_count($group_id){
    ......
    ......
    }
    

    Any help in this regard will be appreciated.

    Thanks!

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

  • mohammad-mursaleen
    Participant

    @mohammad-mursaleen

    OK finally done with the function to get what I was looking for;

    /* to get total update counts by group id*/
    
    function get_total_updates_count($group_id){
    
    	global $wpdb;
     
    	$total_updates = $wpdb->get_var( "SELECT COUNT(*) FROM wp_bp_activity 
    					  WHERE component = 'groups' 
    					  AND   type = 'activity_update'
    					  AND   item_id = '$group_id' 
                                             ");
    									  
    	return $total_updates;
    }

    And to use in groups loop you can do as following;

    <?php echo get_total_updates_count(bp_get_group_id()); ?>

    Hope this would help someone in community.


    Splendorito
    Participant

    @splendorito

    Hi,

    Nice, I’ll test it out!

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to get Group updates count using group id’ is closed to new replies.
Skip to toolbar