Forum Replies Created
-
AuthorPosts
-
Anh Tran
KeymasterHi Hazmi,
The
imagefield don't have any ajax request. It's a simple HTML5filefield. That probably is the reason why it's fast.we have problems only in administration of website. The frontend is super fast with no problem and no errors. I read a lot of blog posts about admin-ajax that says that this file in more use cause WP very slow – that’s right.
Interesting. That might be related to the WP backend. Probably WP doesn't optimize the back end too much, especially if there are many plugins behave poorly on the back end.
May 20, 2019 at 3:29 PM in reply to: ✅User Edit After Frontend Submission - only shows confirmation msg #14640Anh Tran
KeymasterHi,
All you need to do is including
edit="true"to the shortcode.Anh Tran
KeymasterWhat do you mean the old validation? It's still the same one. I just improved it.
Anh Tran
KeymasterHi Calpaq,
Can you please re-download the plugin? Looks like I uploaded the wrong file :(.
May 20, 2019 at 9:59 AM in reply to: ✅Validation responses when filtering via rwmb_frontend_validate #14633Anh Tran
KeymasterHi TGHP,
I've just updated the plugin to the version 2.0.0 with better server-side validation. Please see the updated documentation for details.
Anh Tran
KeymasterHi,
Sorry for the confusion. I've just updated the plugin to version 2.0.0 with a better validation. Please try again with the same code.
If you want to set custom error message, please see the documentation.
Anh Tran
KeymasterSometimes, the Geocoder doesn't return precise coordinates (in some countries where OSM / Google Maps don't have enough data). In that case we should allow users to drag the pin to correct address.
I'll include the library into OSM field. Thanks for suggesting!
Anh Tran
KeymasterYes, that's right. Please replace the existing Meta Box with the Github version.
Anh Tran
KeymasterCan we validate after form submit using php backend validation if the image field is empty in-case as the front validation not works
Yes, you can do that. Here is a simple code that check for the field value before processing the form, and if it fails, redirect users to an error page:
add_filter( 'rwmb_frontend_validate', function( $is_valid, $config ) { if ( 'meta-box-id' !== $config['id'] ) { return $is_valid; } if ( empty( $_POST['image_upload_field'] ) ) { $is_valid = false; } return $is_valid; }, 10, 2 );May 17, 2019 at 4:25 PM in reply to: ✅metabox.io media-grid.min.js not loading on frontend form #14610Anh Tran
KeymasterI'm afraid this is a theme issue. Your theme might overwrite/change the styles of WordPress popup. This can be resolved only by checking the CSS and rewrite that in theme.
Anh Tran
KeymasterHi Neil,
I think your code snippet in the first reply works pretty well. I modify it a little bit to creates a shortcode for showing website screenshot. It takes URL from a field.
add_action( 'init', function() { add_shortcode( 'screenshot', function( $atts ) { $atts = shortcode_atts( [ 'width' => 300, 'height' => 300, 'field' => 'website_url', ], $atts ); $url = rwmb_meta( $atts['field'] ); if ( ! $url ) { return ''; } $query_url = 'http://s.wordpress.com/mshots/v1/' . urlencode( $url ) . "?w={$width}&h={$height}"; $image_tag = "<img width='$width' height='$height' src='$query_url'>"; return "<a href='$url'>$image_tag</a>"; } ); } );Anh Tran
KeymasterHi Mark,
When you use an image field like
image_advanced, the return value from the helper function is an array of full info for the image, such as URL, alt text, width and height. See this for full details.You need to change your code to:
return "<img src=\"{$icon['url']}\" alt=\"organization-icon\" width=\"64\" height=\"64\" class=\"dgtl-admin-menu-profile\" />$org";Anh Tran
KeymasterHi,
I've just updated the plugin to add an alert when users clicking the Find Address but no address found.
According to the options:
– the pin to either be locked (so the user can’t drag it around), or to actually update the coordinates to the position the user places it.
That would be confusing when users want to manually select or adjust an address on the map.
– the find address function to be triggered every time the user changes the address, city, and country
That's possible. But that might cause a non-friendly experience if users are entering the data and see the "No results found" message.
I think that can be done when user done typing on the address fields.
Implementing this behavior, we don't need the "Find Address" button anymore.
– give the user feedback when the address is updated, and especially if no address is found using the entered data
Done the part of notifying users when no address is found.
Showing a notification when an address is found seems weird, especially if we do the automatically adjust the map as above.
– trigger the find address function on submit if the user doesn’t click on the button
I don't think this is a good option, since it confuses users (as they didn't select an address).
In my opinion, implementing the "auto adjust the map when address change" is the best option. I'll try to do that now and let you guys see the result.
Update: I've done that here. Please download and let me know what you think.
What's done:
- Remove "Find Button"
- Auto adjust the map when address fields change. Work only for multiple address fields. Single address field already have autocomplete.
Anh Tran
KeymasterHi,
You can set the default location via
stdparameter, like this:'std' => '53.346881,-6.258860'By passing a pair of latitude, longitude, you can set the default location of the map.
Anh Tran
KeymasterHi Hazmi,
The data for these 2 field types are the same, so you want to switch field type, it's ok to do so.
Besides, the ajax request is very minimal as it only queries for attachments. There's no requests to other resources (CSS, JS). So if you see a lot of errors, I think the website should be optimized.
-
AuthorPosts