Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter inBytes

    (@inbytesinc)

    Well, actually, the purpose of this post was only to leave a trace to help others with the same problem.

    So you can mark this topic as resolved, if you think you are not going into the WPML “magic”.

    Thread Starter inBytes

    (@inbytesinc)

    I have a lot of experience in WPML, but mostly as a fireman, xD (I agree with you).

    WPML use to be a headache, when you go further than 1,2,3.

    I think that you could check if plugin is enabled with something like this:

    if ( ! class_exists( 'SitePress', false ) ) {

    And then, ask for posts like this:

    global $sitepress;
    
    // Changes to the default language
    $sitepress->switch_lang( $sitepress->get_default_language() );
    
    $args = array(
          'cache_results' => false,
          'name' => $post->post_name,
          'numberposts' => 2,
          'post_type'=> $post->post_type,
          'suppress_filters' => false
    );
    
    $wp_query = new WP_Query( $args );
    
    // Changes to the current language
    $sitepress->switch_lang( ICL_LANGUAGE_CODE );

    Obviously, you should ask before for the post language, instead of the “default language” in the example, and maybe check if this language exists in the destination blog.

    Well, just in case you want to elevate your plugin to the “WPML dark alchemy” level, xDDD.

    Plugin Contributor inBytes

    (@inbytesinc)

    No hurry. I’ve sent you the files.

    Thank you.

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

Viewing 7 replies - 1 through 7 (of 7 total)