diff --git src/bp-blogs/bp-blogs-activity.php src/bp-blogs/bp-blogs-activity.php
index 5c91e83..a6ec5b3 100644
|
|
|
function bp_blogs_record_activity_on_site_creation( $recorded_blog, $is_private, |
| 624 | 624 | if ( ! $is_private && ! $no_activity && bp_blogs_is_blog_trackable( $recorded_blog->blog_id, $recorded_blog->user_id ) ) { |
| 625 | 625 | bp_blogs_record_activity( array( |
| 626 | 626 | 'user_id' => $recorded_blog->user_id, |
| | 627 | |
| | 628 | /** |
| | 629 | * Filters the activity created blog primary link. |
| | 630 | * |
| | 631 | * @since 1.1.0 |
| | 632 | * |
| | 633 | * @param string $value Blog primary link. |
| | 634 | * @param int $value Blog ID. |
| | 635 | */ |
| 627 | 636 | 'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', bp_blogs_get_blogmeta( $recorded_blog->blog_id, 'url' ), $recorded_blog->blog_id ), |
| 628 | 637 | 'type' => 'new_blog', |
| 629 | 638 | 'item_id' => $recorded_blog->blog_id |
diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php
index be32eef..83f465a 100644
|
|
|
function bp_blogs_get_blogs( $args = '' ) { |
| 65 | 65 | $r['include_blog_ids'] |
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | | // Filter and return. |
| | 68 | /** |
| | 69 | * Filters a set of blogs. |
| | 70 | * |
| | 71 | * @since 1.2.0 |
| | 72 | * |
| | 73 | * @param array $blogs Array of blog data. |
| | 74 | * @param array $r Parsed query arguments. |
| | 75 | */ |
| 69 | 76 | return apply_filters( 'bp_blogs_get_blogs', $blogs, $r ); |
| 70 | 77 | } |
| 71 | 78 | |
| … |
… |
function bp_blogs_record_existing_blogs( $args = array() ) { |
| 246 | 253 | */ |
| 247 | 254 | function bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 ) { |
| 248 | 255 | |
| | 256 | /** |
| | 257 | * Filters whether or not a blog is globally activity stream recordable. |
| | 258 | * |
| | 259 | * @since 1.7.0 |
| | 260 | * |
| | 261 | * @param bool $value Whether or not recordable. Default true. |
| | 262 | * @param int $blog_id Current blog ID. |
| | 263 | */ |
| 249 | 264 | $recordable_globally = apply_filters( 'bp_blogs_is_blog_recordable', true, $blog_id ); |
| 250 | 265 | |
| 251 | 266 | if ( !empty( $user_id ) ) { |
| | 267 | /** |
| | 268 | * Filters whether or not a blog is globally activity stream recordable for user. |
| | 269 | * |
| | 270 | * @since 1.7.0 |
| | 271 | * |
| | 272 | * @param bool $recordable_globally Whether or not recordable. |
| | 273 | * @param int $blog_id Current blog ID. |
| | 274 | * @param int $user_id Current user ID. |
| | 275 | */ |
| 252 | 276 | $recordable_for_user = apply_filters( 'bp_blogs_is_blog_recordable_for_user', $recordable_globally, $blog_id, $user_id ); |
| 253 | 277 | } else { |
| 254 | 278 | $recordable_for_user = $recordable_globally; |
| … |
… |
function bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 ) { |
| 275 | 299 | */ |
| 276 | 300 | function bp_blogs_is_blog_trackable( $blog_id, $user_id = 0 ) { |
| 277 | 301 | |
| | 302 | /** |
| | 303 | * Filters whether or not a blog is globally trackable. |
| | 304 | * |
| | 305 | * @since 1.7.0 |
| | 306 | * |
| | 307 | * @param bool $value Whether or not trackable. |
| | 308 | * @param int $blog_id Current blog ID. |
| | 309 | */ |
| 278 | 310 | $trackable_globally = apply_filters( 'bp_blogs_is_blog_trackable', bp_blogs_is_blog_recordable( $blog_id, $user_id ), $blog_id ); |
| 279 | 311 | |
| 280 | 312 | if ( !empty( $user_id ) ) { |
| | 313 | |
| | 314 | /** |
| | 315 | * Filters whether or not a blog is globally trackable for user. |
| | 316 | * |
| | 317 | * @since 1.7.0 |
| | 318 | * |
| | 319 | * @param bool $value Whether or not trackable. |
| | 320 | * @param int $blog_id Current blog ID. |
| | 321 | * @param int $user_id Current user ID. |
| | 322 | */ |
| 281 | 323 | $trackable_for_user = apply_filters( 'bp_blogs_is_blog_trackable_for_user', $trackable_globally, $blog_id, $user_id ); |
| 282 | 324 | } else { |
| 283 | 325 | $trackable_for_user = $trackable_globally; |
| … |
… |
function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) { |
| 344 | 386 | bp_blogs_update_blogmeta( $recorded_blog->blog_id, 'thread_comments_depth', $thread_depth ); |
| 345 | 387 | |
| 346 | 388 | $is_private = !empty( $_POST['blog_public'] ) && (int) $_POST['blog_public'] ? false : true; |
| | 389 | |
| | 390 | /** |
| | 391 | * Filters whether or not a new blog is public. |
| | 392 | * |
| | 393 | * @since 1.5.0 |
| | 394 | * |
| | 395 | * @param bool $is_private Whether or not blog is public. |
| | 396 | */ |
| 347 | 397 | $is_private = !apply_filters( 'bp_is_new_blog_public', !$is_private ); |
| 348 | 398 | |
| 349 | 399 | /** |
| … |
… |
add_action( 'user_register', 'bp_blogs_add_user_to_blog' ); |
| 844 | 894 | * @return string |
| 845 | 895 | */ |
| 846 | 896 | function bp_blogs_get_allowed_roles() { |
| | 897 | |
| | 898 | /** |
| | 899 | * Filters the allowed roles a member must have to be recorded into bp_user_blogs pointer table. |
| | 900 | * |
| | 901 | * @since 2.1.0 |
| | 902 | * |
| | 903 | * @param array $value Array of potential roles user needs. |
| | 904 | */ |
| 847 | 905 | return apply_filters( 'bp_blogs_get_allowed_roles', array( 'contributor', 'author', 'editor', 'administrator' ) ); |
| 848 | 906 | } |
| 849 | 907 | |
diff --git src/bp-blogs/bp-blogs-template.php src/bp-blogs/bp-blogs-template.php
index c7e1380..b591dd0 100644
|
|
|
function bp_blog_last_active( $args = array() ) { |
| 645 | 645 | /** |
| 646 | 646 | * Filters the last active date of the current blog in the loop. |
| 647 | 647 | * |
| 648 | | * @since |
| | 648 | * @since 1.2.0 |
| 649 | 649 | * |
| 650 | 650 | * @param string $last_activity Last active date. |
| 651 | 651 | * @param array $r Array of parsed args used to determine formatting. |
| … |
… |
function bp_blog_create_nav_item() { |
| 1402 | 1402 | |
| 1403 | 1403 | $output = '<li id="blog-create-nav">' . $create_blog_button . '</li>'; |
| 1404 | 1404 | |
| | 1405 | /** |
| | 1406 | * Filters the Create A Site nav item output. |
| | 1407 | * |
| | 1408 | * @since 2.2.0 |
| | 1409 | * |
| | 1410 | * @param string $output Nav item output. |
| | 1411 | */ |
| 1405 | 1412 | return apply_filters( 'bp_get_blog_create_nav_item', $output ); |
| 1406 | 1413 | } |
| 1407 | 1414 | |
diff --git src/bp-blogs/classes/class-bp-blogs-blog.php src/bp-blogs/classes/class-bp-blogs-blog.php
index f2b07cc..1e5e039 100644
|
|
|
class BP_Blogs_Blog { |
| 75 | 75 | public function save() { |
| 76 | 76 | global $wpdb; |
| 77 | 77 | |
| | 78 | /** |
| | 79 | * Filters the blog user ID before save. |
| | 80 | * |
| | 81 | * @since 1.0.0 |
| | 82 | * |
| | 83 | * @param int $value User ID. |
| | 84 | * @param int $value Site ID. |
| | 85 | */ |
| 78 | 86 | $this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id ); |
| | 87 | |
| | 88 | /** |
| | 89 | * Filters the blog blog ID before save. |
| | 90 | * |
| | 91 | * @since 1.0.0 |
| | 92 | * |
| | 93 | * @param int $value Blog ID. |
| | 94 | * @param int $value Site ID. |
| | 95 | */ |
| 79 | 96 | $this->blog_id = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id ); |
| 80 | 97 | |
| 81 | 98 | /** |