Support » Plugin: More Privacy Options » RSS authentication problem

  • We’re experiencing a problem accessing the RSS feed when the plugin is enabled and the sites visibility is set to visible only for registered users or the administrator.
    When accessing the feed (http://example.com/feed/) through a browser you’re prompted to insert the username and password twice.

    This is a problem when trying to access the feed from curl or with file_get_contents() in PHP.

    I’ve been able to replicate the problem on a clean WordPress installation and below are som header output from curl:

    Without the plugin enabled:

    $ curl -I http://wordpress.domain.dev/feed/
    HTTP/1.1 200 OK
    Date: Mon, 22 Aug 2016 08:24:02 GMT
    Server: Apache/2.4.18 (Ubuntu)
    X-Pingback: http://wordpress.domain.dev/xmlrpc.php
    Last-Modified: Mon, 28 Sep 2015 17:04:09 GMT
    ETag: "7e7f82da70bcfd2f08ba739248106f1d"
    Content-Type: text/html; charset=UTF-8

    With the plugin enabled and visibility set to registered users or the administrator:

    $ curl -u "admin:password" -I http://wordpress.domain.dev/feed/
    HTTP/1.0 401 Unauthorized
    Date: Mon, 22 Aug 2016 08:24:12 GMT
    Server: Apache/2.4.18 (Ubuntu)
    X-Pingback: http://wordpress.domain.dev/xmlrpc.php
    Last-Modified: Mon, 28 Sep 2015 17:04:09 GMT
    ETag: "7e7f82da70bcfd2f08ba739248106f1d"
    Set-Cookie: wordpress_41193cf728d4d7b51d01f6c22f880058=admin%7C1473063853%7ConSnJR8ce7ICpqzCyJKy5BZQYyLazVA5DDguZDwjgaS%7Cf4a0623ef9593e7b3554e77a68787dcc21473eff9eea4bfcaeb6590cfee85889; expires=Mon, 05-Sep-2016 20:24:13 GMT; Max-Age=1252800; path=/wp-content/plugins; HttpOnly
    Set-Cookie: wordpress_41193cf728d4d7b51d01f6c22f880058=admin%7C1473063853%7ConSnJR8ce7ICpqzCyJKy5BZQYyLazVA5DDguZDwjgaS%7Cf4a0623ef9593e7b3554e77a68787dcc21473eff9eea4bfcaeb6590cfee85889; expires=Mon, 05-Sep-2016 20:24:13 GMT; Max-Age=1252800; path=/; HttpOnly
    Set-Cookie: wordpress_logged_in_41193cf728d4d7b51d01f6c22f880058=admin%7C1473063853%7ConSnJR8ce7ICpqzCyJKy5BZQYyLazVA5DDguZDwjgaS%7C30852dc698dfdfa76729a3b9f0f90a2ac271c19bb09104fcef42d298b6c8921e; expires=Mon, 05-Sep-2016 20:24:13 GMT; Max-Age=1252800; path=/; HttpOnly
    WWW-Authenticate: Basic realm="wordpress.domain.dev"
    Connection: close
    Content-Type: text/html; charset=UTF-8

    https://wordpress.org/plugins/more-privacy-options/

Viewing 1 replies (of 1 total)
  • The reason for the problem is that get_user_id_from_string has been deprecated.

    Below is a fix that solves this problem.

    352c352
    < $user_id = is_wp_error( $user ) ? get_user_id_from_string( $user->user_login ) : null;
    ---
    > $user_id = $user->ID;

    The if/else statement is unnecessary since it’s executed again on the next line of the code.

    $user_id = $user->ID;
    
    if ( is_wp_error( $user ) ||

Viewing 1 replies (of 1 total)
  • The topic ‘RSS authentication problem’ is closed to new replies.