WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: Confirm Publishing Actions] Confirm button only shown when deleting a post

[Resolved] [Plugin: Confirm Publishing Actions] Confirm button only shown when deleting a post

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Peter J. Herrel

    @donutz

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

    Plugin Author Peter J. Herrel

    @donutz

    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.

    Plugin Author Peter J. Herrel

    @donutz

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

    Plugin Author Peter J. Herrel

    @donutz

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

    Plugin Author Peter J. Herrel

    @donutz

    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?

    Plugin Contributor inBytes

    @inbytesinc

    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)
    }

    Plugin Contributor inBytes

    @inbytesinc

    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;
        });

    Plugin Author Peter J. Herrel

    @donutz

    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!

    Plugin Contributor inBytes

    @inbytesinc

    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.

    Plugin Author Peter J. Herrel

    @donutz

    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?

    Plugin Author Peter J. Herrel

    @donutz

    Version 1.2 released, marking issue as resolved

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

    Plugin Contributor inBytes

    @inbytesinc

    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.

    Plugin Author Peter J. Herrel

    @donutz

    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!

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Resolved] [Plugin: Confirm Publishing Actions] Confirm button only shown when deleting a post’ is closed to new replies.