Skip to content

Commit

Permalink
Merge pull request #3003 from tuanmh/2.x
Browse files Browse the repository at this point in the history
2.x Update post filed in pod instance before saving
  • Loading branch information
sc0ttkclark committed Jun 2, 2015
2 parents da22580 + b198c2e commit c33d5df
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions classes/PodsMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,22 @@ public function update_meta ( $object_type, $_null = null, $object_id = 0, $meta

$pod = self::$current_field_pod;

if ( ( isset( $pod->fields[ $meta_key ] ) || false !== strpos( $meta_key, '.' ) ) && $pod->row !== null) {

$key = $meta_key;
if(false !== strpos( $meta_key, '.' )){
$key = current( explode( '.', $meta_key ) );
}

$pod->row[ $meta_key ] = $meta_value;

if ( isset( $pod->fields[ $key ] ) ) {
if ( in_array( $pod->fields[ $key ][ 'type' ], PodsForm::tableless_field_types() ) && isset( $meta_cache[ '_pods_' . $key ] ) )
unset( $meta_cache[ '_pods_' . $key ] );
}

}

$pod->save( $meta_key, $meta_value, $object_id );

return $object_id;
Expand Down

0 comments on commit c33d5df

Please sign in to comment.