BP_Document_Folder:保存()
将文档文件夹保存到数据库中。
描述
返回
(WP_Error | bool)真正的成功。
源
文件:bp-document /类/ class-bp-document-folder.php
Public function save() {global $wpdb;英国石油美元= buddypress ();$this->id = apply_filters_ref_array('bp_document_id_before_save', array($this->id, &$this)); / /使用实例$this->user_id = apply_filters_ref_array('bp_document_user_id_before_save', array($this->user_id, &$this,));$this->blog_id = apply_filters_ref_array('bp_document_blog_id_before_save', array($this->blog_id, &$this,)); / /使用实例$this->group_id = apply_filters_ref_array('bp_document_group_id_before_save', array($this->group_id, &$this,)); / /使用实例$this->title = apply_filters_ref_array('bp_document_title_before_save', array($this->title, &$this,)); / /将bp_document_title_before_save ('bp_document_title_before_save', array($this->title, &$this,));$this->privacy = apply_filters_ref_array('bp_document_privacy_before_save', array($this->privacy, &$this,)); / /使用实例$this->date_created = apply_filters_ref_array('bp_document_date_created_before_save', array($this->date_created, &$this,)); / /指定日期$this->date_modified = apply_filters_ref_array('bp_document_date_modified_before_save', array($this->date_modified, &$this,)); / /修改日期 $this->parent = apply_filters_ref_array( 'bp_document_parent_before_save', array( $this->parent, &$this, ) ); /** * Fires before the current folder gets saved. * Please use this hook to filter the properties above. Each part will be passed in. * * @param BP_Document $this Current instance of the folder being saved. Passed by reference. * * @since BuddyBoss 1.4.0 */ do_action_ref_array( 'bp_document_folder_before_save', array( &$this ) ); if ( 'wp_error' === $this->error_type && $this->errors->get_error_code() ) { return $this->errors; } // If we have an existing ID, update the folder, otherwise insert it. if ( ! empty( $this->id ) ) { $q = $wpdb->prepare( "UPDATE {$bp->document->table_name_folder} SET blog_id = %d, user_id = %d, group_id = %d, title = %s, privacy = %s, parent = %d, date_modified = %s WHERE id = %d", $this->blog_id, $this->user_id, $this->group_id, $this->title, $this->privacy, $this->parent, $this->date_modified, $this->id ); } else { $q = $wpdb->prepare( "INSERT INTO {$bp->document->table_name_folder} ( blog_id, user_id, group_id, title, privacy, date_created, date_modified, parent ) VALUES ( %d, %d, %d, %s, %s, %s, %s, %d )", $this->blog_id, $this->user_id, $this->group_id, $this->title, $this->privacy, $this->date_created, $this->date_modified, $this->parent ); } $q = $wpdb->query( $q ); // db call ok; no-cache ok; if ( false === $q ) { return false; } // If this is a new folder, set the $id property. if ( empty( $this->id ) ) { $this->id = $wpdb->insert_id; } /** * Fires after an folder has been saved to the database. * * @param BP_Document $this Current instance of folder being saved. Passed by reference. * * @since BuddyBoss 1.4.0 */ do_action_ref_array( 'bp_document_folder_after_save', array( &$this ) ); return true; }
更新日志
版本 | 描述 |
---|---|
BuddyBoss 1.4.0 | 介绍了。 |