• Resolved jjaureguiberry

    (@jjaureguiberry)


    Hello there, this is a great plugin!
    I’m trying to include wordpress publishing workflow to these docs, some users should be able to create but not directly publish a document.
    So far I haven’t found a way to hook up properly with the plugin, so I changed the plugin’s code ( only a little ?? ).
    Taking small steps, the first approch I came up with was these two changes:

    1 Prevent auto-publish:
    file: buddypress-docs/includes/component.php:394

    // Document Approbal Workflow | WIP
    $post_status = 'pending';
    if ( current_user_can( 'publish_posts' ) ) {
    	$post_status = 'publish';
    }
    
    $this_doc = new BP_Docs_Query;
    $result = $this_doc->save( array( 'post_status'  => $post_status ) );
    $redirect_url = ( current_user_can( 'publish_posts' ) ) ? $result['redirect_url'] : trailingslashit( bp_get_root_domain() ) . bp_docs_get_docs_slug();
    if ( !current_user_can( 'publish_posts' ) ) {
    	$result['message'] = __( 'Document has been sent for review', 'bp-docs' );
    }
    bp_core_add_message( $result['message'], $result['type'] );
    bp_core_redirect( trailingslashit( $redirect_url ) );

    2 Notify the user
    file: buddypress-docs/includes/templates/docs/docs-loop.php:7

    <div class="<?php bp_docs_container_class(); ?>">
    	<?php if ( ! did_action( 'template_notices' ) ) : ?>
    		<!-- Workflow for document approbal ADDENDUM -->
    		<?php do_action( 'template_notices' ) ?>
    		<!-- END ADDENDUM -->
    	<?php endif ?>

    ————-

    Ugly, since I’m working directly in the plugin’s code. Has anyone addressed this issue before? Sounds pretty reasonable.
    Thanks for reading.

    buddypress-docs ver. 1.9.4

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Submit for review (roles and capabilities)’ is closed to new replies.