• Resolved Loadzz

    (@loadzz)


    Hello,

    I’ve noticed that only my articles are sent to be published (administrator role) but my writers who’s role are ‘Editor’ don’t get sent.

    In the Apple News tab their articles say ‘Not Published’ and i have to manually publish them.

    Please fix.

    Thanks,

    https://wordpress.org/plugins/publish-to-apple-news/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Bradford Campeau-Laurion

    (@potatomaster)

    This is customizable on your end. The default publish capability is set to manage_options. If you want to change this to another capability, simply use the filter apple_news_publish_capability.

    The same goes for deleting articles. This can be overridden using the filter apple_news_delete_capability.

    If you need to learn more about filters or capabilities, please read:

    https://codex.wordpress.org/Plugin_API/Filter_Reference
    https://codex.wordpress.org/Roles_and_Capabilities

    The relevant code is located in the plugin source here:

    https://github.com/alleyinteractive/apple-news/blob/master/admin/class-admin-apple-post-sync.php

    Thread Starter Loadzz

    (@loadzz)

    So to allow authors and above role articles to be published auto on Apple News do i add this code to my class-admin-apple-post-sync.php?

    add_filter( 'apple_news_publish_capability', function() {
        return 'publish_posts';
    }, 10, 0 );

    or do i change the code like this (below).. ?

    public function do_publish( $id, $post ) {
    		if ( 'publish' != $post->post_status
    			|| ! in_array( $post->post_type, $this->settings->get( 'post_types' ) )
    			|| ! current_user_can( apply_filters( 'apple_news_publish_capability', <strong>'publish_posts'</strong> ) ) ) {
    			return;
    		}
    Plugin Author Bradford Campeau-Laurion

    (@potatomaster)

    You should never edit the plugin source because then you won’t be able to automatically update it in the future.

    Filter hooks should be added to your theme, such as in functions.php like:

    add_filter( 'apple_news_publish_capability', function() {
        return 'publish_posts';
    } );
    Thread Starter Loadzz

    (@loadzz)

    Awesome thanks for the tip @bradford Campeau-Laurion

    Will try out the filter hook you provided and will let you know how i get on 🙂

    vincepettit

    (@vincepettit)

    Can this be added as a standard feature in future versions rather than having to add to Functions?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Others roles don't get published’ is closed to new replies.