Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author sparkweb

    (@sparkweb)

    Hi David, could you share what you’ve done or the errors being thrown? If you don’t see any errors, make sure you have WP_DEBUG turned on in the wp-config.php file. If we can get an error, that would really help in determining what the problem is.

    The sample code is running within a plugin of mine and doesn’t have any issues so I’d be surprised if there’s a problem there. ??

    Thread Starter davidmitcha

    (@davidmitcha)

    Thanks for the reply. WP_DEBUG isn’t helping any. I’ve posted my code for you.

    Plugin Author sparkweb

    (@sparkweb)

    I installed your code and tried it out and it looks like you aren’t checking to see if the status setting on the field is set to 1 properly. You have:

    if ($_POST[$field_name] == 1) {

    And it should be:

    if ($_POST['_' . $field_name . '_status'] == 1 && $_POST['_' . $field_name] != "") {

    In fact, why don’t you do it like this:

    $fields = array(
    	"cms_code",
    	"inpatient_hospital",
    	"inpatient_mental",
    	"skilled_nursing",
    	"hospice_care",
    	"primary_care",
    	"etc.....",
    );
    
    //Save Your Fields
    foreach ($fields as $field_name) {
    	if ($_POST['_' . $field_name . '_status'] == 1 && $_POST['_' . $field_name] != "") {
    		cfbe_save_meta_data($field_name, $_POST[$field_name]);
    	}
    }

    See https://github.com/sparkweb/foxyshop/blob/master/bulkeditor.php for details on how it’s working in the plugin.

    Thread Starter davidmitcha

    (@davidmitcha)

    Thanks for your time on this. After some fiddling I’ve got to move on without this, unfortunately. Even with the changes (here) I still appear to be missing something.

    Plugin Author sparkweb

    (@sparkweb)

    Your field names and statuses don’t have the underscore in front.

    foreach ($fields as $field_name) {
    	if ($_POST[$field_name . '_status'] == 1 && $_POST[$field_name] != "") {
    		cfbe_save_meta_data($field_name, $_POST[$field_name]);
    	}
    }
    Thread Starter davidmitcha

    (@davidmitcha)

    Brilliant. Thank you so much! I’m sending something your way for all the trouble.

    Plugin Author sparkweb

    (@sparkweb)

    Thanks so much. Glad you got it working!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Extra Save Lines Not Updating Database’ is closed to new replies.