Nicht angemeldet. · Kennwort vergessen · Registrierung deaktiviert
Forum: Übersicht Files & Mods / Datein & Mods RSS
Auto Subscribe when new user registing
syfr12 #1
Mitglied seit 01/2009 · 4 Beiträge
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Betreff: 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)");
                    }
            }
        }
    
}
NasheedsNow.com #2
Mitglied seit 03/2009 · 1 Beitrag
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Zitat von syfr12 am 06.01.2009, 17:00:
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)");
                    }
            }
        }
    
}

Thank you so much! This is just what I was looking for and it worked  :-D ! Cheers.

Hmm, it makes me wonder whether it is possible to autosubscribe existing registered users using a mod? Thanks again!
Morty (Administrator) #3
Benutzertitel: Author
Mitglied seit 06/2007 · 928 Beiträge
Gruppenmitgliedschaften: Administratoren, Mitglieder
Profil anzeigen · Link auf diesen Beitrag
I just added this to 1.x branch. It'll be in the next release.
peterve #4
Mitglied seit 09/2008 · 20 Beiträge
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
I like this feature a lot, however it would be nice to see a checkbox in the registration page to allow the user to subscribe when he or she registers
Do you think that would be possible ?
Morty (Administrator) #5
Benutzertitel: Author
Mitglied seit 06/2007 · 928 Beiträge
Gruppenmitgliedschaften: Administratoren, Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Where is the sense in that?
Morty (Administrator) #6
Benutzertitel: Author
Mitglied seit 06/2007 · 928 Beiträge
Gruppenmitgliedschaften: Administratoren, Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Antwort auf Beitrag #2
Zitat von NasheedsNow.com am 11.03.2009, 08:16:
Hmm, it makes me wonder whether it is possible to autosubscribe existing registered users using a mod? Thanks again!

You can export your subscribers and then use the management tab.
sohalm #7
Mitglied seit 03/2010 · 2 Beiträge
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Betreff: auto subscribe not working
I am new to this plugin and think it is a fantastic time saver.

I have set "Add user to PN when registering to WP:" to "yes". However, this does not seem to work.
Do I need to add the code in this thread to make this work?

I am on WP 2.9.2, and am using register plus

Thanks
Schließen Kleiner – Größer + Auf diesen Beitrag antworten:
Prüfcode: VeriCode Gib bitte das Wort aus dem Bild ins folgende Textfeld ein. (Nur die Buchstaben eingeben, Kleinschreibung ist in Ordnung.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Weitere Zeichen:
Gehe zu Forum