WordPress.org

Plugin Directory

Changeset 25259


Ignore:
Timestamp:
11/25/07 20:39:15 (6 years ago)
Author:
markjaquith
Message:

Allow post_subscriptions to hold the subscriptions of more than one post. Props Donncha.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • subscribe-to-comments/trunk/subscribe-to-comments.php

    r14273 r25259  
    334334 
    335335    function subscriptions_from_post($postid) { 
    336         if ( is_array($this->post_subscriptions) ) 
    337             return $this->post_subscriptions; 
     336        $postid = (int) $postid; 
     337        if ( is_array($this->post_subscriptions[ $postid ]) ) 
     338            return $this->post_subscriptions[ $postid ]; 
    338339        global $wpdb; 
    339         $postid = (int) $postid; 
    340340        $this->post_subscriptions = $wpdb->get_results("SELECT comment_author_email FROM $wpdb->comments WHERE comment_post_ID = '$postid' AND comment_subscribe='Y' AND comment_author_email != '' AND comment_approved = '1' GROUP BY LCASE(comment_author_email)"); 
    341341        $subscribed_without_comment = get_post_meta($postid, '_sg_subscribe-to-comments'); 
    342342        foreach ( (array) $subscribed_without_comment as $email ) 
    343             $this->post_subscriptions[]->comment_author_email = $email; 
    344         return $this->post_subscriptions; 
     343            $this->post_subscriptions[ $postid ][]->comment_author_email = $email; 
     344        return $this->post_subscriptions[ $postid ]; 
    345345    } 
    346346 
Note: See TracChangeset for help on using the changeset viewer.