[Plugin: Confirm Publishing Actions] Confirm button only shown when deleting a post
-
The confirm button is only shown when deleting a post – not when submitting/publishing/updating a post. What could be the reason?
Thanks a lot in advance.http://wordpress.org/extend/plugins/confirm-publishing-actions/
-
Thanks for the report, I’ll have a look asap!
Just tested the plugin on wp 3.4.1 and cannot reproduce your problem. Could you provide some more details? WP version, other plugins you’re running, … Also, you could check Firefox error console or chrome dev tool to discover what causes the problem.
I’m running wp 3.4.1 and avatars-plugin and wp-pagenavi. Firefox error console does not give a hint concerning cpa.
Could you supply a link to that avatars-plugin? And as to WordPress themes, which one are you using?
@wandelhalle, it’s been 2 weeks since your last reply. Are you still having trouble?
Sorry, here ist the avatars-plugin link: http://wordpress.org/extend/plugins/add-local-avatar/
I’m using Sandbox theme, http://wordpress.org/extend/themes/sandboxI checked on a local install with the Sandbox theme and avatars plugin active, and I could not reproduce.
By the way, it seems the Sandbox theme has gotten a bit outdated (“This theme hasn’t been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.”), turning on debug in wp-config.php reveals a number issues. None of these however seem to relate to the problem you’re having with the cpa plugin.
Other ideas? Maybe some kind of code snippet in your functions.php?
Hello donutz.
Your plugin is not working at all, because of l10n.
If you want that l10n works, you must do this on “cpa.php” (search for “// FIX (inBytes)” text):
function __construct() { $this->plugin_dir_url = trailingslashit( plugins_url( dirname( plugin_basename( __FILE__ ) ) ) ); new CPA_Confirm_Publishing_Actions_Options; if ( is_admin() ) { add_action( 'admin_enqueue_scripts', array( &$this, 'cpa_admin_scripts_enqueue' ) ); } add_action('init', array( &$this, 'init' )); // FIX (inBytes) } function init() { //load_plugin_textdomain( 'pjh-cpa', false, $this->plugin_dir_url . '/inc/lang/' ); load_plugin_textdomain( 'pjh-cpa', false, dirname(plugin_basename(__FILE__)) . '/inc/lang/' ); // FIX (inBytes) }
Furthermore, you reduce the check in your “cpa.js” file to the english expressions of the buttons. But do you think that the value of “Publish” button will be the same in, for example, spanish language?
So, you have to alter “cpa.php” like this:
$cpa_l10n_data = array( 'confirm_delete' => $d, 'confirm_submit' => $s, 'confirm_publish' => $p, 'confirm_update' => $u, 'submit' => __('Submit for Review'), 'publish' => __('Publish'), 'update' => __('Update') );
And your “cpa.js” like this:
$j("input#publish").click(function () { // FIX entire function (inBytes) var a = $j(this).val(); var bConfirmation = true; if (a == cpa_l10n_obj.submit) { bConfirmation = confirm(cpa_l10n_obj.confirm_submit) } if (a == cpa_l10n_obj.publish) { bConfirmation = confirm(cpa_l10n_obj.confirm_publish) } if (a == cpa_l10n_obj.update) { bConfirmation = confirm(cpa_l10n_obj.confirm_update) } if(!bConfirmation){ $j("#submitpost .spinner").hide(); $j("input#publish").removeClass("button-primary-disabled"); } return bConfirmation; });
Hi @inbytes,
Thanks for your feedback. Forgetting to actually hook into init is absolutely stupid. CPA was my first plugin ever, and I admit I’ve been a bit neglectful towards it. I’ll review your suggestions and release an update asap!
That’s nice, donutz!
I’m still have a reasonable doubt that my JS code still doesn’t work for every language.
I mean: if the ‘submit’, ‘publish’ and ‘update’ strings return any kind of UTF8 codes (for JavaScript), maybe when you do the comparisons, the expressions never fits.
For example:
English: “Submit for Review”
Spanish: “Enviar para revisión”
Sended with wp_localize_script: “Enviar para revisi\u00f3n” (UTF8)
Needed (I guess): “Enviar para revisión”I hope being able to explain myself.
Greetings.
I tested submitting for review with Spanish WP, seems like jQuery has no trouble with comparing the strings, in other words: it simply works. Thanks! Would you like me to add you as plugin contributor?
Version 1.2 released, marking issue as resolved
http://wordpress.org/extend/plugins/confirm-publishing-actions/
If you don’t mind, it would be nice to be a contributor.
And if you want to include it, I could send you the spanish localization mo/po.
Thanks for your rapid response.
Cool, I’ll add your .org username asap! You can email the files (check cpa.php for my email) or send a pull request via https://github.com/diggy/confirm-publishing-actions
Cheers!
- The topic ‘[Plugin: Confirm Publishing Actions] Confirm button only shown when deleting a post’ is closed to new replies.