Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Plugin Conflict with Give plugin (previously created 500 server error when viewing site admin) #1725

Merged
merged 2 commits into from Dec 11, 2018

Conversation

Projects
None yet
4 participants
@KZeni
Copy link
Contributor

KZeni commented Dec 11, 2018

Fixes #1720.

@googlebot

This comment has been minimized.

Copy link

googlebot commented Dec 11, 2018

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
@KZeni

This comment has been minimized.

Copy link
Contributor Author

KZeni commented Dec 11, 2018

@googlebot I've signed it!

@googlebot

This comment has been minimized.

Copy link

googlebot commented Dec 11, 2018

CLAs look good, thanks!

@@ -1894,7 +1894,10 @@ public static function print_url_as_title( $post ) {
*
* @return string Title.
*/
public static function filter_the_title_in_post_list_table( $title, $post ) {
public static function filter_the_title_in_post_list_table( $title, $post = '' ) {
if($post == ''){

This comment has been minimized.

Copy link
@ravinderk

ravinderk Dec 11, 2018

@KZeni I found that this function is a callback for the_title hook. In that can we need to update the following thing:

  1. The second parameter for the_title filter in int type, so set default value to 0: https://core.trac.wordpress.org/browser/tags/5.0/src/wp-includes/post-template.php#L158
  2. According to point 1, you can also update $post param value type to int instead of WP_Post in function description comment block.
  3. Use trinary condition $post = empty( $post ) ? get_post() : $post

This comment has been minimized.

Copy link
@westonruter

westonruter Dec 11, 2018

Member

I found we can simply further. Since $post is only used by get_post_type(), and since this function takes null|int|WP_Post as its type, then we just have to provide an empty default value for $post.

@westonruter
Copy link
Member

westonruter left a comment

Thank you very much for the PR and identifying the problem in the first place.

Please try my alternative patch included here. It will also fix the build error reported by Travis: https://travis-ci.org/ampproject/amp-wp/jobs/466619023#L186

public static function filter_the_title_in_post_list_table( $title, $post = '' ) {
if($post == ''){
$post = get_post();
}

This comment has been minimized.

Copy link
@westonruter

westonruter Dec 11, 2018

Member

I suggest the following change instead:

- public static function filter_the_title_in_post_list_table( $title, $post ) {
+ public static function filter_the_title_in_post_list_table( $title, $post = null ) {
@westonruter

This comment has been minimized.

Copy link
Member

westonruter commented Dec 11, 2018

See also #1723.

@westonruter westonruter changed the base branch from develop to 1.0 Dec 11, 2018

@westonruter

This comment has been minimized.

Copy link
Member

westonruter commented Dec 11, 2018

I'm rebasing this PR against the 1.0 branch so we can merge it straight into the release branch.

KZeni and others added some commits Dec 11, 2018

Fix Plugin Conflict with Give plugin (previously created 500 server e…
…rror when viewing site admin)

See additional details here: #1720

@westonruter westonruter force-pushed the KZeni:patch-1 branch from ecb094f to 0982dac Dec 11, 2018

@westonruter

This comment has been minimized.

Copy link
Member

westonruter commented Dec 11, 2018

@KZeni could you please double check that the PR fixes the problem as it stands at the moment?

@westonruter westonruter merged commit a85581f into ampproject:1.0 Dec 11, 2018

2 checks passed

cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@KZeni

This comment has been minimized.

Copy link
Contributor Author

KZeni commented Dec 11, 2018

@westonruter I can confirm that the PR as it stands (

- public static function filter_the_title_in_post_list_table( $title, $post ) {
+ public static function filter_the_title_in_post_list_table( $title, $post = null ) {

) is working on my end with both AMP and Give enabled on the site & viewing the site admin.

@westonruter westonruter referenced this pull request Dec 11, 2018

Merged

Bump 1.0.1 #1726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.