MyBB Community Forums

Full Version: Link to plugins settings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Example: admin/index.php?module=config-settings&action=change&search=google_seo

would list all Google SEO related settings

The plugin actually does query the gid instead though. It's not really a problem - it's not like an admin visits his plugin page every day or reloads it every 5 seconds. For such a rarely visited page it's fine to have a bunch of extra (inexpensive) queries.
Hmmm . . . this makes me wonder if people hate my big title font and info links on ASB . . . Dodgy
There are few threads that mention the "where was that ... setting" problem.
I suggested making setting different by adding icon - that could make the problem easier.

Setting Groups list/table, shows two lines per row:
Group Title (n Settings)
Description

For test we have:
- plugin icon from mods site [Image: plugin.png]
- table mybb_settinggroups has isdefault = 0 for plugins

- changes in line 1290, in file admin/modules/config/settings.php:
		// original loong line:
		// $table->construct_cell("<strong><a href=\"index.php?module=config-settings&amp;action=change&amp;gid={$group['gid']}\">{$group_title}</a></strong> ({$group['settingcount']} {$lang->bbsettings})<br /><small>{$group_desc}</small>");
		// replace with block:
		$cellline1 = "<strong><a href=\"index.php?module=config-settings&amp;action=change&amp;gid={$group['gid']}\">{$group_title}</a></strong> ({$group['settingcount']} {$lang->bbsettings})";
		$cellline2 = "<small>{$group_desc}</small>";
		if($group['isdefault'] == 1) {
			$table->construct_cell("{$cellline1}<br />{$cellline2}"); 
		} else {
			$table->construct_cell("<img src='http://mods.mybb.com/assets/images/icons/plugin.png' alt='' style='float:left;margin:5px 4px 4px 0;'>{$cellline1}<br />{$cellline2}");
		}
		// end of block
code is for 16x16px icon, it can be smaller:
[Image: setting_groups.png]
I have a tutorial for similar that separates group settings into default and plugins, then alphabetizes them.

http://www.communityplugins.com/forum/sh...php?tid=96

[Image: attachment.php?aid=27]
Both would work great IMO. I personally think that the first should be included in the core. A indicator wether a new setting has been added in the group would also be useful (a half jigsaw piece).
To add icons to sidebar, we can modify function add_menu_items, here's new version:
line 800 in admin/inc/class_page.php
	function add_menu_items($items, $active)
	{
		global $run_module;
		global $lang;
		$this->_contents = "<ul class=\"menu\">";
		
		$num_default_items = 0;
		switch("{$run_module}.{$this->_title}")
		{
			case "home.{$lang->home}":
				$num_default_items = 4;
				break;
			case "home.{$lang->quick_access}":
				$num_default_items = 6;
				break;
			case "config.{$lang->configuration}":
				$num_default_items = 16;
				break;
			case "forum.{$lang->forums_and_posts}":
				$num_default_items = 4;
				break;
			case "user.{$lang->users_and_groups}":
				$num_default_items = 7;
				break;
			case "style.{$lang->templates_and_style}":
				$num_default_items = 2;
				break;
			case "tools.{$lang->tools_and_maintenance}":
				$num_default_items = 8;
				break;
			case "tools.{$lang->logs}":
				$num_default_items = 6;
				break;
			default:
				//$num_default_items = 0; // all items are custom and will have icon, too much
				$num_default_items = 99; 
				// show icon in title
				$this->_title = "<img src=\"http://mods.mybb.com/assets/images/icons/plugin.png\" alt=\"\"> {$this->_title}";
				break;
		}
		$ctr = 0;
		foreach($items as $item)
		{
			if(!check_admin_permissions(array("module" => $run_module, "action" => $item['id']), false))
			{
				continue;
			}
			
			$class = "";
			if($item['id'] == $active)
			{
				$class = "active";
			}
			$item['link'] = htmlspecialchars_uni($item['link']);
			
			++$ctr;
			$extrainfo = "";
			if ($ctr > $num_default_items)
			{
				$extrainfo = '<img src="http://mods.mybb.com/assets/images/icons/plugin.png" alt="" style="vertical-align:top;" width=12 height=12> ';
			}
			$this->_contents .= "<li class=\"{$class}\"><a href=\"{$item['link']}\">{$extrainfo}{$item['title']}</a></li>\n";
		}
		$this->_contents .= "</ul>";
	}
screenshot:
[Image: setting_menu.png]

JordanMussi> A indicator wether a new setting has been added in the group would also be useful (a half jigsaw piece).
That's left as an exercise to the reader Smile

There are icons in ACP > Configuration > Help Documents:
[Image: helpdoc_icons.png]

I don't see them in mybb 1.8
Maybe someone can help the team and make icons, I'd suggest a book/page/or questionmark.
It's possible to add green plugin icons [Image: plugin.png] without changing any core file. I did it as exercise Smile

File "style.php" (in admin/styles/Sharepoint/ and in admin/styles/Default/) allows overriding of Admin CP styles/layout. Overriding didn't work as described in manuals, so I had to copy 2 classes (that explains some spaghetti in code). To determine if settings is custom i.e. made by plugin, some data is hardcoded.

SharepointEx.zip should be unpacked and moved to admin\styles\ - after copying you'll have 3 folders (default, sharepoint, sharepointEx) and the same 3 options in ACP preferences - change Admin Control Panel Theme to sharepointEx.
Thanks!
(2013-05-18, 05:34 PM)thebobo1 Wrote: [ -> ]File "style.php" (in admin/styles/Sharepoint/ and in admin/styles/Default/) allows overriding of Admin CP styles/layout. Overriding didn't work as described in manuals, so I had to copy 2 classes (that explains some spaghetti in code).

In \admin\inc\class_table.php class DefaultTable has 3 private members:
	private $_cells = array();
	private $_rows = array();
	private $_headers = array();

If I change these variables to public, extends works, and I can have one function overriden:
class Table extends DefaultTable
{
	function construct_cell($data, $extra=array()) {...}
}

instead of spaghetti I used previously:
class Table
{
	function construct_cell($data, $extra=array())  {...}
	function construct_row($extra = array())  {...}
	function construct_header($data, $extra=array())
	function output_row_cells($row_id, $return=false)
	function num_rows()
	function output($heading="", $border=1, $class="general", $return=false)
	function construct_html($heading="", $border=1, $class=null, $table_id="")
}

The same is in mybb ver. 1.8, I tested Table class - extends works only when I change 3 variables to public.
Pages: 1 2