Nicht angemeldet. · Kennwort vergessen · Registrierung deaktiviert
Forum: Übersicht Files & Mods / Datein & Mods RSS
Patch: Set Categories During Initial Subscribe
Getting the category checkboxes to show up on the subscribe form is only half the battle. Without this patch, the submitted data is simply ignored.
chrisdpratt #1
Mitglied seit 02/2010 · 3 Beiträge
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Betreff: Patch: Set Categories During Initial Subscribe
frontend_subscribe.php:

        // ******************************************************** //
        //                      SUBSCRIBE
        // ******************************************************** //
        if ($action == "subscribe" || $action == '') {               
            $mid = post_notification_get_mid($addr);
            if(!$mid){
                post_notification_add_email($addr); //Ab bit of an overhead, but for historical reasons.
                $mid = post_notification_get_mid($addr);
            }
           
            //Add request to send mail to queue.
            $wpdb->query("INSERT INTO $t_queue (email_id, obj_id, state, type, date)
                            VALUES($mid, 0, 0, 2, '" . post_notification_date2mysql() . "')");
           
            if(is_numeric($post_id)){
                post_notification_fe_update_subscriptions($mid, array($post_id) ,2, false);
            }
           
            /* BEGIN Patch */
            if($_POST['pn_set_post_cat']){       
                post_notification_fe_update_subscriptions($mid,$_POST['pn_post_cat'] ,0);
                $datasaved = true;
            }
            /* END Patch */

            //Output Page
            $content['header'] = $post_notification_strings['registration_successful'];
            $content = post_notification_ldfile('reg_success.tmpl');
            return $content; //here it ends - We don't want to show the selection screen.

        }
Der Autor hat eine Datei an diesen Beitrag angehängt:
frontend_subscribe.php | Speichern   3,4 kBytes, 835 mal heruntergeladen
chrisdpratt #2
Mitglied seit 02/2010 · 3 Beiträge
Gruppenmitgliedschaften: Mitglieder
Profil anzeigen · Link auf diesen Beitrag
Seems I missed a very important thing. The `post_notification_fe_update_subscriptions` function has a parameter, $mode, that affects how the categories are added. If $mode=1, the chosen categories replace default and already set categories. If $mode=0, the chosen categories are simply added to any default or already set categories.

If you have set default categories in the Post Notification settings, then you need to change that last parameter in the function call from 0 to 1, or it will force the default categories on the user even if they deselect them.
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