WordPress.org

Ready to get started?Download WordPress

Forums

Confirm Publishing Actions
[resolved] Confirm button only shown when deleting a post (17 posts)

  1. wandelhalle
    Member
    Posted 2 years ago #

    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/

  2. Peter J. Herrel
    Member
    Plugin Author

    Posted 2 years ago #

    Thanks for the report, I'll have a look asap!

  3. Peter J. Herrel
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  4. wandelhalle
    Member
    Posted 2 years ago #

    I'm running wp 3.4.1 and avatars-plugin and wp-pagenavi. Firefox error console does not give a hint concerning cpa.

  5. Peter J. Herrel
    Member
    Plugin Author

    Posted 2 years ago #

    Could you supply a link to that avatars-plugin? And as to WordPress themes, which one are you using?

  6. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    @wandelhalle, it's been 2 weeks since your last reply. Are you still having trouble?

  7. wandelhalle
    Member
    Posted 1 year ago #

    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/sandbox

  8. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    I 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?

  9. inBytes
    Member
    Plugin Contributor

    Posted 1 year ago #

    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)
    }
  10. inBytes
    Member
    Plugin Contributor

    Posted 1 year ago #

    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;
        });
  11. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  12. inBytes
    Member
    Plugin Contributor

    Posted 1 year ago #

    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.

  13. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  14. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    Version 1.2 released, marking issue as resolved

    http://wordpress.org/extend/plugins/confirm-publishing-actions/

  15. inBytes
    Member
    Plugin Contributor

    Posted 1 year ago #

    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.

  16. Peter J. Herrel
    Member
    Plugin Author

    Posted 1 year ago #

    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!

  17. inBytes
    Member
    Plugin Contributor

    Posted 1 year ago #

    No hurry. I've sent you the files.

    Thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags