[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-core/ -> bp-core-catchuri.php (summary)

BuddyPress URI catcher. Functions for parsing the URI and determining which BuddyPress template file to use on-screen.

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

Defines 18 functions

  bp_core_set_uri_globals()
  bp_core_enable_root_profiles()
  bp_core_load_template()
  bp_core_catch_profile_uri()
  bp_core_members_shortlink_redirector()
  bp_core_catch_no_access()
  bp_core_no_access()
  bp_login_redirector()
  bp_core_no_access_wp_login_error()
  bp_core_login_filter_shake_codes()
  bp_redirect_canonical()
  bp_rel_canonical()
  bp_get_canonical_url()
  bp_get_requested_url()
  _bp_maybe_remove_redirect_canonical()
  _bp_rehook_maybe_redirect_404()
  _bp_maybe_remove_rel_canonical()
  bp_core_filter_wp_query()

Functions
Functions that are not part of a class:

bp_core_set_uri_globals()   X-Ref
Analyze the URI and break it down into BuddyPress-usable chunks.

BuddyPress can use complete custom friendly URIs without the user having to
add new rewrite rules. Custom components are able to use their own custom
URI structures with very little work.

The URIs are broken down as follows:
- http:// example.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...
- OUTSIDE ROOT: http:// example.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ...

Example:
- http://example.com/members/andy/profile/edit/group/5/
- $bp->current_component: string 'xprofile'
- $bp->current_action: string 'edit'
- $bp->action_variables: array ['group', 5]

since: 1.0.0

bp_core_enable_root_profiles()   X-Ref
Are root profiles enabled and allowed?

since: 1.6.0
return: bool True if yes, false if no.

bp_core_load_template( $templates )   X-Ref
Load a specific template file with fallback support.

Example:
bp_core_load_template( 'members/index' );
Loads:
wp-content/themes/[activated_theme]/members/index.php

param: array $templates Array of templates to attempt to load.
since: 1.0.0

bp_core_catch_profile_uri()   X-Ref
Redirect away from /profile URIs if XProfile is not enabled.

since: 1.0.0

bp_core_members_shortlink_redirector( $member_slug )   X-Ref
Members user shortlink redirector.

Redirects x.com/members/me/* to x.com/members/{LOGGED_IN_USER_SLUG}/*

param: string $member_slug The current member slug.
since: 2.6.0
return: string $member_slug The current member slug.

bp_core_catch_no_access()   X-Ref
Catch unauthorized access to certain BuddyPress pages and redirect accordingly.

since: 1.5.0

bp_core_no_access( $args = '' )   X-Ref
Redirect a user to log in for BP pages that require access control.

Add an error message (if one is provided).

If authenticated, redirects user back to requested content by default.

param: array|string $args {
since: 1.5.0

bp_login_redirector()   X-Ref
Login redirector.

If a link is not publicly available, we can send members from external
locations, like following links in an email, through the login screen.

If a user clicks on this link and is already logged in, we should attempt
to redirect the user to the authorized content instead of forcing the user
to re-authenticate.

since: 2.9.0

bp_core_no_access_wp_login_error( $errors )   X-Ref
Add a custom BuddyPress no access error message to wp-login.php.

param: WP_Error $errors Current error container.
since: 1.5.0
since: 2.7.0 Hook moved to 'wp_login_errors' made available since WP 3.6.0.
return: WP_Error

bp_core_login_filter_shake_codes( $codes )   X-Ref
Add our custom error code to WP login's shake error codes.

param: array $codes Array of WP error codes.
since: 2.7.0
return: array

bp_redirect_canonical()   X-Ref
Canonicalize BuddyPress URLs.

This function ensures that requests for BuddyPress content are always
redirected to their canonical versions. Canonical versions are always
trailingslashed, and are typically the most general possible versions of the
URL - eg, example.com/groups/mygroup/ instead of
example.com/groups/mygroup/home/.

since: 1.6.0

bp_rel_canonical()   X-Ref
Output rel=canonical header tag for BuddyPress content.

since: 1.6.0

bp_get_canonical_url( $args = array()   X-Ref
Get the canonical URL of the current page.

param: array $args {
since: 1.6.0
return: string Canonical URL for the current page.

bp_get_requested_url()   X-Ref
Return the URL as requested on the current page load by the user agent.

since: 1.6.0
return: string Requested URL string.

_bp_maybe_remove_redirect_canonical()   X-Ref
Remove WP's canonical redirect when we are trying to load BP-specific content.

Avoids issues with WordPress thinking that a BuddyPress URL might actually
be a blog post or page.

This function should be considered temporary, and may be removed without
notice in future versions of BuddyPress.

since: 1.6.0

_bp_rehook_maybe_redirect_404()   X-Ref
Rehook maybe_redirect_404() to run later than the default.

WordPress's maybe_redirect_404() allows admins on a multisite installation
to define 'NOBLOGREDIRECT', a URL to which 404 requests will be redirected.
maybe_redirect_404() is hooked to template_redirect at priority 10, which
creates a race condition with bp_template_redirect(), our piggyback hook.
Due to a legacy bug in BuddyPress, internal BP content (such as members and
groups) is marked 404 in $wp_query until bp_core_load_template(), when BP
manually overrides the automatic 404. However, the race condition with
maybe_redirect_404() means that this manual un-404-ing doesn't happen in
time, with the results that maybe_redirect_404() thinks that the page is
a legitimate 404, and redirects incorrectly to NOBLOGREDIRECT.

By switching maybe_redirect_404() to catch at a higher priority, we avoid
the race condition. If bp_core_load_template() runs, it dies before reaching
maybe_redirect_404(). If bp_core_load_template() does not run, it means that
the 404 is legitimate, and maybe_redirect_404() can proceed as expected.

This function will be removed in a later version of BuddyPress. Plugins
(and plugin authors!) should ignore it.

since: 1.6.1

_bp_maybe_remove_rel_canonical()   X-Ref
Remove WP's rel=canonical HTML tag if we are trying to load BP-specific content.

This function should be considered temporary, and may be removed without
notice in future versions of BuddyPress.

since: 1.6.0

bp_core_filter_wp_query( $retval, $query )   X-Ref
Stop WordPress performing a DB query for its main loop.

As of WordPress 4.6, it is possible to bypass the main WP_Query entirely.
This saves us one unnecessary database query! :)

param: null     $retval Current return value for filter.
param: WP_Query $query  Current WordPress query object.
since: 2.7.0
return: null|array



Generated: Sat Apr 27 01:00:55 2024 Cross-referenced by PHPXref 0.7.1