138 reputation
115
bio website
location
age
visits member for 3 years, 1 month
seen 15 hours ago

Apr
14
comment Prevent wp_debug from polluting ajax within plugin
$wpdb->esc_like($title) works, though the headers sent warning returns, and ob_buffer still has noting to delete. - squirlie problem this is. I'll workin your more robust suggestions and hopeful in that process I sort the issue.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Well spotted! However, this leads to PHP Strict Standards: Non-static method wpdb::esc_like() should not be called statically in . . . . 8{
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
given what Im seeing - I'm going to work in your second approach. I'd like this to be as robust as possible without making demands on the environment. I can see having to move hosts for example in a year, and I'd hate to overcomplicate this, in case its not me who does it. It will take a few days before I can get to this but will come back with comments. Many thanks again for sharing your approach - very helpful indeed.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Also, regardless of the use or warnings related to ob_clean, I'm still seeing the notices make their way through to the response, so a check won't affect the results. This would seem evidence that ob_clean, isn't actually doing what the codex suggest. joson_encode however does just fine, when wp_debug is disabled. So this leads me to think that the notices are causing the issue, not the construction of json itself. a quandry - I will double check the json results to be sure.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
Thanks for the detailed write up! I will digest, but regarding the headers, I initially had them where you suggested, but received headers already sent warnings. I moved it up to the position until they disappeared.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
There deprecated notices for like_escape which is used in wp-includes/functions.php, so nothing I have control over as Im currently running the latest version of WP. @TheDeadMedic following guidance from codex.wordpress.org/AJAX_in_Plugins, they sugest under the dubuggin section that ob_clean() will clear any notices before sending them through as part of the json output - wreaking havoc. -- I'll up the post with their recommendations.
Apr
14
comment Prevent wp_debug from polluting ajax within plugin
@TheDeadMedic your advice is good and I've taken a revision. But the result is the same. @czerspalace with this refactoring the result is the same as your suggestion no? Yes a better block of code, but still: PHP Notice: ob_clean(): failed to delete buffer. No buffer to delete in ....
Nov
8
comment dynamically update permalink and title with the values of custom fileds
I've not been able to test this yet, but am accepting this as is because the WP documentation supports what you've said. Thanks!
Nov
5
comment dynamically update permalink and title with the values of custom fileds
I've updated the title to better reflect what Im after. I think hiding the title field is nessicary to prevent the user from getting the impression they can efect changes here. Ultimatly I would like to pull custom field data but wp_insert_post_data is exactly what I need to acomplish this. One question - what happens if two posts have exactly the same $data['post_name'] ?
Jul
31
comment admin_notices after register_uninstall / deactivate_hook
@kaiser Yes I've seen all the docs and that answer - but none allow a notice to the admin due (i believe) to the page refresh after they occur. Will update question in a moment.
Jul
31
comment Uninstall, Activate, Deactivate a plugin: typical features & how-to
Think this should do it: register_activation_hook( __FILE__, function() { add_option('Activated_Plugin','Plugin-Slug'); }); add_action('admin_init', 'load_plugin'); function load_plugin() { if ( ! current_user_can( 'activate_plugins' ) ) return; if(is_admin()&&get_option('Activated_Plugin')=='Plugin-Slug') { delete_option('Activated_Plugin'); add_action( 'admin_notices', 't5_check_admin_notices', 0 ); } }
Jul
31
comment Uninstall, Activate, Deactivate a plugin: typical features & how-to
Actually just stumbled on the easy way: stackoverflow.com/a/13927297/362445
Jul
31
comment Uninstall, Activate, Deactivate a plugin: typical features & how-to
I see - but if the plugin is activated outside the plugin page (say as part of a theme dependency) then your checks will get skipped no? So I tried moving add_action( 'admin_notices', 't5_check_admin_notices', 0 ); into an activation hook and the plugin activates without performing the checks . . .
Jul
31
comment Uninstall, Activate, Deactivate a plugin: typical features & how-to
Touch confused, so basically there isn't a call to register_activation_hook here -- why not use it? Also will this fire before or after register_activation_hook and will register_activation_hook fire even if the above doesn't pass?
Jun
26
comment WordPress MultiSite Active Directory integration and site privacy
How did you get on with this? Im researching a similar implementation for a school.
Mar
3
comment Conditionally Loading JavaScript/CSS for Shortcodes
bit of an aside but doesn't this assume that people are using header.php and footer.php. What about theme wrapping methods such those described by scribu.net/wordpress/theme-wrappers.html ? or themes like roots that keep their template parts elsewhere?
Feb
8
comment How to replace regular jquery calls with CDN calls from Google?
just noticed this nice little hack has been folded into the wordpress Roots theme - sweet github.com/retlehs/roots/blob/master/lib/scripts.php
Jan
10
comment passing markup thought a shortcode attribute
Sorry thought it was in the thread - the preview is a tinyMCE modal that allows the user to set parameters and see the changes in a live map. It then inserts the shortcode into the post. Transients are uncharted territory for me, so I was wondering if there was an easer way to handel my situation - hence my first attempt at shoving all the markup though a parameter! You've been very helpful by the way - thanks.
Jan
9
comment passing markup thought a shortcode attribute
Yes in some ways but it need not call the google API for marker data each time. Consider: a) at the preview stage we ping the API and pull associated address, content, images, ratings etc. and store that content/markup in the database for later use (ie we just add that content to a marker in the map - no api call needed) or B) only store the address and make a new api call each time the page is loaded. Option 'B' will, I believe be significantly slower. This is why Im still considering the WP transients API to store the details rather then shoving them explicitly as parameters in the shortcode
Jan
8
comment passing markup thought a shortcode attribute
Sorry for the late reply - Holidays took me by storm (literally in some respects). I'll follow your advice and break up the parameters as you've suggested. I was just hoping that there might be another way to go about it. Basically the maps API can grab a bunch of unknown items like ratings etc if they exist for the location in question. I just hoped I could get the output at the preview stage, without the plugin having to make another request later (or each time it was called).