Plugin Directory

Changeset 570144


Ignore:
Timestamp:
07/10/2012 03:55:24 PM (14 years ago)
Author:
amolnw2778
Message:
  • Updated email subject
  • Removed condition which was preventing email to deliver
Location:
navayan-subscribe/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • navayan-subscribe/trunk/ny-subscribe-define.php

    r569147 r570144  
    44    define('NY_PLUGIN_SUBSCRIBE_NAME', __('Navayan Subscribe') );
    55    define('NY_PLUGIN_SUBSCRIBE_SLUG', 'navayan-subscribe');
    6     define('NY_PLUGIN_SUBSCRIBE_VERSION', '1.1.7.2');
     6    define('NY_PLUGIN_SUBSCRIBE_VERSION', '1.1.7.3');
    77    define('NY_PLUGIN_SUBSCRIBE_DIR', WP_PLUGIN_URL.'/'.NY_PLUGIN_SUBSCRIBE_SLUG.'/'); 
    88    define('NY_PLUGIN_SUBSCRIBE_INFO', __('Allows your website/blog visitor to easily and quickly register to your website/blog using email, name and additional field. Send subscribe notification to admin.') );
  • navayan-subscribe/trunk/ny-subscribe.php

    r569147 r570144  
    33Plugin Name: Navayan Subscribe
    44Description: <strong>Navayan Subscribe</strong> allows your website/blog visitor to easily and quickly register to your website/blog using email, name and additional field. Send subscribe notification to admin and new post notification to subscribers.
    5 Version: 1.1.7.2
     5Version: 1.1.7.3
    66Usage: Paste this single line code within PHP tag in your template: if ( function_exists('navayan_subscribe') ){ echo navayan_subscribe(); } or put shortcode [navayan_subscribe] in post/page
    77Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=amolnw2778@gmail.com&item_name=NavayanSubscribe
     
    299299    global $wpdb, $unsubscribe_page_id;
    300300    $new_post = get_post( $post_id );
    301     if ( $new_post->post_status != 'publish'){  // TO DO - is this causing an issue?
    302         $send_post_content = get_option('ny_subscribe_field_new_post_content') == 1 ? $new_post->post_content : '';
    303         $blogname   = get_option('blogname');   
    304         $from           = get_option('admin_email'); # check for current user
    305         ini_set("sendmail_from","<$from>");
    306         $subject    = __("New post at ". $blogname);
    307         $headers  = "MIME-Version: 1.0 \r\n";
    308         $headers .= "Content-type: text/html; charset=utf-8 \r\n";
    309         $headers .= "From: $blogname <$from>\r\n";
    310 
    311         $subscriber_query = mysql_query("SELECT ID, user_login, user_email
    312                                                                                 FROM ".$wpdb->prefix."users u, ".$wpdb->prefix."usermeta um
    313                                                                                 WHERE um.meta_key='".$wpdb->prefix."capabilities'
    314                                                                                 AND um.meta_value LIKE '%subscriber%'
    315                                                                                 AND um.user_id = u.ID ") or die(mysql_error());
     301
     302    $postNewOrUpdated = $new_post->post_date == $new_post->post_modified ? 'New' : 'Updated';
     303
     304    $send_post_content = get_option('ny_subscribe_field_new_post_content') == 1 ? $new_post->post_content : '';
     305    $blogname   = get_option('blogname');   
     306    $from           = get_option('admin_email'); # check for current user
     307    ini_set("sendmail_from","<$from>");
     308    $subject    = __( $blogname . ': ' . $postNewOrUpdated . ' post: ' . $new_post->post_title );
     309    $headers  = "MIME-Version: 1.0 \r\n";
     310    $headers .= "Content-type: text/html; charset=utf-8 \r\n";
     311    $headers .= "From: $blogname <$from>\r\n";
     312
     313    $subscriber_query = mysql_query("SELECT ID, user_login, user_email
     314                                                                            FROM ".$wpdb->prefix."users u, ".$wpdb->prefix."usermeta um
     315                                                                            WHERE um.meta_key='".$wpdb->prefix."capabilities'
     316                                                                            AND um.meta_value LIKE '%subscriber%'
     317                                                                            AND um.user_id = u.ID ") or die(mysql_error());
     318   
     319    while ($ny_subscribers = mysql_fetch_array($subscriber_query)){
     320        $uname = get_user_meta ($sub_list['ID'], 'first_name');
     321        $uname = $uname != '' ? $uname : $ny_subscribers['user_login'];     
     322        $message = "<html>
     323                                    <head></head>
     324                                    <body>
     325                                        <table cellpadding='0' cellspacing='0' border='0'>
     326                                            <tr>
     327                                                <td>".__('Hi ') . $uname ."!</td>
     328                                            </tr>
     329                                            <tr>
     330                                                <td>
     331                                                    <p>".__('A new post has been published at ') . $blogname."
     332                                                    <p>".__('Please check'). " <a href='". get_post_permalink( $new_post->ID ) ."' target='_blank'>". __($new_post->post_title) ."</a></p>
     333                                                    ". __($send_post_content) ."
     334                                                </td>
     335                                            </tr>";
    316336       
    317         while ($ny_subscribers = mysql_fetch_array($subscriber_query)){
    318             $uname = get_user_meta ($sub_list['ID'], 'first_name');
    319             $uname = $uname != '' ? $uname : $ny_subscribers['user_login'];     
    320             $message = "<html>
    321                                         <head></head>
    322                                         <body>
    323                                             <table cellpadding='0' cellspacing='0' border='0'>
    324                                                 <tr>
    325                                                     <td>".__('Hi ') . stripslashes( $uname ) ."!</td>
    326                                                 </tr>
    327                                                 <tr>
    328                                                     <td>
    329                                                         <p>".__('A new post has been published at ') . $blogname."
    330                                                         <p>".__('Please check'). " <a href='". get_post_permalink( $new_post->ID ) ."' target='_blank'>". __($new_post->post_title) ."</a></p>
    331                                                         ". __($send_post_content) ."
    332                                                     </td>
    333                                                 </tr>";
    334            
    335             # APPEND UN-SUBSCRIBE LINK
    336             if ( $unsubscribe_page_id ){
    337                 if ( function_exists( 'fn_unsubscribe' ) ){
    338                     $message .= fn_unsubscribe( $ny_subscribers['user_email'] );
    339                 }
     337        # APPEND UN-SUBSCRIBE LINK
     338        if ( $unsubscribe_page_id ){
     339            if ( function_exists( 'fn_unsubscribe' ) ){
     340                $message .= fn_unsubscribe( $ny_subscribers['user_email'] );
    340341            }
    341            
    342             $message .= " </table>
    343                                         </body>
    344                                     </html>";
    345 
    346             @wp_mail( $ny_subscribers['user_email'], $subject, $message, $headers );
    347342        }
     343       
     344        $message .= " </table>
     345                                    </body>
     346                                </html>";
     347
     348        @wp_mail( $ny_subscribers['user_email'], stripslashes( $subject ), stripslashes( $message ), $headers );
    348349    }
    349350}
  • navayan-subscribe/trunk/readme.txt

    r569147 r570144  
    44Requires at least: 3+
    55Tested up to: 3.4.1
    6 Stable tag: 1.1.7.2
     6Stable tag: 1.1.7.3
    77Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=amolnw2778@gmail.com&item_name=NavayanSubscribe
    88
     
    3838* Custom message if user is logged in
    3939* Custom Un-Subscribe Message
    40 * Checks if post is not already published
     40* Checks email subject - New or Updated post
    4141
    4242**Links:**
     
    8181If you want to display Navayan Subscribe form in sidebar then go to 'Appearance -> Widgets', drag and drop 'Navayan Subscribe' widget in your sidebar.
    8282
     83If you feel this plugin saved your efforts, I would appreciate if you Rate it!
     84
    8385**Links:**
    8486* [Plugin's Homepage](http://blog.navayan.com/navayan-subscribe-easy-way-to-subscribe-wordpress-website-or-blog/)
     
    9799
    98100== Changelog ==
     101
     102= 1.1.7.3 (20120710) =
     103* NEW: Checks subscribe email send subject - New or Updated post
     104* FIX: Condition which was preventing email to deliver in some cases
    99105
    100106= 1.1.7.2 (20120709) =
Note: See TracChangeset for help on using the changeset viewer.