Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/19/2009 12:21:53 PM (17 years ago)
Author:
apeatling
Message:

Added value filters and before and after actions to all save() methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-blogs/bp-blogs-classes.php

    r1250 r1351  
    2929    function save() {
    3030        global $wpdb, $bp;
     31       
     32        $this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id );
     33        $this->blog_ud = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id );
     34       
     35        do_action( 'bp_blogs_blog_before_save', $this );
    3136       
    3237        // Don't try and save if there is no user ID or blog ID set.
     
    4853        if ( !$wpdb->query($sql) )
    4954            return false;
     55           
     56        do_action( 'bp_blogs_blog_after_save', $this );
    5057       
    5158        if ( $this->id )
     
    301308        global $wpdb, $bp;
    302309       
     310        $this->post_id = apply_filters( 'bp_blogs_post_id_before_save', $this->post_id, $this->id );
     311        $this->blog_id = apply_filters( 'bp_blogs_post_blog_id_before_save', $this->blog_id, $this->id );
     312        $this->user_id = apply_filters( 'bp_blogs_post_user_id_before_save', $this->user_id, $this->id );
     313        $this->date_created = apply_filters( 'bp_blogs_post_date_created_before_save', $this->date_created, $this->id );
     314
     315        do_action( 'bp_blogs_post_before_save', $this );
     316
    303317        if ( $this->id ) {
    304318            // Update
     
    311325        if ( !$wpdb->query($sql) )
    312326            return false;
     327
     328        do_action( 'bp_blogs_post_after_save', $this );
    313329       
    314330        if ( $this->id )
     
    496512    function save() {
    497513        global $wpdb, $bp;
     514
     515        $this->comment_id = apply_filters( 'bp_blogs_comment_id_before_save', $this->comment_id, $this->id );
     516        $this->comment_post_id = apply_filters( 'bp_blogs_comment_post_id_before_save', $this->comment_post_id, $this->id );
     517        $this->blog_id = apply_filters( 'bp_blogs_comment_blog_id_before_save', $this->blog_id, $this->id );
     518        $this->user_id = apply_filters( 'bp_blogs_comment_user_id_before_save', $this->user_id, $this->id );
     519        $this->date_created = apply_filters( 'bp_blogs_comment_date_created_before_save', $this->date_created, $this->id );
     520
     521        do_action( 'bp_blogs_comment_before_save', $this );
    498522       
    499523        if ( $this->id ) {
     
    507531        if ( !$wpdb->query($sql) )
    508532            return false;
     533           
     534        do_action( 'bp_blogs_comment_after_save', $this );
    509535       
    510536        if ( $this->id )
Note: See TracChangeset for help on using the changeset viewer.