Exemple #1
0
 /**
  * Get any additional comments awaiting moderation by this user.  WordPress
  * core has been udpated to grab most, but we still do one last check for
  * OpenID comments that have a URL match with the current user.
  *
  * @param array $comments array of comments to display
  * @param int $post_id id of the post to display comments for
  * @return array new array of comments to display
  */
 function comments_awaiting_moderation(&$comments, $post_id)
 {
     global $wpdb, $openid;
     $user = wp_get_current_user();
     $commenter = wp_get_current_commenter();
     extract($commenter);
     $author_db = $wpdb->escape($comment_author);
     $email_db = $wpdb->escape($comment_author_email);
     $url_db = $wpdb->escape($comment_author_url);
     if ($url_db) {
         $comments_table = WordPressOpenID::comments_table_name();
         $additional = $wpdb->get_results("SELECT * FROM {$comments_table}" . " WHERE comment_post_ID = '{$post_id}'" . " AND openid = '1'" . " AND comment_author_url = '{$url_db}'" . ($user ? " AND user_id != '{$user->ID}'" : '') . ($author_db ? " AND comment_author != '{$author_db}'" : '') . ($email_db ? " AND comment_author_email != '{$email_db}'" : '') . " AND comment_approved = '0'" . " ORDER BY comment_date");
         if ($additional) {
             $comments = array_merge($comments, $additional);
             usort($comments, create_function('$a,$b', 'return strcmp($a->comment_date_gmt, $b->comment_date_gmt);'));
         }
     }
     return $comments;
 }
Exemple #2
0
 function usermeta_table_name()
 {
     return WordPressOpenID::table_prefix() . 'usermeta';
 }
Exemple #3
0
 /**
  * Remove database tables which hold only transient data - associations and nonces.  Any non-transient data, such
  * as linkages between OpenIDs and WordPress user accounts are maintained.
  */
 function destroy_tables()
 {
     global $wpdb;
     $sql = 'drop table ' . WordPressOpenID::associations_table_name();
     $wpdb->query($sql);
     $sql = 'drop table ' . WordPressOpenID::nonces_table_name();
     $wpdb->query($sql);
     // just in case they've upgraded from an old version
     $settings_table_name = (isset($wpdb->base_prefix) ? $wpdb->base_prefix : $wpdb->prefix) . 'openid_settings';
     $sql = "drop table if exists {$settings_table_name}";
     $wpdb->query($sql);
 }