Support » Plugin: Jetpack by WordPress.com » Publicize for Admin and Editor only

Viewing 15 replies - 1 through 15 (of 26 total)
  • Plugin Contributor Richard Archambault

    (@richardmtl)

    Happiness Engineer

    What are you trying to do exactly? Are you trying to remove the Publicize options box and still have the Author’s posts be Publicized, or do you not want the Author’s posts to be Publicized at all?

    Hi Richard,

    Thanks for the reply.

    Like you said, we do not want the posts of users with the Author-role to be Publicized.

    Only Admin and Editor’s posts will be publicized.

    Best regards,

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Happiness Engineer

    Hi there,

    Try this code in your theme’s functions.php or in a custom plugin for your site:

    add_filter( 'wpas_submit_post?', 'publicize_only_editor_and_admin_filter', 10, 4);
     
    function publicize_only_editor_and_admin_filter( $submit_post, $post_id, $service_name, $connection_data ) {
      if ( current_user_can ('moderate_comments') ) {
        return true;
      }
      return false
    }

    This code is untested, but should work. Try that and let me know if it works for you!

    Hi Richard,

    Thanks for the code and reply.

    We will start testing today!

    Hi Richard,

    We tried on the site and added the code in a custom plugin.

    When under Author’s New Post Screen, author cannot select which Publicize channel (as it is not displayed) So we thought it worked. After we hit publish the post to post a test article.

    It was publicized to all the Publicized connections we set up in while in Admin role.

    So seems like the code above is not preventing Author’s post from being Publicized.

    Like you said it is untested. Hope you would be able to try it out and see if the same result occurs on your test.

    Thanks

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Happiness Engineer

    Can you try changing “moderate_comments” to “publish_pages” ?

    Will try the new rule today. Thanks.

    Tried a few times, the posts by Author are still being push to Facebook. Really hope we can limit Publicize to work for Admin and Editor’s posts only.

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Happiness Engineer

    Hi!

    Can you let me know what you’ve tried? Have you modified the code at all?

    Hi Richard,

    Sorry for the late reply.

    We have added the modified code you mentioned above from “moderate_comments” to “publish_pages”.

    Here is the code

    // Jetpack Publicize for Admin & Editors only 
    
    add_filter( 'wpas_submit_post?', 'publicize_only_editor_and_admin_filter', 10, 4);
    
    function publicize_only_editor_and_admin_filter( $submit_post, $post_id, $service_name, $connection_data ) {
      if ( current_user_can ('publish_pages') ) {
        return true;
      }
      return false;
    }

    The result is that, user role Author’s post will still be Publicized.

    Did you have the same test result?

    Hope there will be a place for setting only Admin and Editor can use the Publicize function.

    Hi,

    I’ve been fighting with the same problem. The issue doesn’t seem to be what you put in the “wpas_submit_post?” function, more than whether you return False or True, it goes ahead and posts anyway.

    It’s being used, as I can receive debug info through it, but True or False it still posts.

    Even though this line of code is 100% being run, it doesn’t make any difference.

    delete_post_meta( $post_id, $this->PENDING );

    Shouldn’t that stop it being posted?

    Any update from the development team?

    As our authors will use WordPress iOS App to publish their posts so need a way to restrict the Publicize for only Editor and Admin.

    Thanks,

    Plugin Contributor Richard Archambault

    (@richardmtl)

    Happiness Engineer

    Hi all,

    I gave it another shot this afternoon but still can’t get it to work aspexpected. I will tackle it with another developper tomorrow. I’ll keep you posted!

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Publicize for Admin and Editor only’ is closed to new replies.