• After loging out from commenting field, the plugin gives a bad redirect like:
    http://example.com/rcwd-ngg/gallery-name/

    and the page is not found of course.

    I found that ‘rcwd-ngg’ is used in comments.php and nextgen-gallery-comments.php. Even i you would get rid of that part in the url, it’s not redirected correctly, because it also leaves out the post or album part in the url.

    I tested already that it’s not Nextgen Gallery’s issue.

    Using the latest WP 3.2.1, NGG 1.8.3 and NGG comments 0.1.4.

    http://wordpress.org/extend/plugins/nextgen-gallery-comments/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author roberto.c

    (@robertoc)

    Ok thematrixit, i will try to fix it.

    Plugin Author roberto.c

    (@robertoc)

    Mmmm ok i figured out.
    Check the \wp-includes\comment-template.php, on row 1536 you will find this:

    'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>'

    So, for the gallery comments logout, get_permalink( $post_id ) is not good! But is better to not change it inside core file, so i will use a filter:

    add_filter('comment_form_defaults','rcwd_comment_form_defaults');
    
    function rcwd_comment_form_defaults($defaults){
       global $user_identity;
       $defaults['logged_in_as'] = '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', esc_attr($_SERVER["REQUEST_URI"]) ) ) ) . '</p>';
    }

    So i used esc_attr($_SERVER[“REQUEST_URI”]) to retreive the current url.

    Remember that this will be a change for all comments in website.

    Consider it a temporary fix, i hope to find a better way to include in my plugin.

    Thread Starter thematrixit

    (@thematrixit)

    Added it after the 352nd row in comments.php (version 0.1.5), also tried the one from readme file, but still not working.

    Plugin Author roberto.c

    (@robertoc)

    Sorry thematrixit, i forgot to mention to insert that filter and function inside file functions.php of your theme and also a forgot a line inside that function.

    add_filter('comment_form_defaults','rcwd_comment_form_defaults');
    
    function rcwd_comment_form_defaults($defaults){
       global $user_identity;
       $defaults['logged_in_as'] = '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', esc_attr($_SERVER["REQUEST_URI"]) ) ) ) . '</p>';
       return $defaults;
    }
    Thread Starter thematrixit

    (@thematrixit)

    Big thanks, works now.

    Thread Starter thematrixit

    (@thematrixit)

    Found that the same thing happens when sharing comments on Facebook with Simple Facebook Connect – the post url is not correct, there is this same kind of url with the same “rcwd-ngg” string.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: NextGEN Gallery Comments] Bad redirect after logout’ is closed to new replies.