• Resolved zeedesign_r

    (@zeedesign_r)


    I’ve been trying out the plugin, and I’ve noticed that, the more fields I add, the more notices I get when saving the group/ updating the table:
    Notice: Array to string conversion in acf-to-custom-database-tables/includes/class-acfct-database-manager.php on line 247 and on line 248
    During development, when having the error log on, this becomes somewhat annoying.
    I was wondering if this will be fixed in the next update?

    Also a side question, when using the filter:
    add_filter('acf_ct/settings/store_acf_values_in_post_meta', '__return_false');
    The fields values aren’t show anymore in the admin. Is it supposed to work like that?
    I was expecting that it would get the values from the table columns.
    I’ve already made a fix for it via the “acf/load_value” filter, but I was just wondering if I’m missing a setting or filter somewhere?

    • This topic was modified 2 years, 6 months ago by zeedesign_r.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Abhishek

    (@abhisheksatre)

    Hi,

    Thank you for reporting the notice message. We will try to resolve the notice issue.

    When you add the above filter, the plugin does not save ACF data in the post meta table. In the admin, while showing data, if data is not present in the custom table then it displays data from the post meta table.

    – ACF values are not showing for all posts or for a particular post?
    – Please verify whether the data is present in the custom table or post meta table for the post that is not showing the data.
    – If data is not showing for all posts then some other plugins or theme code may be conflicting.

    I tried to replicate the issue. But working fine for me.

    Thread Starter zeedesign_r

    (@zeedesign_r)

    – That’s just it, the data is available/ present in the custom table. But the ACF fields are empty after you create or update a post.
    The data is not in the meta table, because of the added filter.
    – This applies to all posts of this custom post type.
    – Plugins shouldn’t be the issue, because the site only uses 2 Gravity Forms plugins/add-ons at the moment.

    Thread Starter zeedesign_r

    (@zeedesign_r)

    To be completely sure that it’s not a template or plugin problem, I’ve tried it out on a clean WP install.

    I’ve added ACF + this plugin and created a basic child theme for twentytwentytwo WP theme. Then added my custom post type and the filter below:
    add_filter('acf_ct/settings/store_acf_values_in_post_meta', '__return_false');

    After creating/ saving the post, the values are added to the custom table, not added to the meta table (as expected because of the filter).
    However, on reload of the post in admin, no acf fields show any values.

    Like I’ve said before, I have a fix for it via the acf/load_value filter. However, this seems like something that the plugin itself should do. Which is why I wonder if I’m missing something?

    Below is the current fix that I’m using to load the values:

    function zd_get_custom_table_column_value( $value, $post_id, $field ) {
    	$groups = acf_get_field_groups();
    	$parent = array();
    	foreach ($groups as $key => $group) {
    		if ($field["parent"] == $group["ID"]) {
    			$parent = $group;
    		}
    	}
    	if (!empty($parent) && 
    		isset($parent["acf_ct_enable"]) && !empty($parent["acf_ct_enable"]) && 
    		isset($parent["acf_ct_table_name"]) && !empty($parent["acf_ct_table_name"]) && 
    		isset($field["acf_ct_exclude_column"]) && ($field["acf_ct_exclude_column"] != 1 ) ) {
    		$table = 'wp_'.$parent["acf_ct_table_name"];
    		$value = get_custom_table_field($table, $field["name"], $post_id);
    	}
        return $value;
    }
    add_filter('acf/load_value', 'zd_get_custom_table_column_value', 10, 3);
    Plugin Author Abhishek

    (@abhisheksatre)

    Hi,

    Thank you for the detailed steps. I am able to replicate the issue. Will fix the issue asap.

    Plugin Author Abhishek

    (@abhisheksatre)

    Hi,

    The problem has been resolved in the updated version (1.0.4). Please update the plugin and check.

    Thank you so much for reporting the issue ??.

    Thread Starter zeedesign_r

    (@zeedesign_r)

    I’ve updated the plugin, and the fields are indeed still filled after removing my fix. Thanks!

    I do still get the notices after adding a new ACF field though, or wasn’t that fixed yet?

    Notice: Array to string conversion in wp-content/plugins/acf-to-custom-database-tables/includes/class-acfct-database-manager.php on line 247
    Notice: Array to string conversion in wp-content/plugins/acf-to-custom-database-tables/includes/class-acfct-database-manager.php on line 248 
    Plugin Author Abhishek

    (@abhisheksatre)

    Hi,
    This notice is not yet fixed. We are doing some code refactoring to fix this notice.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Notice: Array to string conversion in class-acfct-database-manager.php’ is closed to new replies.