[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

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

Blogs component functions.

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

Defines 39 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_restore_data()

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.

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

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

return: array See {@link BP_Blogs_Blog::get()}.
param: array|string $args {

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.

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

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.

since: 1.7.0
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.

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.

since: 1.7.0
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.

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.

since: 1.0.0
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

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.

since: 2.0.0
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_days_old( $oldvalue, $newvalue )   X-Ref
Update "Close comments after days old" option in BuddyPress blogmeta table.

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

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

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

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

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

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

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

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

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

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". Prior to WP 4.9, the
correct hook was 'refresh_blog_details'; afterward, 'clean_site_cache'.

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

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

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

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.

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

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

since: 2.5.0
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.

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.

since: 2.1.0
return: string

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.

since: 2.5.0
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.

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

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

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.

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

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( $limit = null, $page = null )   X-Ref
Retrieve a random list of blogs.

return: array See {@BP_Blogs_Blog::get()}.
param: int|null $limit 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.

since: 1.2.0
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

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.

since: 2.0.0
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

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_restore_data( $user_id = 0 )   X-Ref
Restore all blog associations for a given user.

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



Generated: Thu Sep 19 01:01:39 2019 Cross-referenced by PHPXref 0.7.1