Skip to:
Content
Pages
Categories
Search
Top
Bottom

"bp_group_widget_user_id" filter

  • @landwire

    Participant

    Hi there,

    I am trying to use this filter, but it does not seem to work at all.
    Am I doing anything wrong? The code below is in my bp-custom.php file.
    The filter is applied in bp-groups-widget.php.

    I would be glad for any help! It does not even return ‘2’, when I tried just to pass $user_id = ‘2’, in case $bp->displayed_user->id was not working.

    function ssviewed_user_id() {
        $user_id = $bp->displayed_user->id;
    	// $user_id = '2';
    	return $user_id;
    };
    
    add_filter('bp_group_widget_user_id', 'ssviewed_user_id');
Viewing 1 replies (of 1 total)
  • @kjrobbins

    Participant

    I’ve been looking for some help with this filter too and came across your post. It’s been a while but in case you’re still working on it,

    I think you need to include global $bp;

    function ssviewed_user_id( $user ) {
      global $bp;
      return $bp->displayed_user->id; 
    }
    add_filter( 'bp_group_widget_user_id', 'ssviewed_user_id', 10, 3 );

    For the record, I think it should return an integer, so your $user_id = ‘2’ should have been $user_id = 2;

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘"bp_group_widget_user_id" filter’ is closed to new replies.
Skip to toolbar