Opened 8 months ago

Closed 8 months ago

Last modified 6 months ago

#21960 closed defect (bug) (fixed)

Exporter doesn't exclude auto-drafts when calculating the authors list

Reported by: westi Owned by: westi
Priority: normal Milestone: 3.5
Component: Export Version: 3.5
Severity: normal Keywords: has-patch
Cc:

Description

The exported correctly excludes auto-drafts from the file but not when calculating the list of authors on the blog.

This means the export file can have a list of authors which doesn't match those on the blog and can include users that might not be expected when the WordPress install has multisite enabled as auto-drafts can get created for Super Admins on other users blogs.

Attachments (2)

21960.diff (568 bytes) - added by westi 8 months ago.
Simple patch to fix this issue
export.php (2.8 KB) - added by westi 8 months ago.
"Unit Tests" that can't be committed because the function is not testable.

Download all attachments as: .zip

Change History (6)

westi8 months ago

Simple patch to fix this issue

westi8 months ago

"Unit Tests" that can't be committed because the function is not testable.

comment:1 follow-up: ↓ 2   westi8 months ago

I wrote some tests for this (attached) but we can really use them at the moment because these functions are defined inside export_wp and that throws headers already sent errors and phpunit marks the test as having errors.

Ideally we should make these functions more globally available - the export includes are only included when we load export.php anyway.

comment:2 in reply to: ↑ 1   nacin8 months ago

Replying to westi:

I wrote some tests for this (attached) but we can really use them at the moment because these functions are defined inside export_wp and that throws headers already sent errors and phpunit marks the test as having errors.

Ideally we should make these functions more globally available - the export includes are only included when we load export.php anyway.

Yep, they should just be pulled into export.php. Defining functions inside functions is a pretty silly endeavor.

  • Owner set to westi
  • Resolution set to fixed
  • Status changed from new to closed

In [21946]:

Export: Ignore auto-drafts when building the list of users for the export file. Fixes #21960.

Further enhancement to this: #20206 (albeit an older ticket)

Note: See TracTickets for help on using tickets.