MyBB Community Forums

Full Version: Need help making post icons mod-only
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm very new to myBB, it's working great so far, but I need to make a few changes.

One being, I want post icons to be mod-only.

I found where the post icon code is (Templates > Modify > posticons), but I have no clue what to do.
Is it possible to add an if statement in there, and output only of the poster is a mod? How would I do this?
Hello there

open ./newthread.php and ./newreply.php

find

if($forum['allowpicons'] != "no")
{
	$posticons = getposticons();
} 

replace with

 if($forum['allowpicons'] != "no")
{
	if(ismod($fid) == "yes")
	{
		$posticons = getposticons();
	}
}

regards
Shorter Toungue
if($forum['allowpicons'] != "no" && ismod($fid) == "yes")
{
    $posticons = getposticons();
}
Would it be possible to put that if statement into the getposticons() function in functions.php?

If not, would I have to put it into editpost.php as well as newthread and newpost?

Thanks for the help :-)
Well yeah you can put it is the function,

start the if statment
PHP Code:
if(ismod($fid) == "yes")


before

PHP Code:
����$query $db->query("SELECT * FROM ".TABLE_PREFIX."icons ORDER BY name DESC"); 

and end it after
PHP Code:
    return $posticons

in functions.php
Thank you very much =]
Dear Zaher,

Can u suggest a solution to this.....

How can we display the post icons on the index page
[ the way its shown in vb index page ]

[attached image ]
http://community.mybboard.net/attachment.php?aid=22


And ..if possible plz visit this :
http://community.mybboard.net/showthread.php?tid=16623
Im really getting crazy as my favourite Flags Mod is not working due to this.

Thank you...
[ Perhaps the thank u mod must be installed at this forum.....]
Zaher can u plz help in this ???
Mano Wrote:Dear Zaher,

Can u suggest a solution to this.....

How can we display the post icons on the index page
[ the way its shown in vb index page ]

[attached image ]
http://community.mybboard.net/attachment.php?aid=22

Open ./inc/functions_forumlist.php

find
					eval("\$lastpost = \"".$templates->get("forumbit_depth$depth$forumcat"."_lastpost")."\";");

Above it add
global $db, $cache;
					$query = $db->query("SELECT icon FROM ".TABLE_PREFIX."posts WHERE tid='".$lastpost_data['lastposttid']."' ORDER BY dateline DESC LIMIT 0,1");
					$get_icon = $db->fetch_array($query);
					$icon_cache = $cache->read("posticons");
					if($get_icon['icon'] > 0 && $icon_cache[$get_icon['icon']])
					{
						$icon = $icon_cache[$get_icon['icon']];
						$lastpost_icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />&nbsp;";
					}
					else
					{
						$lastpost_icon = "";
					}

Now in forumbit_depth2_forum_lastpost template

add
{$lastpost_icon}
Quote:And ..if possible plz visit this :
http://community.mybboard.net/showthread.php?tid=16623
Im really getting crazy as my favourite Flags Mod is not working due to this.
Are you using the plugin by me from my site?
zaher1988 Wrote:Open ./inc/functions_forumlist.php

find
					eval("\$lastpost = \"".$templates->get("forumbit_depth$depth$forumcat"."_lastpost")."\";");

Above it add
global $db, $cache;
					$query = $db->query("SELECT icon FROM ".TABLE_PREFIX."posts WHERE tid='".$lastpost_data['lastposttid']."' ORDER BY dateline DESC LIMIT 0,1");
					$get_icon = $db->fetch_array($query);
					$icon_cache = $cache->read("posticons");
					if($get_icon['icon'] > 0 && $icon_cache[$get_icon['icon']])
					{
						$icon = $icon_cache[$get_icon['icon']];
						$lastpost_icon = "<img src=\"{$icon['path']}\" alt=\"{$icon['name']}\" />&nbsp;";
					}
					else
					{
						$lastpost_icon = "";
					}

Now in forumbit_depth2_forum_lastpost template

add
{$lastpost_icon}

Well zaher it worked but.. The default icon is still showing up.
[ u may view the result here : www.forums.freewebworld.org ]
I tried removing the line <img src="{$theme['imgdir']}/post.gif" />

But that removed  the default icon from alll the topics.


What i want is that if the user selected the icon [when posting] that selected icon shoul be dispalyed [ on th index ] else if no icon was selected then the default post icon [post.gif] should be displayed.

What do i need to change ???
Pages: 1 2