[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-theme-compatibility.php (summary)

BuddyPress Core Theme Compatibility.

File Size: 1018 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 28 functions

  bp_setup_theme_compat()
  bp_get_theme_compat_id()
  bp_get_theme_compat_name()
  bp_get_theme_compat_version()
  bp_get_theme_compat_dir()
  bp_get_theme_compat_url()
  bp_use_theme_compat_with_current_theme()
  bp_detect_theme_compat_with_current_theme()
  bp_is_theme_compat_active()
  bp_set_theme_compat_active()
  bp_set_theme_compat_templates()
  bp_set_theme_compat_template()
  bp_set_theme_compat_original_template()
  bp_set_theme_compat_feature()
  bp_get_theme_compat_feature()
  bp_register_theme_compat_default_features()
  bp_is_theme_compat_original_template()
  bp_register_theme_package()
  bp_theme_compat_reset_post()
  bp_template_include_theme_compat()
  bp_replace_the_content()
  bp_do_theme_compat()
  bp_remove_all_filters()
  bp_restore_all_filters()
  bp_comments_open()
  bp_theme_compat_toggle_is_page()
  bp_theme_compat_loop_end()
  bp_check_theme_template_pack_dependency()

Functions
Functions that are not part of a class:

bp_setup_theme_compat( $theme = '' )   X-Ref
Set up the default theme compat theme.

since: 1.7.0
param: string $theme Optional. The unique ID identifier of a theme package.

bp_get_theme_compat_id()   X-Ref
Get the ID of the theme package being used.

This can be filtered or set manually. Tricky theme authors can override the
default and include their own BuddyPress compatibility layers for their themes.

return: string ID of the theme package in use.
since: 1.7.0

bp_get_theme_compat_name()   X-Ref
Get the name of the theme package being used.

This can be filtered or set manually. Tricky theme authors can override the
default and include their own BuddyPress compatibility layers for their themes.

return: string Name of the theme package currently in use.
since: 1.7.0

bp_get_theme_compat_version()   X-Ref
Get the version of the theme package being used.

This can be filtered or set manually. Tricky theme authors can override the
default and include their own BuddyPress compatibility layers for their themes.

return: string The version string of the theme package currently in use.
since: 1.7.0

bp_get_theme_compat_dir()   X-Ref
Get the absolute path of the theme package being used.

Or set manually. Tricky theme authors can override the default and include
their own BuddyPress compatibility layers for their themes.

return: string The absolute path of the theme package currently in use.
since: 1.7.0

bp_get_theme_compat_url()   X-Ref
Get the URL of the theme package being used.

This can be filtered, or set manually. Tricky theme authors can override
the default and include their own BuddyPress compatibility layers for their
themes.

return: string URL of the theme package currently in use.
since: 1.7.0

bp_use_theme_compat_with_current_theme()   X-Ref
Should we use theme compat for this theme?

If the current theme's need for theme compat hasn't yet been detected, we
do so using bp_detect_theme_compat_with_current_theme().

return: bool True if the current theme needs theme compatibility.
since: 1.9.0

bp_detect_theme_compat_with_current_theme()   X-Ref
Set our flag to determine whether theme compat should be enabled.

Theme compat is disabled when a theme meets one of the following criteria:
1) It declares BP support with add_theme_support( 'buddypress' )
2) It is bp-default, or a child theme of bp-default
3) A legacy template is found at members/members-loop.php. This is a
fallback check for themes that were derived from bp-default, and have
not been updated for BP 1.7+; we make the assumption that any theme in
this category will have the members-loop.php template, and so use its
presence as an indicator that theme compatibility is not required.

return: bool True if the current theme needs theme compatibility.
since: 1.9.0

bp_is_theme_compat_active()   X-Ref
Is the current page using theme compatibility?

return: bool True if the current page uses theme compatibility.
since: 1.7.0

bp_set_theme_compat_active( $set = true )   X-Ref
Set the flag that tells whether the current page is using theme compatibility.

return: bool Returns the value of $set.
since: 1.7.0
param: bool $set True to set the flag to true, false to set it to false.

bp_set_theme_compat_templates( $templates = array()   X-Ref
Set the theme compat templates global.

Stash possible template files for the current query. Useful if plugins want
to override them, or see what files are being scanned for inclusion.

return: array The template stack (value of $templates).
since: 1.7.0
param: array $templates The template stack.

bp_set_theme_compat_template( $template = '' )   X-Ref
Set the theme compat template global.

Stash the template file for the current query. Useful if plugins want
to override it, or see what file is being included.

return: string The template currently in use (value of $template).
since: 1.7.0
param: string $template The template currently in use.

bp_set_theme_compat_original_template( $template = '' )   X-Ref
Set the theme compat original_template global.

Stash the original template file for the current query. Useful for checking
if BuddyPress was able to find a more appropriate template.

return: string The template originally selected by WP (value of $template).
since: 1.7.0
param: string $template The template originally selected by WP.

bp_set_theme_compat_feature( $theme_id, $feature = array()   X-Ref
Set a theme compat feature

since: 2.4.0
param: string $theme_id The theme id (eg: legacy).
param: array  $feature  An associative array (eg: array( name => 'feature_name', 'settings' => array() )).

bp_get_theme_compat_feature( $feature = '' )   X-Ref
Get a theme compat feature

return: object The feature settings.
since: 2.4.0
param: string $feature The feature (eg: cover_image).

bp_register_theme_compat_default_features()   X-Ref
Setup the theme's features.

Note: BP Legacy's buddypress-functions.php is not loaded in WP Administration
as it's loaded using bp_locate_template(). That's why this function is here.

since: 2.4.0

bp_is_theme_compat_original_template( $template = '' )   X-Ref
Check whether a given template is the one that WP originally selected to display current page.

return: bool True if the value of $template is the same as the
since: 1.7.0
param: string $template The template name to check.

bp_register_theme_package( $theme = array()   X-Ref
Register a new BuddyPress theme package in the active theme packages array.

For an example of how this function is used, see:
{@link BuddyPress::register_theme_packages()}.

since: 1.7.0
param: array $theme    See {@link BP_Theme_Compat}.
param: bool  $override If true, overrides whatever package is currently set.

bp_theme_compat_reset_post( $args = array()   X-Ref
Populate various WordPress globals with dummy data to prevent errors.

This dummy data is necessary because theme compatibility essentially fakes
WordPress into thinking that there is content where, in fact, there is none
(at least, no WordPress post content). By providing dummy data, we ensure
that template functions - things like is_page() - don't throw errors.

since: 1.7.0
param: array $args Array of optional arguments. Arguments parallel the properties

bp_template_include_theme_compat( $template = '' )   X-Ref
Reset main query vars and filter 'the_content' to output a BuddyPress template part as needed.

return: string $template Template name.
since: 1.7.0
param: string $template Template name.

bp_replace_the_content( $content = '' )   X-Ref
Conditionally replace 'the_content'.

Replaces the_content() if the post_type being displayed is one that would
normally be handled by BuddyPress, but proper single page templates do not
exist in the currently active theme.

return: string $content Post content, potentially modified.
since: 1.7.0
param: string $content Original post content.

bp_do_theme_compat()   X-Ref
Are we currently replacing the_content?

return: bool True if the_content is currently in the process of being
since: 1.8.0

bp_remove_all_filters( $tag, $priority = false )   X-Ref
Remove all filters from a WordPress filter hook.

Removed filters are stashed in the $bp global, in case they need to be
restored later.

return: bool True on success.
since: 1.7.0
param: string   $tag      The filter tag to remove filters from.
param: int|bool $priority Optional. If present, only those callbacks attached

bp_restore_all_filters( $tag, $priority = false )   X-Ref
Restore filters that were removed using bp_remove_all_filters().

return: bool True on success.
since: 1.7.0
param: string   $tag      The tag to which filters should be restored.
param: int|bool $priority Optional. If present, only those filters that were originally

bp_comments_open( $open, $post_id = 0 )   X-Ref
Force comments_status to 'closed' for BuddyPress post types.

return: bool True if open, false if closed.
since: 1.7.0
param: bool $open    True if open, false if closed.
param: int  $post_id ID of the post to check.

bp_theme_compat_toggle_is_page( $retval = '' )   X-Ref
Do not allow {@link comments_template()} to render during theme compatibility.

When theme compatibility sets the 'is_page' flag to true via
{@link bp_theme_compat_reset_post()}, themes that use comments_template()
in their page template will run.

To prevent comments_template() from rendering, we set the 'is_page' and
'is_single' flags to false since that function looks at these conditionals
before querying the database for comments and loading the comments template.

This is done during the output buffer as late as possible to prevent any
wonkiness.

return: string $retval
since: 1.9.2
param: string $retval The current post content.

bp_theme_compat_loop_end( $query )   X-Ref
Restores the 'is_single' and 'is_page' flags if toggled by BuddyPress.

since: 1.9.2
param: object $query The WP_Query object.

bp_check_theme_template_pack_dependency()   X-Ref
Maybe override the preferred template pack if the theme declares a dependency.

since: 3.0.0



Generated: Tue Nov 12 01:00:54 2024 Cross-referenced by PHPXref 0.7.1