Hello Christian... Here are the logs and I hope we can work through this without the duplicator package. If we reach a dead end I will need to set up a special server environment for beta testing as I have to keep things separate for security reasons.
Did as you asked and I also created a new post. Further I have once again included all code so you have everything in front of you. There are a couple screenshots and you will see that there is also an error at the top of the post just below the title area.
WP-CONFIG FILE
/* Testing mode with log as per Christian */
define('WP_DEBUG', true);
ini_set('log_errors',TRUE);
ini_set('error_reporting', E_ALL);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
FUNTIONS.PHP FILE
/* Add favorites functionality to posts via Toolset CRED */
add_action('cred_save_data_368', 'sda_user_favorites',10,2);
function sda_user_favorites($post_id, $form_data) {
if( isset($_REQUEST['remove-favorite']) ) {
delete_post_meta($post_id, 'wpcf-favorites', get_current_user_id());
} else {
add_post_meta($post_id, 'wpcf-favorites', get_current_user_id(), false);
}
}
/* Favorites shotcode for use as a conditional */
add_shortcode( 'toolset_is_favorite', 'toolset_is_favorite_func');
function toolset_is_favorite_func($atts)
{
global $wpdb;
$post_id = $atts['id'];
$user_id = get_current_user_id();
$favorites = $wpdb->get_results( "SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = $post_id AND meta_value = $user_id LIMIT 1");
return sizeof($favorites) ? 1 : 0;
}
CRED POST FORM - CONTENT
[credform class='cred-form cred-keep-original']
***Post ID: [wpv-post-id]<br />
***Is favorite: [toolset_is_favorite id='[wpv-post-id]']<br />
[wpv-conditional if="( [toolset_is_favorite id='[wpv-post-id]'] eq '1' )" debug="true"]
[cred_generic_field field='remove-favorite' type='hidden' class='']
{
"required":0,
"validate_format":0,
"default":"1"
}
[/cred_generic_field]
[/wpv-conditional]
[cred_field field='form_submit' value='Favorite' urlparam='' class='x-btn x-btn-global mam']
[/credform]
CRED POST FORM - JS EDITOR
jQuery(window).bind("load", function() {
jQuery( "form[id^='cred_form_368']").find("input[type='submit']").val(jQuery( "input[name='remove-favorite']").length ? "Remove from Favorites" : "Add to Favorites");
}
)
ERROR LOG (Deleted any old logs so this is just the info from time of test)
[18-Dec-2017 23:54:31 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 1 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:54:43 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 1 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('wp_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, CRED_Form_Builder_Base->init, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:54:44 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 1 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:57:09 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 2 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:57:19 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 2 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('wp_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, CRED_Form_Builder_Base->init, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:57:19 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 2 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:58:23 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 2 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('wp_loaded'), WP_Hook->do_action, WP_Hook->apply_filters, CRED_Form_Builder_Base->init, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:58:23 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 2 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func
[18-Dec-2017 23:59:12 UTC] WordPress database error Table '0-test-hybridsite-wp-gDE6T0ir.wp_postmeta' doesn't exist for query SELECT * FROM wp_postmeta WHERE meta_key = 'wpcf-favorites' AND post_id = 409 AND meta_value = 1 LIMIT 1 made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/astra/single.php'), get_template_part, locate_template, load_template, require('/themes/astra/template-parts/content-single.php'), astra_entry_content_single, do_action('astra_entry_content_single'), WP_Hook->do_action, WP_Hook->apply_filters, astra_entry_content_single_template, get_template_part, locate_template, load_template, require('/themes/astra/template-parts/single/single-layout.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, CRED_Helper::credFormShortcode, CRED_Helper::cred_form, CRED_Form_Builder_Base->get_form, CRED_Form_Base->print_form, CRED_Form_Post->build_form, wpv_do_shortcode, apply_filters('wpv-pre-do-shortcode'), WP_Hook->apply_filters, WPV_Frontend_Render_Filters::wpv_pre_do_shortcode, wpv_parse_content_shortcodes, do_shortcode, preg_replace_callback, do_shortcode_tag, toolset_is_favorite_func