Subject: Show subscribed cats in Mail
Here is another sample for the userfunctions.php. It replaces @@cats with the cats, which are currently subscribed. Ther performance is quite poor, but 99% probably don't care too much about that.
- function post_notificataion_uf_perEmail($post_id, $emailadd){
- //Load stuff we need.
- global $wpdb;
- require_once(post_notification_path . get_option('post_notification_profile') . '/strings.php');
- $t_emails = $wpdb->prefix . 'post_notification_emails';
- $t_cats = $wpdb->prefix . 'post_notification_cats';
- //Get the subscribed cats.
- $subcats_db = $wpdb->get_results("SELECT cat_id FROM $t_cats c, $t_emails e " .
- "WHERE c.id = e.id AND e.email_addr = '$emailadd' ORDER BY cat_id ASC");
- //Make shure the sting is defined
- $rv['@@cats'] = '';
- //Walk through the cats.
- foreach($subcats_db as $subcat){
- $cat = $subcat->cat_id;
- if($cat == 0){
- $rv['@@cats'] = $post_notification_strings['all'] . ', ';
- //If all are requested we don't need to add any more.
- break;
- } else {
- $cat = get_category($cat); //ID -> Object
- $rv['@@cats'] .= $cat->cat_name . ', ';
- }
- }
- }
- return $rv;
- }
The author has attached one file to this post: