MyBB Community Forums

Full Version: MyForumIcons - Custom Forum Icons
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8
It works fine for me...
i installed the plugin i dont understand what i am suppose to do in the forumbit_depth2_forum

My Code

<tr>
<td class="{$bgcolor}" align="center" valign="top" width="50"><div class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"><i class="fa fa-empire"></i></div></td>
  
<td class="{$bgcolor}" valign="middle">
  <a href="{$forum_url}"><span class="threadtext">{$forum['name']}</span></a><br />{$forum_viewers_text} {$forum['description']} {$subforums}</td>

<td class="trow1" valign="middle" align="right" style="white-space: nowrap; font-size: 13px;;padding-right: 5%;">
  Posts: {$posts}{$unapproved['unapproved_posts']}<br /> 
  Threads: {$threads}{$unapproved['unapproved_threads']}
</td>
  

<td class="{$bgcolor}" valign="middle" align="left" width="22%" style="white-space: nowrap;padding-top: 15px;">{$lastpost}</td>  
</tr>
I've no clue what to do with the forumbit edit either.
Any help. Here is mine (should be default).
<tr>
<td class="{$bgcolor}" align="center" width="1"><span class="forum_status forum_{$lightbulb['folder']} ajax_mark_read" title="{$lightbulb['altonoff']}" id="mark_read_{$forum['fid']}"></span></td>
<td class="{$bgcolor}">
<strong><a href="{$forum_url}">{$forum['name']}</a></strong>{$forum_viewers_text}<div class="smalltext">{$forum['description']}{$modlist}{$subforums}</div>
</td>
<td class="{$bgcolor}" align="center" style="white-space: nowrap">{$threads}{$unapproved['unapproved_threads']}</td>
<td class="{$bgcolor}" align="center" style="white-space: nowrap">{$posts}{$unapproved['unapproved_posts']}</td>
<td class="{$bgcolor}" align="right" style="white-space: nowrap">{$lastpost}</td>
</tr>
(2015-10-14, 12:12 PM)SvePu Wrote: [ -> ]I fixed that problem with forum read status and made a pull request on Github.
=> https://github.com/EthanDelong/MyForumIcons/pull/2

Thanks.
Just overwrite your inc/pliguns/myforumicon.php file with below code.

<?php
	/*
	 *	MyForumIcons
	 *	Created by Ethan DeLong
	 *
	 *	- File: "{$mybb->settings['bburl']}/inc/plugins/myforumicons.php"
	 *
	 *  This plugin and its contents are free for use.
	 *
	 *	Like pokemon? Check out http://www.pokemonforum.org/
	 */
	 
	// Admin settings injection
	$plugins->add_hook("admin_formcontainer_output_row", "myforumicons_admin_settings");
	$plugins->add_hook("admin_forum_management_add_commit", "myforumicons_admin_settings_save");
	$plugins->add_hook("admin_forum_management_edit", "myforumicons_admin_settings_save");
	// Inject creation of forum row.
	$plugins->add_hook("build_forumbits_forum", "myforumicons_display_icons");
	$plugins->add_hook("global_start", "myforumicons_css");
	function myforumicons_info()
	{
		return array(
			'name'			=> 'MyForumIcons',
			'description'	=> 'Lets you implement custom icons for your forums.',
			'website'		=> 'http://www.pokemonforum.org',
			'author'		=> 'Ethan',
			'authorsite'	=> 'http://www.pokemonforum.org',
			'version'		=> '1.00',
			'guid'			=> '',
			'compatibility' => '18*'
		);
	}
	function myforumicons_install()
	{
		global $db;
		$db->add_column('forums', 'myforumicons_icon', 'TEXT NOT NULL');
	}
	function myforumicons_is_installed()
	{
		global $db;
		return $db->field_exists('myforumicons_icon', 'forums');
	}
	function myforumicons_uninstall()
	{
		global $db;
		$db->drop_column('forums', 'myforumicons_icon');
	}
	function myforumicons_activate()
	{
		require_once MYBB_ROOT."inc/adminfunctions_templates.php";
		find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote("id=\"mark_read_{\$forum['fid']}\"></span>")."#i", "id=\"mark_read_{\$forum['fid']}\" {\$forum['myforumicon_override']}>{\$forum['myforumicon']}</span>");
		find_replace_templatesets("headerinclude", '#{\$stylesheets}(\r?)\n#', "{\$stylesheets}\n{\$forumicon_css}\n");
	}
	function myforumicons_deactivate()
	{
		require_once MYBB_ROOT."inc/adminfunctions_templates.php";
		find_replace_templatesets("forumbit_depth2_forum", "#".preg_quote(" {\$forum['myforumicon_override']}></span>{\$forum['myforumicon']}")."#i", "></span>");
		find_replace_templatesets("headerinclude", '#{\$forumicon_css}(\r?)\n#', "", 0);
	}
	function myforumicons_display_icons($forum)
	{
		global $theme;
		if(!empty($forum['myforumicons_icon']))
		{
			$icon_path = str_replace("{theme}", $theme['imgdir'], $forum['myforumicons_icon']);
			if (@getimagesize($icon_path))
			{
				list($width, $height, $type, $width_height) = getimagesize($icon_path);
				$forum['myforumicon_override'] = ' style="background-image:none;width:'.$width.'px;height:'.$height.'px;"';
				$forum['myforumicon'] = "<img class=\"forumicon\" {$width_height} src=\"{$icon_path}\" alt=\"{$forum['name']}\" />";
			}
		}
		return $forum;
	}
	function myforumicons_css()
	{	
		global $forumicon_css;
		
		$forumicon_css = "";
		if(my_strpos($_SERVER['PHP_SELF'], 'index.php') || my_strpos($_SERVER['PHP_SELF'], 'forumdisplay.php'))
		{
			$forumicon_css = "<style type=\"text/css\">.forum_status.forum_on img.forumicon {opacity: 1}.forum_status.forum_off img.forumicon {opacity: .5}</style>";
		}
	}
		
	function myforumicons_admin_settings(&$pluginargs)
	{
		global $form, $form_container, $forum_data, $lang, $mybb;
		
		if($mybb->input['module'] == 'forum-management')
		{
			if($pluginargs['title'] == $lang->display_order)
			{
				$lang->load('forum_management_myforumicons');
				$form_container->output_row($lang->forum_icons, $lang->forum_icons_desc, $form->generate_text_box('myforumicons_icon', $forum_data['myforumicons_icon'], array('id' => 'myforumicons_icon')));
			}
		}
	}
	function myforumicons_admin_settings_save()
	{
		global $db, $fid, $mybb;
		
		if($mybb->request_method == "post")
		{
			$db->update_query("forums", array("myforumicons_icon" => $db->escape_string($mybb->input['myforumicons_icon'])), "fid='{$fid}'");
		}
	}
?>
@SvePu - do you plan any release with font awesome support instead of images? It would be really useful
Thanks.
Yes even i had the same problem, with default Mybb theme it works but if we use different theme then icons wont show.

also, is there any font awesome version of this plugin ?

for font awesome you can refer this thread: http://community.mybb.com/thread-156711-...pid1206486

I like the user interface of this plugin, author did a nice job, we can use any image with ease.But using images is bit resource hungry and may affect forum load time (depending on server hardware). anybody got a font awesome version of this plugin ? with fading of read / unread post . Yep!

Sometime's i really wonder there are so many things MyBb should include in its core. We have to struggle so much for basic things / features and asking it to community for same feels very odd all the time. its like begging Sad sorry but i had to use that word.
You need to customize the code slightly for fontawesome. Nothing difficult, google helps you
(2016-02-01, 12:41 PM)Eldenroot Wrote: [ -> ]You need to customize the code slightly for fontawesome. Nothing difficult, google helps you

To be frank i'm tired @ Eldenroot of all the edit's   Undecided
Who isnt Smile still better than wait for somebody with that knowledge for things which can be easily done by yourself. I think it would be much faster and you may learn something new Smile
Pages: 1 2 3 4 5 6 7 8