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

Pass the permalink through the sharing_permalink filter #6353

Closed
wants to merge 1 commit into from

Conversation

briancolinger
Copy link
Contributor

Fixes issue #5989.

Changes proposed in this Pull Request:

  • Pass the permalink through the sharing_permalink filter.

Testing instructions:

  • Add a filter to 'sharing_permalink' similar to this:
    function test_sharing_permalink( $url ) {
    return add_query_arg( 'key', 'test', $url );
    }
    add_filter( 'sharing_permalink', 'test_sharing_permalink', 10, 2 );

  • Load up wp shell

  • Execute the sharing_email_send_post_content() function similar to this:
    return sharing_email_send_post_content( array( 'name' => 'Brian', 'source' => 'brian@automattic.com', 'post' => (object) array( 'ID' => 1178, 'post_title' => 'Markup: HTML Tags and Formatting' ) ) );

  • You should see ?key=test appended to the end of the permalink.

Proposed changelog entry for your changes:

Fixes issue #5989.
Pass the permalink through the sharing_permalink filter.
@@ -68,7 +68,7 @@ function sharing_email_send_post_content( $data ) {
$content = sprintf( __( '%1$s (%2$s) thinks you may be interested in the following post:', 'jetpack' ), $data['name'], $data['source'] );
$content .= "\n\n";
$content .= $data['post']->post_title."\n";
$content .= get_permalink( $data['post']->ID )."\n";
$content .= apply_filters( 'sharing_permalink', get_permalink( $data['post']->ID ) ) . "\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good-- I would change the filter name to jetpack_sharing_permalink, though. Namespacing FTW!

@samhotchkiss samhotchkiss added the [Status] Needs Review This PR is ready for review. label Feb 10, 2017
@samhotchkiss
Copy link
Contributor

Once the change is complete, feel free to mark as "Ready to Merge"

@samhotchkiss samhotchkiss added [Feature] Sharing Post sharing, sharing buttons [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it labels Feb 10, 2017
@singerb
Copy link
Contributor

singerb commented Feb 10, 2017

There's already a PR for this just awaiting a second review.

@jeherve
Copy link
Member

jeherve commented Feb 10, 2017

Closing this on favor of #6342

@jeherve jeherve closed this Feb 10, 2017
@jeherve jeherve deleted the fix/filter-sharing-email-permalink branch February 10, 2017 12:18
@jeherve jeherve removed the [Status] Needs Review This PR is ready for review. label Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Sharing Post sharing, sharing buttons [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants