[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-blogs/ -> bp-blogs-functions.php (summary)

Blogs component functions.

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

Defines 44 functions

  bp_blogs_has_directory()
  bp_blogs_get_blogs()
  bp_blogs_record_existing_blogs()
  bp_blogs_is_blog_recordable()
  bp_blogs_is_blog_trackable()
  bp_blogs_record_blog()
  bp_blogs_update_option_blogname()
  bp_blogs_update_option_blogdescription()
  bp_blogs_update_option_close_comments_for_old_posts()
  bp_blogs_update_option_close_comments_days_old()
  bp_blogs_update_option_thread_comments()
  bp_blogs_update_option_thread_comments_depth()
  bp_blogs_update_option_comment_moderation()
  bp_blogs_update_option_site_icon()
  bp_blogs_delete_url_blogmeta()
  bp_blogs_publish_post_activity_meta()
  bp_blogs_update_post_activity_meta()
  bp_blogs_comment_sync_activity_comment()
  bp_blogs_add_user_to_blog()
  bp_blogs_get_allowed_roles()
  bp_blogs_remove_user_from_blog()
  bp_blogs_maybe_add_user_to_blog()
  bp_blogs_remove_blog()
  bp_blogs_remove_blog_for_user()
  bp_blogs_post_type_remove_comment()
  bp_blogs_remove_associated_blog_comments()
  bp_blogs_total_blogs()
  bp_blogs_total_blogs_for_user()
  bp_blogs_remove_data_for_blog()
  bp_blogs_get_blogs_for_user()
  bp_blogs_get_all_blogs()
  bp_blogs_get_random_blogs()
  bp_blogs_is_blog_hidden()
  bp_blogs_delete_blogmeta()
  bp_blogs_get_blogmeta()
  bp_blogs_update_blogmeta()
  bp_blogs_add_blogmeta()
  bp_blogs_remove_data()
  bp_blogs_remove_data_on_delete_user()
  bp_blogs_restore_data()
  bp_blog_signup_enabled()
  bp_blogs_get_signup_form_submitted_vars()
  bp_blogs_validate_blog_form()
  bp_blogs_get_site_icon_url()

Functions
Functions that are not part of a class:

bp_blogs_has_directory()   X-Ref
Check whether the $bp global lists an activity directory page.

return: bool True if set, false if empty.
since: 1.5.0

bp_blogs_get_blogs( $args = '' )   X-Ref
Retrieve a set of blogs.

return: array See {@link BP_Blogs_Blog::get()}.
param: array|string $args {
since: 1.2.0
since: 2.0.0 Added $include_blog_ids, $update_meta_cache parameters
since: 10.0.0 Added $date_query parameter

bp_blogs_record_existing_blogs( $args = array()   X-Ref
Populate the BP blogs table with existing blogs.

Warning: By default, this will remove all existing records from the BP
blogs and blogmeta tables before re-populating the tables.

return: bool
param: array $args {
since: 1.0.0
since: 2.6.0 Accepts $args as a parameter.

bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 )   X-Ref
Check whether a given blog should be recorded in activity streams.

If $user_id is provided, you can restrict site from being recordable
only to particular users.

return: bool True if blog is recordable, otherwise false.
param: int $blog_id ID of the blog being checked.
param: int $user_id Optional. ID of the user for whom access is being checked.
since: 1.7.0

bp_blogs_is_blog_trackable( $blog_id, $user_id = 0 )   X-Ref
Check whether a given blog should be tracked by the Blogs component.

If $user_id is provided, the developer can restrict site from
being trackable only to particular users.

return: bool True if blog is trackable, otherwise false.
param: int $blog_id ID of the blog being checked.
param: int $user_id Optional. ID of the user for whom access is being checked.
since: 1.7.0

bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false )   X-Ref
Make BuddyPress aware of a new site so that it can track its activity.

return: false|null Returns false on failure.
param: int  $blog_id     ID of the blog being recorded.
param: int  $user_id     ID of the user for whom the blog is being recorded.
param: bool $no_activity Optional. Whether to skip recording an activity
since: 1.0.0

bp_blogs_update_option_blogname( $oldvalue, $newvalue )   X-Ref
Update blog name in BuddyPress blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.

bp_blogs_update_option_blogdescription( $oldvalue, $newvalue )   X-Ref
Update blog description in BuddyPress blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.

bp_blogs_update_option_close_comments_for_old_posts( $oldvalue, $newvalue )   X-Ref
Update "Close comments for old posts" option in BuddyPress blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.
since: 2.0.0

bp_blogs_update_option_close_comments_days_old( $oldvalue, $newvalue )   X-Ref
Update "Close comments after days old" option in BuddyPress blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.
since: 2.0.0

bp_blogs_update_option_thread_comments( $oldvalue, $newvalue )   X-Ref
When toggling threaded comments, update thread depth in blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.
since: 2.0.0

bp_blogs_update_option_thread_comments_depth( $oldvalue, $newvalue )   X-Ref
When updating comment depth, update thread depth in blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but
param: string $newvalue Value to change meta to.
since: 2.0.0

bp_blogs_update_option_comment_moderation( $oldvalue, $newvalue )   X-Ref
When updating comment moderation, mirror value in blogmeta table.

param: string $oldvalue Value before save. Passed by do_action() but unused here.
param: string $newvalue Value to change meta to.
since: 3.0.0

bp_blogs_update_option_site_icon( $old_value, $new_value )   X-Ref
Syncs site icon URLs to blogmeta.

param: int|string $old_value Old value
param: int|string $new_value New value
since: 2.7.0

bp_blogs_delete_url_blogmeta( $site_id = 0 )   X-Ref
Deletes the 'url' blogmeta for a site.

Fires when a site's details are updated, which generally happens when
editing a site under "Network Admin > Sites".

param: int $site_id The site ID.
since: 2.3.0

bp_blogs_publish_post_activity_meta( $activity_id, $post, $args )   X-Ref
Record activity metadata about a published blog post.

param: int     $activity_id ID of the activity item.
param: WP_Post $post        Post object.
param: array   $args        Array of arguments.
since: 2.2.0

bp_blogs_update_post_activity_meta( $post, $activity, $activity_post_object )   X-Ref
Updates a blog post's activity meta entry during a post edit.

param: WP_Post              $post                 Post object.
param: BP_Activity_Activity $activity             Activity object.
param: object               $activity_post_object The post type tracking args object.
since: 2.2.0
since: 2.5.0 Add the post type tracking args object parameter

bp_blogs_comment_sync_activity_comment( &$activity_id, $comment = null, $activity_args = array()   X-Ref
Update Activity and blogs meta and eventually sync comment with activity comment

return: WP_Error|bool|int Returns false if no activity, the activity id otherwise.
param: int|bool        $activity_id          ID of recorded activity, or false if sync is active.
param: WP_Comment|null $comment              The comment object.
param: array           $activity_args        Array of activity arguments.
param: object|null     $activity_post_object The post type tracking args object.
since: 2.5.0

bp_blogs_add_user_to_blog( $user_id, $role = false, $blog_id = 0 )   X-Ref
Record a user's association with a blog.

This function is hooked to several WordPress actions where blog roles are
set/changed ('add_user_to_blog', 'profile_update', 'user_register'). It
parses the changes, and records them as necessary in the BP blog tracker.

BuddyPress does not track blogs for users with the 'subscriber' role by
default, though as of 2.1.0 you can filter 'bp_blogs_get_allowed_roles' to
modify this behavior.

return: false|null False on failure.
param: int         $user_id The ID of the user.
param: string|bool $role    User's WordPress role for this blog ID.
param: int         $blog_id Blog ID user is being added to.

bp_blogs_get_allowed_roles()   X-Ref
The allowed blog roles a member must have to be recorded into the
`bp_user_blogs` pointer table.

This added and was made filterable in BuddyPress 2.1.0 to make it easier
to extend the functionality of the Blogs component.

return: string
since: 2.1.0

bp_blogs_remove_user_from_blog( $user_id, $blog_id = 0 )   X-Ref
Remove a blog-user pair from BP's blog tracker.

param: int $user_id ID of the user whose blog is being removed.
param: int $blog_id Optional. ID of the blog being removed. Default: current blog ID.

bp_blogs_maybe_add_user_to_blog()   X-Ref
Rehook WP's maybe_add_existing_user_to_blog with a later priority.

WordPress catches add-user-to-blog requests at init:10. In some cases, this
can precede BP's Blogs component. This function bumps the priority of the
core function, so that we can be sure that the Blogs component is loaded
first. See https://buddypress.trac.wordpress.org/ticket/3916.

since: 1.6.0

bp_blogs_remove_blog( $blog_id )   X-Ref
Remove the "blog created" item from the BP blogs tracker and activity stream.

param: int $blog_id ID of the blog being removed.

bp_blogs_remove_blog_for_user( $user_id, $blog_id )   X-Ref
Remove a blog from the tracker for a specific user.

param: int $user_id ID of the user for whom the blog is being removed.
param: int $blog_id ID of the blog being removed.

bp_blogs_post_type_remove_comment( $deleted, $comment_id, $activity_post_object, $activity_type = '' )   X-Ref
Remove a synced activity comment from the activity stream.

return: bool True on success. False on error.
param: bool   $deleted              True when a comment post type activity was successfully removed.
param: int    $comment_id           ID of the comment to be removed.
param: object $activity_post_object The post type tracking args object.
param: string $activity_type        The post type comment activity type.
since: 2.5.0

bp_blogs_remove_associated_blog_comments( $activity_ids = array()   X-Ref
Removes blog comments that are associated with activity comments.

param: array $activity_ids The activity IDs to check association with blog
param: bool  $force_delete  Whether to force delete the comments. If false,
since: 2.0.0

bp_blogs_total_blogs()   X-Ref
Get the total number of blogs being tracked by BuddyPress.

return: int $count Total blog count.

bp_blogs_total_blogs_for_user( $user_id = 0 )   X-Ref
Get the total number of blogs being tracked by BP for a specific user.

return: int $count Total blog count for the user.
param: int $user_id ID of the user being queried. Default: on a user page,
since: 1.2.0

bp_blogs_remove_data_for_blog( $blog_id )   X-Ref
Remove the all data related to a given blog from the BP blogs tracker and activity stream.

param: int $blog_id The ID of the blog to expunge.

bp_blogs_get_blogs_for_user( $user_id, $show_hidden = false )   X-Ref
Get all of a user's blogs, as tracked by BuddyPress.

return: array See {@BP_Blogs_Blog::get_blogs_for_user()}.
param: int  $user_id     See {@BP_Blogs_Blog::get_blogs_for_user()}.
param: bool $show_hidden See {@BP_Blogs_Blog::get_blogs_for_user()}.

bp_blogs_get_all_blogs( $limit = null, $page = null )   X-Ref
Retrieve a list of all blogs.

return: array See {@BP_Blogs_Blog::get_all()}.
param: int|null $limit See {@BP_Blogs_Blog::get_all()}.
param: int|null $page  See {@BP_Blogs_Blog::get_all()}.

bp_blogs_get_random_blogs( $per_page = null, $page = null )   X-Ref
Retrieve a random list of blogs.

return: array See {@BP_Blogs_Blog::get()}.
param: int|null $per_page See {@BP_Blogs_Blog::get()}.
param: int|null $page  See {@BP_Blogs_Blog::get()}.

bp_blogs_is_blog_hidden( $blog_id )   X-Ref
Check whether a given blog is hidden.

return: bool See {@BP_Blogs_Blog::is_hidden()}.
param: int $blog_id See {@BP_Blogs_Blog::is_hidden()}.

bp_blogs_delete_blogmeta( $blog_id, $meta_key = false, $meta_value = false, $delete_all = false )   X-Ref
Delete a metadata from the DB for a blog.

return: bool True on success, false on failure.
param: int         $blog_id    ID of the blog whose metadata is being deleted.
param: string|bool $meta_key   Optional. The key of the metadata being deleted. If
param: string|bool $meta_value Optional. If present, the metadata will only be
param: bool        $delete_all Optional. If true, delete matching metadata entries for

bp_blogs_get_blogmeta( $blog_id, $meta_key = '', $single = true )   X-Ref
Get metadata for a given blog.

return: mixed The meta value(s) being requested.
param: int    $blog_id  ID of the blog whose metadata is being requested.
param: string $meta_key Optional. If present, only the metadata matching
param: bool   $single   Optional. If true, return only the first value of the
since: 1.2.0

bp_blogs_update_blogmeta( $blog_id, $meta_key, $meta_value, $prev_value = '' )   X-Ref
Update a piece of blog meta.

return: bool|int Returns false on failure. On successful update of existing
param: int    $blog_id    ID of the blog whose metadata is being updated.
param: string $meta_key   Key of the metadata being updated.
param: mixed  $meta_value Value to be set.
param: mixed  $prev_value Optional. If specified, only update existing

bp_blogs_add_blogmeta( $blog_id, $meta_key, $meta_value, $unique = false )   X-Ref
Add a piece of blog metadata.

return: int|bool The meta ID on successful update, false on failure.
param: int    $blog_id    ID of the blog.
param: string $meta_key   Metadata key.
param: mixed  $meta_value Metadata value.
param: bool   $unique     Optional. Whether to enforce a single metadata value
since: 2.0.0

bp_blogs_remove_data( $user_id )   X-Ref
Remove all blog associations for a given user.

return: bool Returns false on failure.
param: int $user_id ID whose blog data should be removed.

bp_blogs_remove_data_on_delete_user( $user_id )   X-Ref
Deletes user XProfile data on the 'delete_user' hook.

param: int $user_id The ID of the deleted user.
since: 6.0.0

bp_blogs_restore_data( $user_id = 0 )   X-Ref
Restore all blog associations for a given user.

param: int $user_id ID whose blog data should be restored.
since: 2.2.0

bp_blog_signup_enabled()   X-Ref
Checks whether blog creation is enabled.

Returns true when blog creation is enabled for logged-in users only, or
when it's enabled for new registrations.

return: bool True if blog registration is enabled.
since: 1.0.0
since: 7.0.0 The function has been moved into `bp-blogs/bp-blogs-functions.php`.

bp_blogs_get_signup_form_submitted_vars()   X-Ref
Returns the Blog signup's submitted vars.

return: array An associative array containing the Blog signup's submitted vars.
since: 7.0.0

bp_blogs_validate_blog_form( $blog_name = '', $blog_title = '' )   X-Ref
Validate a blog creation submission.

Essentially, a wrapper for {@link wpmu_validate_blog_signup()}.

return: array Contains the new site data and error messages.
since: 1.0.0
since: 7.0.0 Add the blog_name and blog_title parameters.

bp_blogs_get_site_icon_url( $blog_id = 0, $size = 512 )   X-Ref
Gets the site icon URL even when BuddyPress is not network activated.

return: string          The site icon URL
param: integer $blog_id The ID of the blog to get the site icon URL for.
param: integer $size    The size of the site icon.
since: 7.0.0



Generated: Sat Nov 23 01:00:56 2024 Cross-referenced by PHPXref 0.7.1