Skip Navigation

[Resolved] Uncaught TypeError: Cannot read property 'settings' of undefined admin

This support ticket is created 5 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by bartv-9 5 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1233457

All my post types, content templates and views are set. And all of sudden a lot of functions stopped working. When I'm trying to add pictures, wrong pictures come out in the front. The address field in post editor is not loading the map anymore and it all seems to come from this error (so this error comes in the console when I want to add a new post of custom post type):

jquery.validate.min.js?ver=1.8.1:15 Uncaught TypeError: Cannot read property 'settings' of undefined

quicktags.min.js?ver=5.1.1:1 Uncaught TypeError: Cannot read property 'bs_component_show_hide_button' of undefined

I've already tried to switch themes, deactivate all plugins, nothing helps.

For example: try to add a new custom post, for example: Add New Essential, you will see that when you try to upload an image (click checkbox premium to be able to upload a header image) it will first refresh the page and after that you can upload it, but it is not shown on the front correctly.

The only thing that made it work again was deleting all relationships, but obviously I can't do that because the whole site is build off them.

Kind regards,

#1233514

Ok, the problem above I seemed to have solved by not opening specific custom fields by checking a checkbox in the post editors.

But now another problem has come up. I used to be able to output title, alt, caption, id and tags by attachments url's, but this somehow doesn't work anymore.

This is a shortcode example:
[wpv_display_file_name info="id" url="[wpv-post-featured-image size='full' output='url']"]

And this is the function I use:
add_shortcode( 'wpv_display_file_name', 'wpv_display_file_title_func');
function wpv_display_file_title_func($atts) {

global $wpdb;
$atts = shortcode_atts( array(
'img' => '',
'url' => '',
'info' => '', // title, alt or id return
), $atts);
$res = '';
$url = $atts['url'];
$attachment_id = $wpdb->get_var($wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE guid = %s", $url
));
if($atts['info'] == 'title'){
$res = get_the_title($attachment_id);
}
if($atts['info'] == 'alt'){
$res = get_post_meta($attachment_id, '_wp_attachment_image_alt', true);
}
if($atts['info'] == 'caption'){
$res = get_the_excerpt($attachment_id);
}
if($atts['info'] == 'id'){
$res = $attachment_id;
}
if($atts['info'] == 'tag'){
$res = get_the_term_list($attachment_id, 'post_tag');
}
return $res;
}

It worked really well before, but now it doesn't anymore.

The login data is the same as I put in the previous message.

Kind regards,

#1233653

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - When you try to display the featured image using Types, now Types shortcode [wpv-post-featured-image] supports following output options:

'img' | 'url' | 'alt' | 'id' | 'author' | 'date' | 'description' | 'title' | 'caption'

For example:

[wpv-post-featured-image output="title"] - to display title of featured image
[wpv-post-featured-image output="description"] - to display the description of the featured image

More info:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-featured-image

#1233660

Hi Minesh,

Thats what I did. Just use the functions within Toolset, still it would be nice to get the ID of an image generated in a custom field. I found this code, but it only works within some views but not all:

function prefix_get_img_ids($atts) {
global $post;

$images = (array) get_post_meta($post->ID, 'wpcf-picture', false); // cast to array in case there is only one item
$ids = array();

global $wpdb;

foreach($images as $img) {
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$img'";
$id = $wpdb->get_var($query);
$ids[] = $id;
}

return implode(",",$ids);
}
add_shortcode("get-image-ids", "prefix_get_img_ids");

shortcode: [get-image-ids]

Is there a steady function and shortcode just to output an image id that is uploaded through a custom field?

#1233662

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - when you say "it only works within some views but not all" - Can you please share problem URL where you are using above shortcode with the view where the code is not working?

#1233714

Already got it, just discovered that fields within repeatable groups are actually posts on themeselves, which means they have their own 'id', am I right?

#1233731

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - each custom image will be saved as separate post. yes, so it's post entry itself.

#1233746

Ok, well this is enough to create what I want. Thanks!

#1233747

My issue is resolved now. Thank you!