Forums

[resolved] [Plugin: Jetpack] "Share by Email" button loads blank screen w/ pretty permalink (3 posts)

  1. dlineate
    Member
    Posted 6 months ago #

    Problem
    When I click jetpack's "Share by Email" button and complete popout form, the browser momentarily loads the whole page in the popup then displays a whole page.

    Background

    • Brand new vanilla WP setup in /wordpress/ subdir on nginx
    • Only Jetpack 1.2.1 and Akismet 2.5.3 installed.
    • Problem occurs with and without the nginx compatibility plugin.
    • I enable pretty permalinks (tried all types with and without 'index.php' incorporated)
    • I've added the facebook and email contacts buttons in the "sharing" menu.
    • With every variation I've restarted nginx and php5-fpm and then tried on a newly created test page

    Detailed Problem
    In both firefox 3.6.17 and Chrome 7.0.529.0:
    I go to first comment or sample page or a new post.
    Click the email link, the submit box pops up, I complete to,from,name fields. When I submit, the parent page can briefly be seen loading inside the popup box. The whole page then goes blank except for the little smiley icon in top left corner. The email is not sent.

    Initial Trouble Shooting
    The problem goes away when I disable "pretty" permalinks completely.

    I've compared the HTTP requests and responses using Firefox's Tamper plugin.
    The only difference I see in responses is that the broken response has the following header:
    Link[<http://wp.me/P20UAc-2>; rel=shortlink]

    So thinking that might be the problem, I deactivated WP.me short links.
    The problem persits, but now the previously mentioned header looks like:
    Link[<http://test.helpyourcell.com/wordpress/?p=14>; rel=shortlink]

    I'm wondering if this Link response header is acting as a redirect?
    I didn't think it was supposed to, but I'm now going to try disabling the link header to see if that's the culprit.

    Any insight or help would be appreciated

    The site is test.helpyourcell.com/wordpress/ but I am in the process of testing so it may or may not be configured to manifest the problem.

  2. dlineate
    Member
    Posted 6 months ago #

    I'm working my way through this slowly.
    In jetpack/modules/sharedaddy/sharing-service.php: line 400

    function sharing_process_requests() {
            global $post;
    
            // Only process if: single post and share=X defined
            if ( ( is_page() || is_single() ) && isset( $_GET['share'] ) ) {
                    $sharer = new Sharing_Service();
    
                    $service = $sharer->get_service( $_GET['share'] );
                    if ( $service ) {
                            $service->process_request( $post, $_POST );
                    }
            }
    }

    $_GET['share'] is not set so the form is never processed.

    Now, where is that supposed to be set? Nginx or somewhere in php?

  3. dlineate
    Member
    Posted 6 months ago #

    Solved.
    This was an nginx config problem which should actually quite common because of bad example setups posted everywhere. From the nginx wiki

    location / {
    # This is cool because no php is touched for static content
        try_files $uri $uri/ /index.php;
    }

    However, using /index.php as the fallback causes the arguments not to be passed forward as stated here.
    Therefore any functionality involving pretty URL requests and arguments will break!

    The solution is either:

    location / {
        try_files $uri $uri/ /index.php?q=$request_uri&$args;
    }

    Or my preference because it avoids rematching all the locations and allows a pretty url specific treatment of the request:

    location / {
        try_files $uri $uri/ @pretty_wordpress;
    }
    location @pretty_wordpress {
      # Exclusive block for processing pretty wordpress URLs
      # Another location is needed to handle actual *.php requests!
      fastcgi_pass   upstream_wordpress;
      include fastcgi_params;
      fastcgi_param  SCRIPT_FILENAME  /opt/wordpress/index.php;
      fastcgi_param  SCRIPT_NAME      /wordpress/index.php;
      ...
    }

Reply

You must log in to post.

About this Topic