Login Form

#101 – Wrong category in email

Posted in ‘BF Quiz’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Monday, 20 January 2014 04:32 AEDT
slselwyn
BF Quiz Plus 12 Months
Joomla! version: (3.2)

When the {category} is used in the email it always shows "Example" rather than the correct category.

(For info only so that you can fix this for future - we only have one quiz so have hard coded)
Tuesday, 21 January 2014 15:25 AEDT 15'
Tim
Everything Bundle, BF Quiz Plus 3 Years, BF Survey 12 Months
Hi Stephen,
Have you got an admin email set up for your category? Is it published? I can only recreate this issue on my test site when I only have email templates set up for the example category.

Assuming you are using the default multipage view, you can see where the category is being replaced in /components/com_bfquiz_plus/views/bfquizplus/tmpl/default.php around line 511

$adminEmail[0]->description=preg_replace('/{category}/', $adminEmail[0]->category_name , $adminEmail[0]->description); // insert category

The category name $adminEmail[0]->category_name is obtained from calling the getEmailTemplate function (on line 504 above), and this does take into account the category. If you take a look in /components/com_bfquiz_plus/controller.php, in the getEmailTemplate function around line 2280 you will see the query.

$query->from($db->quoteName('#__bfquiz_plus_email').' AS a');
$query->select('a.*, cc.title AS category_name');
$query->join('LEFT', '#__categories AS cc ON cc.id = a.catid');
$query->where('(a.state IN (0, 1))');
$query->where('a.title = '.$db->quote($title));
$query->where('a.catid = '.(int) $catid);
$query->order('a.title');

So the category name is obtained from this email template. If no matching email template is found, then it will just select the first admin email, which could be in the example category, and I suspect this might be your issue and where it is picking up Example on your site. There should be no need to hardcode the category.

If you only have one quiz on your site, just delete the example category (and empty the trash), make sure all your email templates are assigned to the correct category, and this will avoid any issue.

regards

Tim

Follow us on twitter http://twitter.com/tamlynsoftware
Wednesday, 22 January 2014 20:47 AEDT
slselwyn
BF Quiz Plus 12 Months
You were right - the templates had example in the heading - (though i don't know why it sent the email for the loupelife quiz when there were no templates for that one)

I have changed the templates to loupelife now
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.
Go to top