BP_REST_Activity_Endpoint::bp_rest_activity_default_scope( string $scope = 'all', int $user_id, int $group_id )
Get default scope for the activity – from: bp_activity_default_scope();
Description
Parameters
- $scope
-
(Optional) Default scope.
Default value: 'all'
- $user_id
-
(Required) User ID.
- $group_id
-
(Required) Group ID.
Return
(string)
Source
File: bp-activity/classes/class-bp-rest-activity-endpoint.php
1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 | public function bp_rest_activity_default_scope( $scope = 'all' , $user_id = 0, $group_id = 0 ) { $new_scope = array (); if ( bp_loggedin_user_id() && ( 'all' === $scope || empty ( $scope ) ) ) { $new_scope [] = 'public' ; if ( bp_is_active( 'group' ) && ! empty ( $group_id ) ) { $new_scope [] = 'groups' ; } else { $new_scope [] = 'just-me' ; if ( empty ( $user_id ) ) { $new_scope [] = 'public' ; } if ( function_exists( 'bp_activity_do_mentions' ) && bp_activity_do_mentions() ) { $new_scope [] = 'mentions' ; } if ( bp_is_active( 'friends' ) ) { $new_scope [] = 'friends' ; } if ( bp_is_active( 'groups' ) ) { $new_scope [] = 'groups' ; } if ( function_exists( 'bp_is_activity_follow_active' ) && bp_is_activity_follow_active() ) { $new_scope [] = 'following' ; } if ( bp_is_single_activity() && bp_is_active( 'media' ) ) { $new_scope [] = 'media' ; $new_scope [] = 'document' ; } } } elseif ( ! bp_loggedin_user_id() && ( 'all' === $scope || empty ( $scope ) ) ) { $new_scope [] = 'public' ; } $new_scope = array_unique ( $new_scope ); if ( empty ( $new_scope ) ) { $new_scope = ( array ) $scope ; } /** * Filter to update default scope. */ $new_scope = apply_filters( 'bp_rest_activity_default_scope' , $new_scope ); return implode( ',' , $new_scope ); } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.