Forum Replies Created
-
AuthorPosts
-
November 12, 2024 at 3:29 pm in reply to: /enfold/includes/helper-assets.php generates an error on line 374 and 382 #1471159
Thanks – I have implemented both steps and will monitor the error log to see if the problem has been resolved
November 9, 2024 at 9:57 pm in reply to: /enfold/includes/helper-assets.php generates an error on line 374 and 382 #1470981Update on further testing – I only get this SQL insert error when i am using the Avia Screen Builder. I can update a post or a Learn Dash (our learning system) Topic (which is stored as a post) when i use the default editor.
The problem seems to be confined to updated a LearnDash topic when using the Avia Screen Builder. We have Gutenberg disabled
Does this help point to the source of the problem?
Alex
November 9, 2024 at 10:01 am in reply to: /enfold/includes/helper-assets.php generates an error on line 374 and 382 #1470943Assuming you refer to functions.php – then our site would not work! we have code in functions.php to enable the learning management system learndash to operate and to avoid conflicts between woocommerce shop and ENFOLD. We have not made any changess in this for some time. The problem of false SQL detection and helper-assets is very recent
This is the code in the functions.php – do you see anything that may cause problems?:
<?php/*
* Add your own functions here. You can also copy some of the theme functions into this file.
* WordPress will use those functions instead of the original functions then.
*//*
* Remove fields from woocommerce checkout page
* /
/**
Remove all possible fields by removing the commented out areas
**/
function wc_remove_checkout_fields( $fields ) {// Billing fields
//
/*
unset( $fields[‘billing’][‘billing_company’] );
unset( $fields[‘billing’][‘billing_email’] );
unset( $fields[‘billing’][‘billing_phone’] );
unset( $fields[‘billing’][‘billing_state’] );
unset( $fields[‘billing’][‘billing_first_name’] );
unset( $fields[‘billing’][‘billing_last_name’] );
unset( $fields[‘billing’][‘billing_address_1’] );
unset( $fields[‘billing’][‘billing_address_2’] );
unset( $fields[‘billing’][‘billing_city’] );
unset( $fields[‘billing’][‘billing_postcode’] );
*/// Shipping fields
/*
unset( $fields[‘shipping’][‘shipping_company’] );
unset( $fields[‘shipping’][‘shipping_phone’] );
unset( $fields[‘shipping’][‘shipping_state’] );
unset( $fields[‘shipping’][‘shipping_first_name’] );
unset( $fields[‘shipping’][‘shipping_last_name’] );
unset( $fields[‘shipping’][‘shipping_address_1’] );
unset( $fields[‘shipping’][‘shipping_address_2’] );
unset( $fields[‘shipping’][‘shipping_city’] );
unset( $fields[‘shipping’][‘shipping_postcode’] );
*/
// Order fields
unset( $fields[‘order’][‘order_comments’] );return $fields;
}
add_filter( ‘woocommerce_checkout_fields’, ‘wc_remove_checkout_fields’ );/** Added 22 Feb 2021 by Alex to enable SMTP email usage
*
* This function will connect wp_mail to your authenticated
* SMTP server. This improves reliability of wp_mail, and
* avoids many potential problems.
*
* For instructions on the use of this script, see:
* https://butlerblog.com/easy-smtp-email-wordpress-wp_mail/
*
* Values for constants are set in wp-config.php
*/
add_action( ‘phpmailer_init’, ‘send_smtp_email’ );
function send_smtp_email( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = SMTP_HOST;
$phpmailer->SMTPAuth = SMTP_AUTH;
$phpmailer->Port = SMTP_PORT;
$phpmailer->Username = SMTP_USER;
$phpmailer->Password = SMTP_PASS;
$phpmailer->SMTPSecure = SMTP_SECURE;
$phpmailer->From = SMTP_FROM;
$phpmailer->FromName = SMTP_NAME;
}/* Replace logo based on ‘promotion code’ – Jelmer*/
add_action( ‘wp_head’, ‘logo_css’, 0 );
function logo_css() {
$user = wp_get_current_user();
$user_info = get_userdata($user->ID);
$code = $user->promotion_code;
if( strcasecmp($code, ‘RightBrains’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/04/rsz_1rightbrains.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Polaris’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/04/rsz_polaris.jpg) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Nyenrode’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/03/Logo-Small.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘StrategyWorks’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/09/SWSA-LOGO-3-1-e1600615027209.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘EXIN’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/02/Screenshot-2021-02-25-at-16.18.48.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Beeckestijn’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/05/Beeckestijn.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘HQAI2021’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/05/Screenshot-2020-05-01-at-13.53.02.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Assurant2020’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2020/05/rsz_assurant-logo.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Computrain’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/02/CT-Small-Logo.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘NCOI’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/02/NCOI-Small-Logo.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘NCD’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/03/NCD-Kleiner.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘Randstad’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/04/Randstad.png) no-repeat;}</style></head>”;
}
if( strcasecmp($code, ‘GK2021’) == 0){
echo “<style>span.logo{display:none;}</style></head>”;
echo “<style>div.inner-container{background:url(https://axveco.com/wp-content/uploads/2021/04/GK-Logo-small-1.jpg) no-repeat;}</style></head>”;
}
}/* ‘Edit profile’ redirects to profile page – Jelmer*/
add_action( ‘load-profile.php’, ‘Redirect_profile_axveco’);
function Redirect_profile_axveco (){
if( ! current_user_can( ‘manage_options’ ) )
exit( wp_safe_redirect( “https://axveco.com/en/profile/” ) );
}/* Redirect wp-login to loginwp screen – Jelmer*/
add_filter( ‘login_url’, ‘my_login_page’, 10, 3 );
function my_login_page( $login_url, $redirect, $force_reauth ) {
$login_page = “https://axveco.com/en/loginwp/” ;
$login_url = add_query_arg( ‘redirect_to’, $redirect, $login_page );
return $login_url;
}/* Shows headers promotion code in the admin user table – Jelmer*/
add_filter(‘manage_users_columns’, ‘add_promotion_code_column’);
function add_promotion_code_column($columns) {
$columns[‘promotion_code’] = ‘Promotion Code’;
return $columns;
}
/* Shows content promotion code in the admin user table – Jelmer */
add_action(‘manage_users_custom_column’, ‘show_user_promotion_code_column_content’, 10, 3);
function show_user_promotion_code_column_content($value, $column_name, $user_id) {
$user = get_userdata( $user_id );
if ( ‘promotion_code’ == $column_name )
return $user->promotion_code;
return $value;
}/*Archive category page layout JP https://kriesi.at/support/topic/category-archive-page-change-layout-to-show-excerpt
add_filter(‘avf_blog_style’,’avia_change_category_blog_layout’, 10, 2);
function avia_change_category_blog_layout($layout, $context){
if($context == ‘archive’) $layout = ‘single-big’;
return $layout;
}*/add_filter(‘avf_blog_style’,’avia_change_category_blog_layout’, 10, 2);
function avia_change_category_blog_layout($layout, $context){
if($context == ‘archive’) $layout = ‘blog-grid’;
return $layout;
}add_action(‘wp_footer’, ‘add_custom_tooltip’);
function add_custom_tooltip(){
?>
<script>
jQuery(window).load(function(){
jQuery(‘a’).removeAttr(‘title’);
jQuery(‘img’).removeAttr(‘title’);
});
</script>
<?php
}/*
* This function is required to display the location map on the contact us page
* if removed then the map does not display – API key is from Theme Google services
*/
add_action(‘wp_footer’, ‘gmaps_workaround’);
function gmaps_workaround(){
?>
<!–Google Maps JavaScript API –>
<script src=”https://maps.googleapis.com/maps/api/js?key=AIzaSyCWwtEsgQqGTvuqmzrZMapkbyzqyxCKZBw”
type=”text/javascript”></script>
<script type=”text/javascript”>
jQuery(document).ready(function($){
setTimeout(function(){
$(‘#s_pdf_frame’).attr( ‘src’, function ( i, val ) { return val; });
}, 100);
});
</script>
<?php
}// add_action(‘avia_builder_mode’, “builder_set_debug”);
function builder_set_debug()
{
return “debug”;
}/*
* this funciton has been updated – see above post in header
* the original code is: $meta[‘page’][] = ‘events’;
*
* Adds PageBuilder to LearnDash Post Typs
* this is to enable the Advanced Builder in LearnDash – Alex
* see post at https://kriesi.at/support/topic/learndash-plugin/
*
}*/
add_filter(‘avf_builder_boxes’, ‘add_builder_to_posttype’);
function add_builder_to_posttype($metabox)
{
foreach($metabox as &$meta)
{
if($meta[‘id’] == ‘avia_builder’ || $meta[‘id’] == ‘layout’)
{
/* original code: $meta[‘page’][] = ‘events’; instead add the name of the custom post type here*/
$meta[‘page’][] = ‘sfwd-courses’;
$meta[‘page’][] = ‘sfwd-lessons’;
$meta[‘page’][] = ‘sfwd-topic’;
$meta[‘page’][] = ‘sfwd-quiz’;
}
}
return $metabox;
}/*
* After installing Woocommerce bookings, the events table function was no longer needed
* I cannot determine whether ‘Events’ post type here is related to events…
*/
add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
register_post_type( ‘Events’,
array(
‘labels’ => array(
‘name’ => __( ‘Events’ ),
‘singular_name’ => __( ‘Event’ )
),
‘public’ => true,
‘has_archive’ => false,
‘hierarchical’ => true,
‘supports’ => array( ‘title’, ‘editor’)
)
);register_taxonomy(
‘event_categories’, //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces).
‘events’, //post type name
array(
‘hierarchical’ => true,
‘label’ => ‘Categories’, //Display name
‘query_var’ => true
)
);
}
/*
* Goal here is to disable woocommerce from opening the default shop page which is incompatible with
* our ENFOLD Child theme and appears to be the cause of the Internal Server Error intermittent failure
* We log that the event has occurred, disbale woocommerce and then redirect to a safe page
*/
function custom_woocommerce_redirect_shop_page() {
if (is_shop()) {
// Send an email to log that this event has occured// Get the current user info
$current_user = wp_get_current_user();
$username = $current_user->user_login;
//$is_logged_in = is_user_logged_in() ? ‘Yes’ : ‘No’;// Send email notification if logged in (not logged in generates a hit every minute)
if (is_user_logged_in()) {
$to = (Email address hidden if logged out) ‘;
$subject = ‘WooCommerce Shop Page Disable invoked’;
$message = ‘The WooCommerce shop page open was attempted and has been disabled.’;
$message .= ‘<br>User: ‘ . $username;
//$message .= ‘<br>Logged in: ‘ . $is_logged_in;
$headers = array(‘Content-Type: text/html; charset=UTF-8’);wp_mail($to, $subject, $message, $headers);
}
// Remove the default WooCommerce content for the shop page
remove_action(‘woocommerce_archive_description’, ‘woocommerce_taxonomy_archive_description’, 10);
remove_action(‘woocommerce_archive_description’, ‘woocommerce_product_archive_description’, 10);
remove_action(‘woocommerce_before_main_content’, ‘woocommerce_output_content_wrapper’, 10);
remove_action(‘woocommerce_after_main_content’, ‘woocommerce_output_content_wrapper_end’, 10);
remove_action(‘woocommerce_sidebar’, ‘woocommerce_get_sidebar’, 10);// Set up a target page to redirect to
$alternative_shop_page = “https://axveco.com/en/your-next-step/” ;// Redirect to our own next steps page
wp_redirect($alternative_shop_page);exit;
}
}
add_action(‘template_redirect’, ‘custom_woocommerce_redirect_shop_page’);/*
* End of functions.php
*/
?>fixed by following the list of options in the link!
The new token appears to work now – thanks for your support
alex
Trying and failing to register a valid new token…
I went to this page – https://build.envato.com/my-apps/#tokens
I could see the previous (existing old) token that works but does not enable updatesI clicked “Create a new token” and was presented with about 20 options – i clicked the ones that seemed sensible
When entering and testing this new token:
———–
Last time we checked the token we were not able to connected to Envato:
Purchases could not be accessed
Username could not be accessed (needed for your information only)
E-Mail could not be accessed (needed for your information only)
Following errors occurred:
Purchases: Errorcode 403 returned by Envato: Forbidden:
– response_code: 403
– reason: scope-missing
username Errorcode 403 returned by Envato: Forbidden:
– code: not_authenticated
email Errorcode 403 returned by Envato: Forbidden:
– code: not_authenticated
Purchases: A problem occurred accessing your purchases. Unable to check for updates.
———–Which options should i have clicked to verify my license and enable upgrades?
Thank you for this update and I have manually updated the Theme to 6.0.1 as indicated
If I interpret your advice above – the Envato token is for updates only so my new theme will work already?
I cant see in the Envato Theme Forest site where to arrange a new token – do you have a link to this?
AlexIn verison 4.4 we were not offered the option to switch off the captcha – it does not appear in the google services menu dropdown. that was the license arranged by our former employee. i could not upgrade this to 4.8 due to the block from 4.4 to 4.5 as the manual upgrade requires entering the purchase code, not the API and i dont have that and cant log in to the account of the former employee
therefore i have to purchase the product a second time to do the upgrade and solve the captcha conflict by disabling the captcha in the theme
I have now registered and have purchased a new license – this means we have paid twice for your product….
this enabled update to 4.8 and switching off the captcha -
AuthorPosts