UQM - How to add "new quiz" icon for Category view page

All web design discussion, including Ultimate Quiz MOD support.

Moderator: CricketMX Forum Moderators

Post Reply
User avatar
quahappy
Happy, not Quappy
Happy, not Quappy
Posts: 2266
Joined: Fri Oct 10, 2008 8:56 pm
Location: South Yorkshire, UK

This suggestion was originally here.

At the moment, if on viewing a list of quizzes within a category and new quiz(zes) has been added, the "new quiz" icon is shown.

It would be excellent if the "new posts" image on forum index could be included on the "Select category" page so users can see that one category (or more) contain new quizzes. If no new quiz within a category then you see "no new posts" image. Or, if possible, custom UQM "new quiz/no new quiz" images. I could create these if demand calls for this. ;)
If you don't ask...
User avatar
battye
Site Admin
Site Admin
Posts: 14391
Joined: Sun Jan 11, 2004 8:26 am
Location: Australia
Contact:

Try this quahappy, let me know if it works. Don't forget to purge cache afterwards :)

OPEN quiz.php

FIND

Code: Select all

				$quiz_count_quiz_num	= find_number_of_quiz_in_category($quiz_category_id);
AFTER ADD

Code: Select all

				$new_quiz_sql = 'SELECT COUNT(quiz_id) AS qct FROM ' . QUIZ_TABLE . '
								 WHERE quiz_category = ' . $quiz_category_id . '
								 AND quiz_date > ' . $user->data['user_lastvisit'];
				$new_quiz_result = $db->sql_query($new_quiz_sql);
				$new_quiz_row = $db->sql_fetchrow($new_quiz_result);
				$new_quiz_login = ($new_quiz_row['qct'] > 0) ? $user->img('icon_topic_newest', 'VIEW_NEWEST_POST') . ' ' : '';
				$db->sql_freeresult($new_quiz_result);
FIND

Code: Select all

				$template->assign_block_vars('category_row', array(	
				'CAT_LINK'				=> $quiz_category_link,
				'CAT_NAME'				=> $quiz_category_name,
AFTER ADD

Code: Select all

				'CAT_NEW_QUIZ'				=> $new_quiz_login,
OPEN styles/prosilver/template/quiz_body.html

FIND

Code: Select all

<dt><label for="keywords"><a href="{category_row.CAT_LINK}">{category_row.CAT_NAME}</a></label>
IN LINE FIND

Code: Select all

{category_row.CAT_NAME}
BEFORE ADD

Code: Select all

{category_row.CAT_NEW_QUIZ}
Let me know how that goes :)
CricketMX.com in 2022: Still the home of bat's, rat's and other farmyard animals!

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
quahappy
Happy, not Quappy
Happy, not Quappy
Posts: 2266
Joined: Fri Oct 10, 2008 8:56 pm
Location: South Yorkshire, UK

Sorry for taking a while to reply. Been extremely busy of late.

Thanks for the code battye. Will later insert and test later then let you know how it goes. ;)
If you don't ask...
User avatar
quahappy
Happy, not Quappy
Happy, not Quappy
Posts: 2266
Joined: Fri Oct 10, 2008 8:56 pm
Location: South Yorkshire, UK

Yep. It works. :D

Only thing I notice is when all new quiz(zes) has been played, the {category_row.CAT_NEW_QUIZ} image still shows and only disappears if you log out and back in again unless of course new quizzes has been added since.
If you don't ask...
Post Reply