Not logged in. · Lost password · Registration disabled

All posts by syfr12 (4)

topic: Auto Subscribe when new user registing  in the forum: Files & Mods / Datein & Mods
syfr12 #1
Member since Jan 2009 · 4 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: Auto Subscribe when new user registing
give admin an option "Auto Subscribe When New User Registing" ,Choice "yes" ,the new user will auto subscribe


change :

1 in install.php add
add_option('post_notification_auto_subscribe', 'yes','Auto Subscribe when regist new user', 'no'); 
2 in admin_settings.php
  2.1 under line  <h4> <?php  _e('Technical', 'post_notification');  ?></h4>
      add:
    <tr class="alternate">
        <th style="text-align:right;padding-right:10px;"><?php _e('Auto Subscribe When New User Registing:', 'post_notification'); ?></th>
        <td>
            <select name="auto_subscribe" >
              <option value="no"  <?php  echo $auto_subscribeN; ?> > <?php  _e('No', 'post_notification'); ?></option>
              <option value="yes" <?php  echo $auto_subscribeY; ?> > <?php  _e('Yes', 'post_notification'); ?></option>
            </select>   
        </td>
    </tr> 

   2.2 in function post_notification_admin_sub()
      add:


    update_option('post_notification_auto_subscribe', $_POST['auto_subscribe']);

    if(get_option('post_notification_auto_subscribe') == 'yes') //rather have No
        $auto_subscribeY = $selected;
    else
        $auto_subscribeN = $selected;

3 in post_notification.php
  3.1 in  function post_notification_gui_init() add:
      add_action('user_register', 'post_notification_register'); 
  3.2 add function  post_notification_register
///  Auto Subscribe for new wordpress user registion
function post_notification_register($user_id) {
    global $wpdb;     
   
    if ($user_id == 0 ) { $user_id = get_userdatabylogin($_POST['user_login']); }
  
    $auto_subscribe =  get_option('post_notification_auto_subscribe') ;
    if ($auto_subscribe == "no") { return; }
   
    if (0 == $user_id) { $user_id = (int) func_get_arg( 0 ); }
    if (0 == $user_id) { return; }      
      
        $t_emails = $wpdb->prefix . 'post_notification_emails';
        $t_cats = $wpdb->prefix . 'post_notification_cats';
       
          
        $user = get_userdata($user_id);
        $addr = $user->user_email ;
        $gets_mail = 1;
        $now = post_notification_date2mysql();
       
        $mid = $wpdb->get_var("SELECT id FROM $t_emails WHERE email_addr = '$addr'");
        if (!$mid) {
            $wpdb->query(
                    "INSERT " . $t_emails .
                    " (email_addr, gets_mail, last_modified, date_subscribed) " .
                    " VALUES ('$addr', '$gets_mail', '$now', '$now')");       
            $mid = $wpdb->get_var("SELECT id FROM $t_emails WHERE email_addr = '$addr'");        
        }
       
        $selected_cats = explode(',', get_option('post_notification_selected_cats'));
       
        foreach($selected_cats as $cat){
            if(is_numeric($cat)){ //Security
                    if(!$wpdb->get_var("SELECT id FROM $t_cats WHERE id = $mid AND cat_id = $cat")){
                        $wpdb->query("INSERT INTO $t_cats (id, cat_id) VALUES($mid, $cat)");
                    }
            }
        }
    
}
topic: add option post_notification_max_exe  in the forum: Files & Mods / Datein & Mods
syfr12 #2
Member since Jan 2009 · 4 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: add option post_notification_max_exe
background:
         default max_execution_time is 30 seconds at most server site,
         it's too short,will caulse query sql be executed too much times
         For perfmonce ,give you a chance to  add the max_execution_time to greater number termporily;

change:

1\ in install.php,add:
add_option('post_notification_max_exe', "6000" , 'Max Execute Time of Mail send script', 'no');
2\  in admin_settings.php ,
2.1: under then line :  <h4> <?php  _e('Technical', 'post_notification');  ?></h4>
add:


    <tr class="alternate">
        <th style="text-align:right;padding-right:10px;"><?php _e('php max_execute_time when send mail:', 'post_notification'); ?></th>
        <td><input name="max_exe" type="text" id="max_exe" size="35" value="<?php  echo get_option('post_notification_max_exe'); ?>" /> <?php _e('seconds.', 'post_notification'); ?></td>
    </tr>
2.2: before the line : $p_pause = $_POST['pause'];
add:
        $p_max_exe = $_POST['max_exe'];
        if(is_numeric($p_max_exe)){
            if($p_max_exe >= 0){
                update_option('post_notification_max_exe', $p_max_exe );
            } else {
                echo '<div class="error">' . __('php max_execute_time must be zero or greater.', 'post_notification') . '</div>';
            }
        } else {
            echo '<div class="error">' . __('php max_execute_time must be a number.', 'post_notification') . '</div>';
        }
3  in sendmail.php->function post_notification_send()    
add:
  $max_exe = get_option('post_notification_max_exe');
  if ($max_exe > 0) {
    ini_set("max_execution_time",$max_exe);   
  }
topic: add author  in Email Subject  in the forum: Files & Mods / Datein & Mods
syfr12 #3
Member since Jan 2009 · 4 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: add author  in Email Subject
change:

 In sendmail.php->post_notification_create_email()
         find "$subject = get_option('post_notification_subject');"
         add new line:  $subject = str_replace('@@author', $post_author, $subject);
topic: change: Add choice to blog Admin, who can make the "reply to" to Post's Author's Email  in the forum: Files & Mods / Datein & Mods
syfr12 #4
Member since Jan 2009 · 4 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: change: Add choice to blog Admin, who can make the "reply to" to Post's Author's Email
change: Add choice to blog Admin, who can make the "reply to" to Post's Author's Email
         Admin Should set Sender-Email: as @@author_email


detail : In sendmail.php->post_notification_create_email()
         Add $header = str_replace('@@author_email',$post_author_email,$header);
Close Smaller – Larger + Reply to this post:
Special characters:
Special queries
Go to forum