0

I have third party authors and they cannot publish posts - they have to submit them for review and I then review & publish them.

The posts are tied together & associated with each other, in a course>lesson>topic manner. In the backend, theres an 'associated content' meta box which shows the related posts in that course>lesson>topic structure.

Because the posts aren't fully published, they are not appearing in the 'associated content' meta box. This makes it impossible for the author to see the structure of their course.

Is there a way to get this 'associated content' meta box to pick up the unpublished/draft/pending posts?

The code I am dealing with is:

function learndash_course_navigation_admin_box() {
    $post_types = array('sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic'); 
    foreach( $post_types as $post_type ) {
       add_meta_box( 
          'learndash_course_navigation_admin_meta', __( 'Associated Content', 'learndash' ), 
          'learndash_course_navigation_admin_box_content', 
          $post_type, 
          'side', 
          'high' 
       );
    }
}

add_action( 'add_meta_boxes', 'learndash_course_navigation_admin_box' );

Can anyone offer a snippet to add to functions.php to modify the query?

Thanks very much

  • 1
    What is in the learndash_course_navigation_admin_box_content callback function? – Michelle Nov 17 '16 at 18:20
  • Hi, I have added the file that generates most of it. I hope it is helpful gist.github.com/anonymous/66959e4e05abc50dcf67a7b8c6e091bd . Thanks so much for giving this your attention. I really appreciate it. – David James Nov 17 '16 at 23:23
  • Thanks. Is there any other code? I'm looking now for where the learndash_get_course_id function is defined. (Basically I'm looking for a place to change the args for wp_query(). The default for post_status is "publish" (published content) and we need to change that to "any".) – Michelle Nov 18 '16 at 0:07
  • Hi Michelle, rather than dig out the various pieces of code, I have uploaded all of the files here drive.google.com/file/d/0B9icfDVJpvoNRWpPQlB3bk1WeXM/… so you can look through them at your leisure. To me it feels like it becomes a bit of a spiders web of code pointing in different places so I thought this would be better than me passing bits and pieces to you. – David James Nov 18 '16 at 12:17
0

Okay, I think to start you need to change line 470 of the file includes/admin/class-learndash-admin-binary-selector.php from:

'post_status' => array('publish'),

to

'post_status' => array('any'),

If this doesn't work on its own, there may be other places you need to change this as well - do a global file search on 'post_status' and look for places where it's set to 'publish'. There are a lot of post_status calls throughout these files, many already set to 'any', so you'll have to go through and change wherever necessary. If you don't want to use 'any' here's the list of options you can use in post_status.

Once you've made these changes you will likely need to deactivate/reactivate the plugin, and possibly go in to Settings > Permalinks and re-save. Be sure to make a backup of the files before you do all this of course. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.