MyBB Community Forums

Full Version: Help Center Display Category
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Done anyone know how to get the category to display here?

[attachment=41439]
(2019-01-15, 09:21 AM)Kumari Ashamaki Wrote: [ -> ]Done anyone know how to get the category to display here?

ok, well category title will add too much space to the existing area but category id will most likely not so lets give that one a go for space and such as I do not have much time at the moment to focus on this for you.


First go into your global templates for example:

Home » Template Sets » Global Templates

Edit "helpcenter_manager_tickets"and replace with:

{$multipage}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="7"><strong>{$lang->helpcenter} - {$lang->helpcenter_tickets}</strong></td>
</tr>
<tr>
<td class="tcat" width="20%"><strong>{$lang->helpcenter_username}</strong></td>
<td class="tcat" width="20%"><strong>{$lang->helpcenter_title}</strong></td>	
<!-- add cid start -->
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_ticket_category}</strong></td>
<!-- add cid end -->	
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_replies}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_priority}</strong></td>
<td class="tcat" width="20%" align="center"><strong>{$lang->helpcenter_date}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_action}</strong></td>
</tr>
{$tickets}
</table>


Edit "helpcenter_manager_tickets_ticket"and replace with:

<tr>
<td class="{$bgcolor}" width="20%">{$ticket['username']}</td>
<td class="{$bgcolor}" width="20%">{$ticket['title']}</td>	
<!-- add cid start -->	
<td class="{$bgcolor}" width="10%" align="center">{$ticket['cid']}</td>	
<!-- add cid end -->	
<td class="{$bgcolor}" width="10%" align="center">{$ticket['replies']}</td>
<td class="{$bgcolor}" width="10%" align="center">{$ticket['priority']}</td>
<td class="{$bgcolor}" width="20%" align="center">{$ticket['date']}</td>
<td class="{$bgcolor}" width="10%" align="center">{$ticket['action']}</td>
</tr>


Edit "helpcenter_regular_tickets"and replace with:

{$multipage}
<table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" class="tborder">
<tr>
<td class="thead" colspan="5"><strong>{$lang->helpcenter} - {$lang->helpcenter_tickets}</strong></td>
</tr>
<tr>
<td class="tcat" width="50%"><strong>{$lang->helpcenter_title}</strong></td>	
<!-- add cid start -->	
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_ticket_category}</strong></td>
<!-- add cid end -->
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_replies}</strong></td>
<td class="tcat" width="10%" align="center"><strong>{$lang->helpcenter_priority}</strong></td>
<td class="tcat" width="20%" align="center"><strong>{$lang->helpcenter_date}</strong></td>
</tr>
{$tickets}
</table>


Edit "helpcenter_regular_tickets_ticket"and replace with:

<tr>
<td class="{$bgcolor}" width="50%">{$ticket['title']}</td>	
<!-- add cid start -->
<td class="{$bgcolor}" width="10%" align="center">{$ticket['cid']}</td>		
<!-- add cid end --> 	
<td class="{$bgcolor}" width="10%" align="center">{$ticket['replies']}</td>
<td class="{$bgcolor}" width="10%" align="center">{$ticket['priority']}</td>
<td class="{$bgcolor}" width="20%" align="center">{$ticket['date']}</td>
</tr>


Now let us remember that we also would need to add that cid viewing as far as tickets to the admin side so as to know the cid visually.

Open and edit inc/languages/admin/helpcenter.lang.php and add: *


// Ticket Category - Cid
$l['helpcenter_ticket_category'] = 'Category';


* you will need to do this for each language in the respective language admin folders


Now go and edit  inc/plugins/helpcenter.php and find:

Find:

		elseif ($mybb->input['action'] == 'ticketcategories')
		{
			$page->output_nav_tabs($sub_tabs, 'helpcenter_ticketcategories');
			
			// table

			$table = new Table;
			$table->construct_header($lang->helpcenter_name, array('width' => '30%'));
			$table->construct_header($lang->helpcenter_description, array('width' => '40%'));
			$table->construct_header($lang->helpcenter_tickets, array('width' => '10%', 'class' => 'align_center'));
			$table->construct_header($lang->helpcenter_action, array('width' => '20%', 'class' => 'align_center'));
			
			$query = $db->simple_select('helpcenter_categories', '*');
			
			while ($cat = $db->fetch_array($query))
			{
				$category = $cat;
					
				$table->construct_cell(htmlspecialchars_uni($category['name']));
				$table->construct_cell(htmlspecialchars_uni($category['description']));
				$table->construct_cell(intval($category['tickets']), array('class' => 'align_center'));
				
				// actions column

				$table->construct_cell("<a href=\"index.php?module=tools-helpcenter&amp;action=editticketcategory&amp;cid=".intval($category['cid'])."\">".$lang->helpcenter_edit."</a> - <a href=\"index.php?module=tools-helpcenter&amp;action=do_deleteticketcategory&amp;cid=".intval($category['cid'])."\">".$lang->helpcenter_delete."</a>", array('class' => 'align_center'));
				
				$table->construct_row();
			}



Replace with:


		elseif ($mybb->input['action'] == 'ticketcategories')
		{
			$page->output_nav_tabs($sub_tabs, 'helpcenter_ticketcategories');
			
			// table

			$table = new Table;
			$table->construct_header($lang->helpcenter_name, array('width' => '25%'));
			$table->construct_header($lang->helpcenter_description, array('width' => '35%'));

			// add cid
			$table->construct_header($lang->helpcenter_ticket_category, array('width' => '10%', 'class' => 'align_center'));	

			$table->construct_header($lang->helpcenter_tickets, array('width' => '10%', 'class' => 'align_center'));
			$table->construct_header($lang->helpcenter_action, array('width' => '20%', 'class' => 'align_center'));
			
			$query = $db->simple_select('helpcenter_categories', '*');
			
			while ($cat = $db->fetch_array($query))
			{
				$category = $cat;
					
				$table->construct_cell(htmlspecialchars_uni($category['name']));
				$table->construct_cell(htmlspecialchars_uni($category['description']));

                                //add cid
				$table->construct_cell(intval($category['cid']), array('class' => 'align_center'));

				$table->construct_cell(intval($category['tickets']), array('class' => 'align_center'));
				
				// actions column

				$table->construct_cell("<a href=\"index.php?module=tools-helpcenter&amp;action=editticketcategory&amp;cid=".intval($category['cid'])."\">".$lang->helpcenter_edit."</a> - <a href=\"index.php?module=tools-helpcenter&amp;action=do_deleteticketcategory&amp;cid=".intval($category['cid'])."\">".$lang->helpcenter_delete."</a>", array('class' => 'align_center'));
				
				$table->construct_row();
			}


* Update: You can see the mentioned changes here: https://github.com/vintagedaddyo/MyBB_Pl...ab0e5ba454


Note: The changes are now applied to the latest build at the mods site as well here: https://community.mybb.com/mods.php?acti...5&bid=3725
I think I can work with this thank you ^-^
Your kick "but" man top notch XD

Word filter got me XD

There is one place you could display it in full would be here.

https://i.gyazo.com/c696572ebfc15ba90516...f2f035.png

Right there in the info section

Also, I was thinking that just ID may not be enough for me as I have mods that will not have access to the ACP to see what the ID means there will also be mods that will be replying to tickets based on the category like my ark server mods will reply to ark support cats and rust mods will reply to rust cat tho having it in full in info would be nice too I rather them not have to click and load each ticket to see what its cat is. I attempted to just put in "Name" rather than "CID" but then it just comes back with the title of the ticket sorry if I'm being difficult lol I'm still learning PHP

also, what do you mean by "category title will add too much space" if you mean their won't be enough room to show it that's fine because the cats will only be stuff like "Rust Ban", "Ark Ban" short stuff like that and I am willing to sacrifice the "Priority" tab to make room if need be
(2019-01-16, 05:33 AM)Kumari Ashamaki Wrote: [ -> ]I think I can work with this thank you ^-^
Your kick "but" man top notch XD

Word filter got me XD

There is one place you could display it in full would be here.

https://i.gyazo.com/c696572ebfc15ba90516...f2f035.png

Right there in the info section

Also, I was thinking that just ID may not be enough for me as I have mods that will not have access to the ACP to see what the ID means there will also be mods that will be replying to tickets based on the category like my ark server mods will reply to ark support cats and rust mods will reply to rust cat tho having it in full in info would be nice too I rather them not have to click and load each ticket to see what its cat is. I attempted to just put in "Name" rather than "CID" but then it just comes back with the title of the ticket sorry if I'm being difficult lol I'm still learning PHP

also, what do you mean by "category title will add too much space" if you mean their won't be enough room to show it that's fine because the cats will only be stuff like "Rust Ban", "Ark Ban" short stuff like that and I am willing to sacrifice the "Priority" tab to make room if need be

Cool beans! Thanks, no worries, glad to help when and if I have the free time to do so. Yeppers, being able to work with it always is a bonus and perhaps helpful in any learning process, haha.


To add cid display to that section mentioned via your screenshot, you can simply edit  in global templates "helpcenter_viewticket"


In "helpcenter_viewticket" find:

<tr>
<td class="thead" colspan="2"><strong>{$lang->helpcenter_info}</strong></td>
</tr>


add this directly after: *

<tr>
<td class="trow1" width="50%"><strong>{$lang->helpcenter_ticket_category}:</strong></td>
<td class="trow1" width="50%">{$ticket['cid']}</td>
</tr>	

* this will simply add the cid to the section you mentioned 

[attachment=41453]

And you can see above mentioned change as the latest minor commit at github: https://github.com/vintagedaddyo/MyBB_Pl...8de2357c14

Also the simple minor change is added to the mods site as build #12 
https://community.mybb.com/mods.php?acti...5&bid=3726

** now this could be further expanded in all areas that display cid to eventually display visual cat name though..., at the moment though, your free time may be more than mine to focus on this regrettably...., so also, if you do get around to this and complete it further please do share via this post and perhaps I will add it to the next release or what not.


NOTE: I have read and understand your points and if I had the free time to focus on this further at the moment perhaps I would focus further on the points you mentioned but unfortunately at the moment my computer related free time is rather limited and ideally the base of what you are seeking has been laid out via add cid display in various visual elements of the ticketing functionality
cool thank you ill try and figure it out :p
man its really got me stumped lol so replacing "CID" with "name" just replaces the CID with the title of the ticket instead of the name of the cat and I can't figure out why >.<

It's ruff it's dirty and should probably never be used by anyone but here it is and it works.

in helpcenter.php

line 802 change to
$cats .= "<option value=\"".$cat['cid']."\">".htmlspecialchars_uni($cat['catname'])."</option>";

line 882 change to
$insert_array = array('name' => $title, 'date' => TIME_NOW, 'opened' => 1, 'priority' => $priority['pid'], 'cid' => $category['cid'], 'catname' => $category['catname'], 'uid' => $mybb->user['uid']);

may cause an issue somewhere with the double $category idk but its working for now

now in inc/plugins/helpcenter.php

line 177 make a new line and add
catname varchar(300) NOT NULL default '',

line 194 change to
catname varchar(300) NOT NULL default '',

line 695 change to
<td class="{$bgcolor}" width="10%" align="center">{$ticket[\'catname\']}</td>

line 803 change to
<td class="{$bgcolor}" width="10%" align="center">{$ticket[\'catname\']}</td>

line 1356 change to
if ($mybb->input['catname'] == '' || $mybb->input['description'] == '')

line 1361 change to
$name = $db->escape_string($mybb->input['catname']);

line 1364 change to
$insert_query = array('catname' => $name, 'description' => $description);

line 1376 change to
if ($mybb->input['catname'] == '' || $mybb->input['description'] == '')

line 1381 change to
$name = $db->escape_string($mybb->input['catname']);

line 1384 change to
$update_query = array('catname' => $name, 'description' => $description);

line 1804 change to
$table->construct_cell(htmlspecialchars_uni($category['catname']));

line 1835 change to
$form_container->output_row($lang->helpcenter_addticketcategory_name, $lang->helpcenter_addticketcategory_name_desc, $form->generate_text_box('catname', '', array('id' => 'catname')), 'catname');

line 1862 change to
$form_container->output_row($lang->helpcenter_editticketcategory_name, $lang->helpcenter_editticketcategory_name_desc, $form->generate_text_box('catname', htmlspecialchars_uni($category['catname']), array('id' => 'catname')), 'catname');

here is a copy of the files as well
[attachment=41465]
[attachment=41466]

thank you for all your help man could not have done it without you Big Grin