Skip to content
This repository has been archived by the owner on Feb 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #64 from kurtw/fix-bugs
Browse files Browse the repository at this point in the history
Fix saving bug
  • Loading branch information
Scotchester committed Jun 10, 2015
2 parents 41e6592 + c9d7f60 commit 575b68a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
We follow the [Semantic Versioning 2.0.0](http://semver.org/) format.


## 2.0.2 - 2015-06-09

### Changed
- Fix bug that caused empty links to interrupt saving of fields that followed

## 2.0.1 - 2015-06-02

### Changed
Expand Down
2 changes: 1 addition & 1 deletion cms-toolkit.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
available throughout the application and make building complex functionality
in WordPress a little easier.
Version: 2.0.1
Version: 2.0.2
Author: Greg Boone, Aman Kaur, Matthew Duran, Scott Cranfill, Kurt Wall
Author URI: https://github.com/cfpb/
License: Public Domain work of the Federal Government
Expand Down
6 changes: 2 additions & 4 deletions inc/meta-box-models.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function validate_link( $key, &$validated ) {
$url = $_POST["{$key}_url"];
$full_link = array( 'label' => $label, 'url' => $url );

$validated = ( empty( $label ) or empty( $url ) ) ? null : $full_link;
$validated = ( empty( $label ) or empty( $url ) ) ? "" : $full_link;
}
}

Expand Down Expand Up @@ -551,8 +551,6 @@ public static function save( $post_ID, $postvalues ) {
$existing = get_post_meta( $post_ID, $key, $single = true );
if ( isset( $value ) ) {
update_post_meta( $post_ID, $key = $key, $meta_value = $value );
} else {
return;
}
}
}
Expand Down Expand Up @@ -580,7 +578,7 @@ public function validate_and_save( $post_ID ) {
$this->fields[$key]['key'] = $this->fields[$key]['old_key'];

//create keys in array that are to be saved
$validated[$this->fields[$key]['old_key']] = null;
$validated[$this->fields[$key]['old_key']] = "";

// retrieve saved data
$saved[$this->fields[$key]['old_key']] = get_post_meta( $post_ID, $this->fields[$key]['old_key'], $single = true );
Expand Down

0 comments on commit 575b68a

Please sign in to comment.