Forum Replies Created

Viewing 1 replies (of 1 total)
  • OK, just had this same issue, and fixed it with a bit of PHP, right under the comment

    $user = wp_get_current_user();
    if ( $user->ID ) {
    	$comment_author       = $wpdb->escape($user->display_name);
    	$comment_author_email = $wpdb->escape($user->user_email);
    	$comment_author_url   = $wpdb->escape($user->user_url);
    	if ( current_user_can('unfiltered_html') ) {
    		if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
    			kses_remove_filters(); // start with a clean slate
    			kses_init_filters(); // set up the filters
    		}
    	}
    } else {
    	if ( get_option('comment_registration') )
    		wp_die( __('Sorry, you must be logged in to post a comment.') );
    }

    I changed this to:

    $user = wp_get_current_user();
    if ( $user->ID ) {
    	$comment_author       = $wpdb->escape($user->display_name);
    	$comment_author_email = $wpdb->escape($user->user_email);
    	$comment_author_url   = $wpdb->escape($user->user_url);
    	if ( current_user_can('unfiltered_html') ) {
    		if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
    			kses_remove_filters(); // start with a clean slate
    			kses_init_filters(); // set up the filters
    		}
    	}
    } else {
    <strong>	echo("Oops, looks like you didn't <a href=\"http://www.YOURDOMAINNAME.com/wp-login.php\">register (or sign in)</a>!");</strong>
    
    	if ( get_option('comment_registration') )
    		wp_die( __('Sorry, you must be logged in to post a comment.') );
    }

    This assumes wp is under the main directory, if you need to put a sub directory, change the url http://www.YOURDOMAINNAME.com/wp-login.php to http://www.YOURDOMAINNAME.com/YOUR_SUB-DIRECTORY/wp-login.php

    This might cause some other unforseen issue, but so far I haven’t come across one (please let me know if you do!)

Viewing 1 replies (of 1 total)