Viewing 5 replies - 16 through 20 (of 20 total)
  • I just checked: it appears that all the non super-admin administrators cannot display the meta box and do not have the option to do so. As soon as I grant super admin privilege on one particular user, this user suddenly have access to multilingualpress.

    I just found that there is no documented “publish” capability.
    If I replace the line:
    return current_user_can_for_blog( $blog_id, 'publish' );
    By:
    return current_user_can_for_blog( $blog_id, 'publish_post' );

    Then suddenly the administrator can translate!

    current_user_can_for_blog( $blog_id, ‘publish’ ) works for super admins because it returns always true for them:

    wp-includes/capabilities.php

    1044	                // Multisite super admin has all caps by definition, Unless specifically denied.
    1045	                if ( is_multisite() && is_super_admin( $this->ID ) ) {
    1046	                        if ( in_array('do_not_allow', $caps) )
    1047	                                return false;
    1048	                        return true;
    1049	                }

    So I think solution for this bug is to use publish_post and publish_page capabilities.

    I suggest the following correction in file Mlp_Translation_Metabox.php:

    private function is_translatable_by_user( WP_Post $post, $blog_id ) {
    		$blog_id = absint( $blog_id );
    
    		$post_type = get_post_type( $post );
    		if( $post_type === FALSE )
    		{
    			return FALSE;
    		}
    
    		$remote_post = $this->data->get_remote_post( $post, $blog_id );
    		if ( isset( $remote_post->dummy ) && $remote_post->dummy === TRUE ) {
    			return current_user_can_for_blog( $blog_id, 'publish_' . $post_type . 's' );
    			//return current_user_can_for_blog( $blog_id, 'publish' );
    		}
    		//return current_user_can_for_blog( $blog_id, 'edit_post', $remote_post->ID );
    		return current_user_can_for_blog( $blog_id, 'edit_' . $post_type . 's', $remote_post->ID );
    	}

    Original lines are commented.
    That way it works perfectly. It corrects the capability “edit_post” to “edit_posts”, and also enables the translation for pages and custom post types.

    It seems you found the culprit. Thanks for that. I will create an issue over at GitHub, and you can expect a fix soon. We will use different capabilities, though. Thanks again.

    GabSoftware didn’t work for me, I’m unable to translate custom posts and custom taxonomies.

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘translation meta box not showing’ is closed to new replies.