Not logged in. · Lost password · Registration disabled

All posts by chrisdpratt (3)

topic: 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.)  in the forum: Files & Mods / Datein & Mods
chrisdpratt #1
Member since Feb 2010 · 3 posts
Group memberships: Mitglieder
Show profile · Link to this post
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.
topic: 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.)  in the forum: Files & Mods / Datein & Mods
chrisdpratt #2
Member since Feb 2010 · 3 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: 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.

        }
The author has attached one file to this post:
frontend_subscribe.php | Save   3.4 kBytes, downloaded 929 times
topic: Few Newbie Questions (Is there a widget? How can I allow users to choose categories on the subscribe form? How can I disable categories from being present to the user?)  in the forum: Questions / Fragen
chrisdpratt #3
Member since Feb 2010 · 3 posts
Group memberships: Mitglieder
Show profile · Link to this post
Subject: Few Newbie Questions
Just a few questions:

First, it doesn't appear that there's a widget for the subscribe form. Is that indeed the case? I saw a file called "subscribe_snippet.php", so presumably I could just create my own widget using this example?

Second, I want to list category checkboxes in the initial subscribe form, i.e. the one I'd be putting the sidebar. But, there's no help as to how to accomplish this provided in the "subscribe_snippet.php" file mentioned above. How can I add categories to that form?

Third, I have a lot of categories that exist purely to structure the site and are not really for public consumption. For example, there's a featured categories that exists to show featured posts on the home page, but I don't want people to be able to subscribe directly to this category. In the settings, I saw that you can "uncheck" categories, but I think this simply makes them unchecked by default when presented to users, rather than actually removing them entirely as an option. Anyways, how would I go about completely disabling a category so that it would never even be presented to the user as an option?

Sorry for the long-winded questions. I would greatly appreciate any help you can provide. Thanks.
Close Smaller – Larger + Reply to this post:
Special characters:
Special queries
Go to forum