LLMS_Integration_Buddypress::get_profile_endpoints( bool $active_only = true )
Get a list of custom endpoints to add to BuddyPress profile page.
Parameters Parameters
- $active_only
-
(bool) (Optional) If true, returns only active endpoints.
Default value: true
Return Return
(array)
Source Source
File: includes/integrations/class.llms.integration.buddypress.php
public function get_profile_endpoints( $active_only = true ) {
if ( ! isset( $this->endpoints ) ) {
$this->populate_profile_endpoints();
}
// Remove endpoints that don't have an 'endpoint' value.
$endpoints = array_filter(
$this->endpoints,
function ( $endpoint ) {
return ! empty( $endpoint['endpoint'] );
}
);
if ( $active_only ) {
// If no endpoints are saved an empty string is returned.
$active = $this->get_option( 'profile_endpoints', array_keys( $endpoints ) );
// Filter active endpoints only.
$endpoints = '' === $active
?
array()
:
array_intersect_key(
$endpoints,
array_flip( $active )
);
}
return $endpoints;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 6.8.0 | Remove redundant check on is_null(): isset() already implies it. |
| 6.3.0 | Introduced. |