Version Description
(May 16, 2016) = * Hotfix for broken Guest Author bio metabox (props JS Morisset)
Download this release
Release Info
Developer | philipjohn |
Plugin | Co-Authors Plus |
Version | 3.2.1 |
Comparing to | |
See all releases |
Code changes from version 3.2 to 3.2.1
- .travis.yml +0 -14
- bin/install-wp-tests.sh +0 -112
- co-authors-plus.php +2 -2
- php/class-coauthors-guest-authors.php +1 -1
- phpunit.xml +0 -17
- readme.txt +6 -5
- tests/bootstrap.php +0 -17
- tests/coauthorsplus-testcase.php +0 -67
- tests/test-author-queries.php +0 -88
- tests/test-manage-coauthors.php +0 -97
.travis.yml
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
language: php
|
2 |
-
|
3 |
-
php:
|
4 |
-
- 5.3
|
5 |
-
- 5.5
|
6 |
-
|
7 |
-
env:
|
8 |
-
- WP_VERSION=latest
|
9 |
-
- WP_VERSION=3.7
|
10 |
-
|
11 |
-
before_script:
|
12 |
-
- bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION
|
13 |
-
|
14 |
-
script: phpunit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bin/install-wp-tests.sh
DELETED
@@ -1,112 +0,0 @@
|
|
1 |
-
#!/usr/bin/env bash
|
2 |
-
|
3 |
-
if [ $# -lt 3 ]; then
|
4 |
-
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version]"
|
5 |
-
exit 1
|
6 |
-
fi
|
7 |
-
|
8 |
-
DB_NAME=$1
|
9 |
-
DB_USER=$2
|
10 |
-
DB_PASS=$3
|
11 |
-
DB_HOST=${4-localhost}
|
12 |
-
WP_VERSION=${5-latest}
|
13 |
-
|
14 |
-
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib}
|
15 |
-
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/}
|
16 |
-
|
17 |
-
download() {
|
18 |
-
if [ `which curl` ]; then
|
19 |
-
curl -s "$1" > "$2";
|
20 |
-
elif [ `which wget` ]; then
|
21 |
-
wget -nv -O "$2" "$1"
|
22 |
-
fi
|
23 |
-
}
|
24 |
-
|
25 |
-
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then
|
26 |
-
WP_TESTS_TAG="tags/$WP_VERSION"
|
27 |
-
else
|
28 |
-
# http serves a single offer, whereas https serves multiple. we only want one
|
29 |
-
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json
|
30 |
-
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json
|
31 |
-
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//')
|
32 |
-
if [[ -z "$LATEST_VERSION" ]]; then
|
33 |
-
echo "Latest WordPress version could not be found"
|
34 |
-
exit 1
|
35 |
-
fi
|
36 |
-
WP_TESTS_TAG="tags/$LATEST_VERSION"
|
37 |
-
fi
|
38 |
-
|
39 |
-
set -ex
|
40 |
-
|
41 |
-
install_wp() {
|
42 |
-
|
43 |
-
if [ -d $WP_CORE_DIR ]; then
|
44 |
-
return;
|
45 |
-
fi
|
46 |
-
|
47 |
-
mkdir -p $WP_CORE_DIR
|
48 |
-
|
49 |
-
if [ $WP_VERSION == 'latest' ]; then
|
50 |
-
local ARCHIVE_NAME='latest'
|
51 |
-
else
|
52 |
-
local ARCHIVE_NAME="wordpress-$WP_VERSION"
|
53 |
-
fi
|
54 |
-
|
55 |
-
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz
|
56 |
-
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR
|
57 |
-
|
58 |
-
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php
|
59 |
-
}
|
60 |
-
|
61 |
-
install_test_suite() {
|
62 |
-
# portable in-place argument for both GNU sed and Mac OSX sed
|
63 |
-
if [[ $(uname -s) == 'Darwin' ]]; then
|
64 |
-
local ioption='-i .bak'
|
65 |
-
else
|
66 |
-
local ioption='-i'
|
67 |
-
fi
|
68 |
-
|
69 |
-
# set up testing suite if it doesn't yet exist
|
70 |
-
if [ ! -d $WP_TESTS_DIR ]; then
|
71 |
-
# set up testing suite
|
72 |
-
mkdir -p $WP_TESTS_DIR
|
73 |
-
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes
|
74 |
-
fi
|
75 |
-
|
76 |
-
cd $WP_TESTS_DIR
|
77 |
-
|
78 |
-
if [ ! -f wp-tests-config.php ]; then
|
79 |
-
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php
|
80 |
-
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php
|
81 |
-
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php
|
82 |
-
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php
|
83 |
-
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php
|
84 |
-
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php
|
85 |
-
fi
|
86 |
-
|
87 |
-
}
|
88 |
-
|
89 |
-
install_db() {
|
90 |
-
# parse DB_HOST for port or socket references
|
91 |
-
local PARTS=(${DB_HOST//\:/ })
|
92 |
-
local DB_HOSTNAME=${PARTS[0]};
|
93 |
-
local DB_SOCK_OR_PORT=${PARTS[1]};
|
94 |
-
local EXTRA=""
|
95 |
-
|
96 |
-
if ! [ -z $DB_HOSTNAME ] ; then
|
97 |
-
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then
|
98 |
-
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp"
|
99 |
-
elif ! [ -z $DB_SOCK_OR_PORT ] ; then
|
100 |
-
EXTRA=" --socket=$DB_SOCK_OR_PORT"
|
101 |
-
elif ! [ -z $DB_HOSTNAME ] ; then
|
102 |
-
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp"
|
103 |
-
fi
|
104 |
-
fi
|
105 |
-
|
106 |
-
# create database
|
107 |
-
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
|
108 |
-
}
|
109 |
-
|
110 |
-
install_wp
|
111 |
-
install_test_suite
|
112 |
-
install_db
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
co-authors-plus.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Co-Authors Plus
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/co-authors-plus/
|
5 |
Description: Allows multiple authors to be assigned to a post. This plugin is an extended version of the Co-Authors plugin developed by Weston Ruter.
|
6 |
-
Version: 3.2
|
7 |
Author: Mohammad Jangda, Daniel Bachhuber, Automattic
|
8 |
Copyright: 2008-2015 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
|
9 |
|
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
24 |
|
25 |
*/
|
26 |
|
27 |
-
define( 'COAUTHORS_PLUS_VERSION', '3.1
|
28 |
|
29 |
require_once( dirname( __FILE__ ) . '/template-tags.php' );
|
30 |
require_once( dirname( __FILE__ ) . '/deprecated.php' );
|
3 |
Plugin Name: Co-Authors Plus
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/co-authors-plus/
|
5 |
Description: Allows multiple authors to be assigned to a post. This plugin is an extended version of the Co-Authors plugin developed by Weston Ruter.
|
6 |
+
Version: 3.2.1
|
7 |
Author: Mohammad Jangda, Daniel Bachhuber, Automattic
|
8 |
Copyright: 2008-2015 Shared and distributed between Mohammad Jangda, Daniel Bachhuber, Weston Ruter
|
9 |
|
24 |
|
25 |
*/
|
26 |
|
27 |
+
define( 'COAUTHORS_PLUS_VERSION', '3.2.1' );
|
28 |
|
29 |
require_once( dirname( __FILE__ ) . '/template-tags.php' );
|
30 |
require_once( dirname( __FILE__ ) . '/deprecated.php' );
|
php/class-coauthors-guest-authors.php
CHANGED
@@ -676,7 +676,7 @@ class CoAuthors_Guest_Authors
|
|
676 |
$pm_key = $this->get_post_meta_key( $field['key'] );
|
677 |
$value = get_post_meta( $post->ID, $pm_key, true );
|
678 |
echo '<tr><th>';
|
679 |
-
echo '<label for="' . esc_attr( $pm_key . '">'
|
680 |
echo '</th><td>';
|
681 |
echo '<textarea style="width:300px;margin-bottom:6px;" name="' . esc_attr( $pm_key ) . '">' . esc_textarea( $value ) . '</textarea>';
|
682 |
echo '</td></tr>';
|
676 |
$pm_key = $this->get_post_meta_key( $field['key'] );
|
677 |
$value = get_post_meta( $post->ID, $pm_key, true );
|
678 |
echo '<tr><th>';
|
679 |
+
echo '<label for="' . esc_attr( $pm_key ) . '">' . esc_html( $field['label'] ) . '</label>';
|
680 |
echo '</th><td>';
|
681 |
echo '<textarea style="width:300px;margin-bottom:6px;" name="' . esc_attr( $pm_key ) . '">' . esc_textarea( $value ) . '</textarea>';
|
682 |
echo '</td></tr>';
|
phpunit.xml
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<phpunit
|
2 |
-
bootstrap="tests/bootstrap.php"
|
3 |
-
backupGlobals="false"
|
4 |
-
colors="true"
|
5 |
-
convertErrorsToExceptions="true"
|
6 |
-
convertNoticesToExceptions="true"
|
7 |
-
convertWarningsToExceptions="true"
|
8 |
-
>
|
9 |
-
<php>
|
10 |
-
<const name="WP_TESTS_MULTISITE" value="1" />
|
11 |
-
</php>
|
12 |
-
<testsuites>
|
13 |
-
<testsuite>
|
14 |
-
<directory prefix="test-" suffix=".php">./tests/</directory>
|
15 |
-
</testsuite>
|
16 |
-
</testsuites>
|
17 |
-
</phpunit>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== Co-Authors Plus ===
|
2 |
Contributors: batmoo, danielbachhuber, automattic
|
3 |
Tags: authors, users, multiple authors, coauthors, multi-author, publishing
|
4 |
-
Tested up to: 4.
|
5 |
Requires at least: 4.1
|
6 |
-
Stable tag: 3.2
|
7 |
|
8 |
Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
|
9 |
|
@@ -57,14 +57,15 @@ Bug fixes and minor enhancements
|
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
-
= 3.2 =
|
|
|
|
|
|
|
61 |
Various minor bug and security fixes
|
62 |
|
63 |
= 3.1.2 (Aug. 31, 2015) =
|
64 |
* Minor bug fixes and coding standards changes.
|
65 |
* The author's display name is now filtered through the_author in coauthors_posts_links_single()
|
66 |
-
|
67 |
-
= ??? (??? ?? ????) =
|
68 |
* New Russian and Ukrainian translations, courtesy of [Jurko Chervony](http://skinik.name/).
|
69 |
|
70 |
= 3.1.1 (Mar. 20, 2014) =
|
1 |
=== Co-Authors Plus ===
|
2 |
Contributors: batmoo, danielbachhuber, automattic
|
3 |
Tags: authors, users, multiple authors, coauthors, multi-author, publishing
|
4 |
+
Tested up to: 4.7
|
5 |
Requires at least: 4.1
|
6 |
+
Stable tag: 3.2.1
|
7 |
|
8 |
Assign multiple bylines to posts, pages, and custom post types via a search-as-you-type input box
|
9 |
|
57 |
|
58 |
== Changelog ==
|
59 |
|
60 |
+
= 3.2.1 (May 16, 2016) =
|
61 |
+
* Hotfix for broken Guest Author bio metabox (props JS Morisset)
|
62 |
+
|
63 |
+
= 3.2 (May 12, 2016) =
|
64 |
Various minor bug and security fixes
|
65 |
|
66 |
= 3.1.2 (Aug. 31, 2015) =
|
67 |
* Minor bug fixes and coding standards changes.
|
68 |
* The author's display name is now filtered through the_author in coauthors_posts_links_single()
|
|
|
|
|
69 |
* New Russian and Ukrainian translations, courtesy of [Jurko Chervony](http://skinik.name/).
|
70 |
|
71 |
= 3.1.1 (Mar. 20, 2014) =
|
tests/bootstrap.php
DELETED
@@ -1,17 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$_tests_dir = getenv( 'WP_TESTS_DIR' );
|
4 |
-
if ( ! $_tests_dir ) {
|
5 |
-
$_tests_dir = '/tmp/wordpress-tests-lib';
|
6 |
-
}
|
7 |
-
|
8 |
-
require_once $_tests_dir . '/includes/functions.php';
|
9 |
-
|
10 |
-
function _manually_load_plugin() {
|
11 |
-
require dirname( __FILE__ ) . '/../co-authors-plus.php';
|
12 |
-
}
|
13 |
-
tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );
|
14 |
-
|
15 |
-
require $_tests_dir . '/includes/bootstrap.php';
|
16 |
-
|
17 |
-
require dirname( __FILE__ ) . '/coauthorsplus-testcase.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tests/coauthorsplus-testcase.php
DELETED
@@ -1,67 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Base unit test class for Co-Authors Plus
|
5 |
-
*/
|
6 |
-
|
7 |
-
class CoAuthorsPlus_TestCase extends WP_UnitTestCase {
|
8 |
-
|
9 |
-
protected $suppress = false;
|
10 |
-
|
11 |
-
public function setUp() {
|
12 |
-
global $wpdb;
|
13 |
-
parent::setUp();
|
14 |
-
$this->suppress = $wpdb->suppress_errors();
|
15 |
-
|
16 |
-
$_SERVER['REMOTE_ADDR'] = '';
|
17 |
-
|
18 |
-
$this->author1 = $this->factory->user->create( array( 'role' => 'author', 'user_login' => 'author1' ) );
|
19 |
-
$this->editor1 = $this->factory->user->create( array( 'role' => 'editor', 'user_login' => 'editor2' ) );
|
20 |
-
|
21 |
-
$post = array(
|
22 |
-
'post_author' => $this->author1,
|
23 |
-
'post_status' => 'publish',
|
24 |
-
'post_content' => rand_str(),
|
25 |
-
'post_title' => rand_str(),
|
26 |
-
'post_type' => 'post',
|
27 |
-
);
|
28 |
-
|
29 |
-
$this->author1_post1 = wp_insert_post( $post );
|
30 |
-
|
31 |
-
$post = array(
|
32 |
-
'post_author' => $this->author1,
|
33 |
-
'post_status' => 'publish',
|
34 |
-
'post_content' => rand_str(),
|
35 |
-
'post_title' => rand_str(),
|
36 |
-
'post_type' => 'post',
|
37 |
-
);
|
38 |
-
|
39 |
-
$this->author1_post2 = wp_insert_post( $post );
|
40 |
-
|
41 |
-
$page = array(
|
42 |
-
'post_author' => $this->author1,
|
43 |
-
'post_status' => 'publish',
|
44 |
-
'post_content' => rand_str(),
|
45 |
-
'post_title' => rand_str(),
|
46 |
-
'post_type' => 'page',
|
47 |
-
);
|
48 |
-
|
49 |
-
$this->author1_page1 = wp_insert_post( $page );
|
50 |
-
|
51 |
-
$page = array(
|
52 |
-
'post_author' => $this->author1,
|
53 |
-
'post_status' => 'publish',
|
54 |
-
'post_content' => rand_str(),
|
55 |
-
'post_title' => rand_str(),
|
56 |
-
'post_type' => 'page',
|
57 |
-
);
|
58 |
-
|
59 |
-
$this->author1_page2 = wp_insert_post( $page );
|
60 |
-
}
|
61 |
-
|
62 |
-
public function tearDown() {
|
63 |
-
global $wpdb;
|
64 |
-
parent::tearDown();
|
65 |
-
$wpdb->suppress_errors( $this->suppress );
|
66 |
-
}
|
67 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tests/test-author-queries.php
DELETED
@@ -1,88 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Test Co-Authors Plus' modifications of author queries
|
4 |
-
*/
|
5 |
-
|
6 |
-
class Test_Author_Queries extends CoAuthorsPlus_TestCase {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* On author pages, the queried object should only be set
|
10 |
-
* to a user that's not a member of the blog if they
|
11 |
-
* have at least one published post. This matches core behavior.
|
12 |
-
*
|
13 |
-
* @see https://core.trac.wordpress.org/changeset/27290
|
14 |
-
*/
|
15 |
-
function test_author_queried_object_fix() {
|
16 |
-
global $wp_rewrite, $coauthors_plus;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Set up
|
20 |
-
*/
|
21 |
-
$author1 = $this->factory->user->create( array( 'user_login' => 'msauthor1' ) );
|
22 |
-
$author2 = $this->factory->user->create( array( 'user_login' => 'msauthor2' ) );
|
23 |
-
$blog2 = $this->factory->blog->create( array( 'user_id' => $author1 ) );
|
24 |
-
|
25 |
-
switch_to_blog( $blog2 );
|
26 |
-
$wp_rewrite->init();
|
27 |
-
|
28 |
-
$blog2_post1 = $this->factory->post->create( array(
|
29 |
-
'post_status' => 'publish',
|
30 |
-
'post_content' => rand_str(),
|
31 |
-
'post_title' => rand_str(),
|
32 |
-
'post_author' => $author1,
|
33 |
-
) );
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Author 1 is an author on the blog
|
37 |
-
*/
|
38 |
-
$this->go_to( get_author_posts_url( $author1 ) );
|
39 |
-
$this->assertQueryTrue( 'is_author', 'is_archive' );
|
40 |
-
|
41 |
-
/**
|
42 |
-
* Author 2 is not yet an author on the blog
|
43 |
-
*/
|
44 |
-
$this->go_to( get_author_posts_url( $author2 ) );
|
45 |
-
$this->assertQueryTrue( 'is_404' );
|
46 |
-
|
47 |
-
// Add the user to the blog
|
48 |
-
add_user_to_blog( $blog2, $author2, 'author' );
|
49 |
-
|
50 |
-
/**
|
51 |
-
* Author 2 is now on the blog, but not yet published
|
52 |
-
*/
|
53 |
-
$this->go_to( get_author_posts_url( $author2 ) );
|
54 |
-
$this->assertQueryTrue( 'is_author', 'is_archive' );
|
55 |
-
|
56 |
-
// Add the user as an author on the original post
|
57 |
-
$author2_obj = get_user_by( 'id', $author2 );
|
58 |
-
$coauthors_plus->add_coauthors( $blog2_post1, array( $author2_obj->user_login ), true );
|
59 |
-
|
60 |
-
/**
|
61 |
-
* Author 2 is now on the blog, and published
|
62 |
-
*/
|
63 |
-
$this->go_to( get_author_posts_url( $author2 ) );
|
64 |
-
$this->assertQueryTrue( 'is_author', 'is_archive' );
|
65 |
-
|
66 |
-
// Remove the user from the blog
|
67 |
-
remove_user_from_blog( $author2, $blog2 );
|
68 |
-
|
69 |
-
/**
|
70 |
-
* Author 2 was removed from the blog, but still a published author
|
71 |
-
*/
|
72 |
-
$this->go_to( get_author_posts_url( $author2 ) );
|
73 |
-
$this->assertQueryTrue( 'is_author', 'is_archive' );
|
74 |
-
|
75 |
-
// Delete the user from the network
|
76 |
-
wpmu_delete_user( $author2 );
|
77 |
-
|
78 |
-
/**
|
79 |
-
* Author 2 is no more
|
80 |
-
*/
|
81 |
-
$this->go_to( get_author_posts_url( $author2 ) );
|
82 |
-
$this->assertQueryTrue( 'is_404' );
|
83 |
-
$this->assertEquals( false, get_user_by( 'id', $author2 ) );
|
84 |
-
|
85 |
-
restore_current_blog();
|
86 |
-
|
87 |
-
}
|
88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tests/test-manage-coauthors.php
DELETED
@@ -1,97 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class Test_Manage_CoAuthors extends CoAuthorsPlus_TestCase {
|
4 |
-
|
5 |
-
/**
|
6 |
-
* Test assigning a Co-Author to a post
|
7 |
-
*/
|
8 |
-
public function test_add_coauthor_to_post() {
|
9 |
-
global $coauthors_plus;
|
10 |
-
|
11 |
-
$coauthors = get_coauthors( $this->author1_post1 );
|
12 |
-
$this->assertEquals( 1, count( $coauthors ) );
|
13 |
-
|
14 |
-
// append = true, should preserve order
|
15 |
-
$editor1 = get_user_by( 'id', $this->editor1 );
|
16 |
-
$coauthors_plus->add_coauthors( $this->author1_post1, array( $editor1->user_login ), true );
|
17 |
-
$coauthors = get_coauthors( $this->author1_post1 );
|
18 |
-
$this->assertEquals( array( $this->author1, $this->editor1 ), wp_list_pluck( $coauthors, 'ID' ) );
|
19 |
-
|
20 |
-
// append = false, overrides existing authors
|
21 |
-
$coauthors_plus->add_coauthors( $this->author1_post1, array( $editor1->user_login ), false );
|
22 |
-
$coauthors = get_coauthors( $this->author1_post1 );
|
23 |
-
$this->assertEquals( array( $this->editor1 ), wp_list_pluck( $coauthors, 'ID' ) );
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
/**
|
28 |
-
* When a co-author is assigned to a post, the post author value
|
29 |
-
* should be set appropriately
|
30 |
-
*
|
31 |
-
* @see https://github.com/Automattic/Co-Authors-Plus/issues/140
|
32 |
-
*/
|
33 |
-
public function test_add_coauthor_updates_post_author() {
|
34 |
-
global $coauthors_plus;
|
35 |
-
|
36 |
-
// append = true, preserves existing post_author
|
37 |
-
$editor1 = get_user_by( 'id', $this->editor1 );
|
38 |
-
$coauthors_plus->add_coauthors( $this->author1_post1, array( $editor1->user_login ), true );
|
39 |
-
$this->assertEquals( $this->author1, get_post( $this->author1_post1 )->post_author );
|
40 |
-
|
41 |
-
// append = false, overrides existing post_author
|
42 |
-
$coauthors_plus->add_coauthors( $this->author1_post1, array( $editor1->user_login ), false );
|
43 |
-
$this->assertEquals( $this->editor1, get_post( $this->author1_post1 )->post_author );
|
44 |
-
|
45 |
-
}
|
46 |
-
|
47 |
-
/**
|
48 |
-
* Post published count should default to 'post', but be filterable
|
49 |
-
*
|
50 |
-
* @see https://github.com/Automattic/Co-Authors-Plus/issues/170
|
51 |
-
*/
|
52 |
-
public function test_post_publish_count_for_coauthor() {
|
53 |
-
global $coauthors_plus;
|
54 |
-
|
55 |
-
$editor1 = get_user_by( 'id', $this->editor1 );
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Two published posts
|
59 |
-
*/
|
60 |
-
$coauthors_plus->add_coauthors( $this->author1_post1, array( $editor1->user_login ) );
|
61 |
-
$coauthors_plus->add_coauthors( $this->author1_post2, array( $editor1->user_login ) );
|
62 |
-
$this->assertEquals( 2, count_user_posts( $editor1->ID ) );
|
63 |
-
|
64 |
-
/**
|
65 |
-
* One published page too, but no filter
|
66 |
-
*/
|
67 |
-
$coauthors_plus->add_coauthors( $this->author1_page1, array( $editor1->user_login ) );
|
68 |
-
$this->assertEquals( 2, count_user_posts( $editor1->ID ) );
|
69 |
-
|
70 |
-
// Publish count to include posts and pages
|
71 |
-
$filter = function() {
|
72 |
-
return array( 'post', 'page' );
|
73 |
-
};
|
74 |
-
add_filter( 'coauthors_count_published_post_types', $filter );
|
75 |
-
|
76 |
-
/**
|
77 |
-
* Two published posts and pages
|
78 |
-
*/
|
79 |
-
$coauthors_plus->add_coauthors( $this->author1_page2, array( $editor1->user_login ) );
|
80 |
-
$this->assertEquals( 4, count_user_posts( $editor1->ID ) );
|
81 |
-
|
82 |
-
// Publish count is just pages
|
83 |
-
remove_filter( 'coauthors_count_published_post_types', $filter );
|
84 |
-
$filter = function() {
|
85 |
-
return array( 'page' );
|
86 |
-
};
|
87 |
-
add_filter( 'coauthors_count_published_post_types', $filter );
|
88 |
-
|
89 |
-
/**
|
90 |
-
* Just one published page now for the editor
|
91 |
-
*/
|
92 |
-
$author1 = get_user_by( 'id', $this->author1 );
|
93 |
-
$coauthors_plus->add_coauthors( $this->author1_page2, array( $author1->user_login ) );
|
94 |
-
$this->assertEquals( 1, count_user_posts( $editor1->ID ) );
|
95 |
-
|
96 |
-
}
|
97 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|