Plugin Directory

Changeset 11277


Ignore:
Timestamp:
04/18/2007 02:55:30 AM (20 years ago)
Author:
wnorris
Message:
 
Location:
openid/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • openid/trunk/openid-registration.php

    r11274 r11277  
    66Author: Will Norris
    77Author URI: http://willnorris.com/
    8 Version: $Rev: 15 $
     8Version: $Rev: 27 $
    99Licence: Modified BSD, http://www.fsf.org/licensing/licenses/index_html#ModifiedBSD
    1010*/
    1111
    1212define ( 'OPENIDIMAGE', get_option('siteurl') . '/wp-content/plugins/wpopenid/images/openid.gif' );
    13 define ( 'WPOPENID_PLUGIN_VERSION', (int)str_replace( '$Rev ', '', '$Rev: 15 $') );
     13define ( 'WPOPENID_PLUGIN_VERSION', (int)str_replace( '$Rev ', '', '$Rev: 27 $') );
    1414
    1515/* Turn on logging of process via error_log() facility in PHP.
    … …  
    849849                }
    850850
     851
     852                /**
     853                 * Wordpress only displays comments that are awaiting moderation if the
     854                 * name and email address stored in the user's cookies match those on
     855                 * the comment.  This is a problem since if the user logged in with
     856                 * OpenID, they may never have filled out the name and email input
     857                 * fields but there comment _will_ have values resulting in them never
     858                 * seeing their comment. 
     859                 *
     860                 * This filter performs an additional query if the current user is
     861                 * logged in, and grabs any comments awaiting moderation that they
     862                 * posted.
     863                 *
     864                 * @bug-filed http://trac.wordpress.org/ticket/4108/
     865                 */
     866                function comments_awaiting_moderation(&$comments, $post_id) {
     867                        global $wpdb, $user_ID;
     868
     869                        if ($user_ID) {
     870
     871                                $commenter = wp_get_current_commenter();
     872                                extract($commenter);
     873
     874                                $additional = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND " .
     875                                        "user_id = '$user_ID' AND comment_author != '$author_db' AND comment_author_email != '$email_db' AND ".
     876                                        "comment_approved = '0' ORDER BY comment_date");
     877
     878                                if ($additional) {
     879                                        $comments = array_merge($comments, $additional);
     880                                        usort($comments, create_function('$a,$b', 'return strcmp($a->comment_date_gmt, $b->comment_date_gmt);'));
     881                                }
     882                        }
     883
     884                        return $comments;
     885                }
     886
    851887        } // end class definition
    852888} // end if-class-exists test
  • openid/trunk/user-interface.php

    r11275 r11277  
    5555                add_filter( 'comment_notification_subject', array( $wordpressOpenIDRegistrationUI->oid, 'openid_comment_notification_subject'), 10, 2 );
    5656                add_filter( 'comment_notification_text', array( $wordpressOpenIDRegistrationUI->oid, 'openid_comment_notification_text'), 10, 2 );
     57                add_filter( 'comments_array', array( $wordpressOpenIDRegistrationUI->oid, 'comments_awaiting_moderation'), 10, 2);
    5758               
    5859                add_action( 'delete_user', array( $wordpressOpenIDRegistrationUI->oid, 'drop_all_identities_for_user' ) );      // If user is dropped from database, remove their identities too.
Note: See TracChangeset for help on using the changeset viewer.