Control Email Notifications

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
noname4444
Posts: 3
Joined: Thu Jul 03, 2014 6:24 pm

Control Email Notifications

Post by noname4444 »

Hello,

I'm wondering if it's possible to limit the e-mail notifications for a category to just the category owner?

Also, if so, would it be possible to set a group as a category owner so a small list of people get notified but not all admins?

With our setup, only certain people are responsible for answering questions from a given category. I want them to be e-mailed about it, but not receive e-mails from categories they are not responsible for.

Thanks!
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Control Email Notifications

Post by Thorsten »

Hi,

sadly, that's not possible right now. You could achieve this by using a user with an group email account.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
noname4444
Posts: 3
Joined: Thu Jul 03, 2014 6:24 pm

Re: Control Email Notifications

Post by noname4444 »

Hello Thorsten, thank you for the reply and for providing such great support on the forums!

So lets say I have two categories. Right now, if someone posts a question to the first category, anyone who is an admin gets an e-mail that a question was posted.

Is there a way to have a user get an e-mail if the first category has a question posted, but not receive an e-mail if the second category has a question posted?

It sounds from your previous answer there is a way to do this but I can not figure it out.

Thanks for the help!
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Control Email Notifications

Post by Thorsten »

Hi,

you could do this by creating a mailing list (not part of phpMyFAQ). Then add a user with category rights and the e-mail address of the mailing list. Then use this user as category admin. That should work. The main admin will get all e-mails.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
noname4444
Posts: 3
Joined: Thu Jul 03, 2014 6:24 pm

Re: Control Email Notifications

Post by noname4444 »

Ok, after a lot of debugging I finally figured out the issue. I tried what you said and it still would not work. So then I decided to dig into why it would not send a copy of the mail to the category owners.

After awhile I figured out which piece of code sent the e-mail when someone submitted the question. After some testing, I found that the code

Code: Select all

$userId = $cat->getCategoryUser($questionData['category_id']);
was always returning 1, regardless of the cateogory_id. I double checked the mySQL database and it had the correct User_ID for the category I was testing, which was 3.

So then I dug into the category code. Above in the "savequestion" section of the ajax code, the variable $cat is initialized to the PMF_Category class. It then calls the getAllCategories() function, which initializes the local variable $categories in the PMF_Categories class. Ok, good so far. Then I looked at the function getCategoryUser.

Code: Select all

    public function getCategoryUser($category_id)
    {
        return $this->categoryName[$category_id]['user_id'];
    }
$categoryName?? Where did this come from? I did some searches, and it is never initalized in the PMF_Category class, only $categories. So I replaced "$this->categoryName" with "$this->cateogires" in the getCategoryUser function and it worked, e-mails started sending properly.

Unfortunately, I'm scared I probably broke some functionality else where in the site. What is the proper way to fix this? Is my current fix ok?
Thorsten
Posts: 15749
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Re: Control Email Notifications

Post by Thorsten »

Hi,

your fix is okay, I'll add it to 2.8.12. $this->categoryName will be initialized in getOrderedCategories().

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply