Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Commit

Permalink
Ensure that saving does not happen during a switch-to-blog session, a…
Browse files Browse the repository at this point in the history
…s data would be saved to the wrong object.
  • Loading branch information
jtsternberg committed Aug 11, 2016
1 parent 3aaa03a commit 9de100a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file.
* Make wysiwyg editors work in the repeatable groups context. A standard repeatable (non-group) wysiwyg field is not supported (but will possibly be included in a future update). Props [@johnsonpaul1014](https://github.com/johnsonpaul1014) ([#26](https://github.com/WebDevStudios/CMB2/pull/26), [#99](https://github.com/WebDevStudios/CMB2/pull/99), [#260](https://github.com/WebDevStudios/CMB2/pull/260), [#264](https://github.com/WebDevStudios/CMB2/pull/264), [#356](https://github.com/WebDevStudios/CMB2/pull/356), [#431](https://github.com/WebDevStudios/CMB2/pull/431), [#462](https://github.com/WebDevStudios/CMB2/pull/462), [#657](https://github.com/WebDevStudios/CMB2/pull/657), [#693](https://github.com/WebDevStudios/CMB2/pull/693)).
* Add an id to the heading tag in the title field. This allows linking to a particular title using the id.
* Internationalization improvements. Props [ramiy](https://github.com/ramiy) ([#696](https://github.com/WebDevStudios/CMB2/pull/696)).
* Ensure that saving does not happen during a switch-to-blog session, as data would be saved to the wrong object. [See more](https://wordpress.org/support/topic/bug-in-lastest-version?replies=2).


### Bug Fixes
Expand Down
6 changes: 4 additions & 2 deletions includes/CMB2_hookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function delete_term( $term_id, $tt_id, $taxonomy = '' ) {
* @return bool Whether object can be saved
*/
public function can_save( $type = '' ) {
return (
return apply_filters( 'cmb2_can_save', (
$this->cmb->prop( 'save_fields' )
// check nonce
&& isset( $_POST[ $this->cmb->nonce() ] )
Expand All @@ -581,7 +581,9 @@ public function can_save( $type = '' ) {
&& ! ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
// get the metabox types & compare it to this type
&& ( $type && in_array( $type, $this->cmb->prop( 'object_types' ) ) )
);
// Don't do updates during a switch-to-blog instance.
&& ! ( is_multisite() && ms_is_switched() )
) );
}

/**
Expand Down

0 comments on commit 9de100a

Please sign in to comment.