chnovo7 / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
0 stars 0 forks source link

Editing custom field label & name #589

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
If I want to edit the custom field label and name at once, only the new label 
value is changed, the name of the field becomes empty. I always have to edit 
the custom field a second time to change the name as well.

Original issue reported on code.google.com by webbl...@gmail.com on 12 May 2015 at 12:34

GoogleCodeExporter commented 8 years ago
I have confirmed this behavior in 0.9.8.5, but in the future, please include 
all the requested info when filing bug reports: 
https://code.google.com/p/wordpress-custom-content-type-manager/wiki/ReportingBu
gs

Original comment by ever...@fireproofsocks.com on 12 May 2015 at 9:29

GoogleCodeExporter commented 8 years ago
Interesting.  The problem can be reproduced by changing the unique field name.  
Only some of the settings are changed because the functionality still saves the 
data in the CCTM::$data array under the null key, where it is later retrieved.  
So the logic checking for an invalid field name doesn't trigger an outright 404:

if (!array_key_exists($field_name, self::$data['custom_field_defs']))


Updated the CCTM_FormElement class, line around 911, bring the 
$posted_data['name'] = '' INSIDE of the brackets so it looks like this:

if (strtolower($posted_data['name']) == strtolower($cf)) { $this->errors['name'][] = sprintf( __('The name %s is already in use. Please choose another name.', CCTM_TXTDOMAIN), ''.$posted_data['name'].''); $posted_data['name'] = ''; }


This will go out as 0.9.8.5

9dfda5e..f818233  master -> master

Original comment by ever...@fireproofsocks.com on 12 May 2015 at 10:44

GoogleCodeExporter commented 8 years ago
Dammit legacy code.  This only fixes the problem in one scenario.

Original comment by ever...@fireproofsocks.com on 13 May 2015 at 4:31