News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Need some help with a quick feature

Started by 3mrhythm, March 22, 2011, 09:51:06 PM

Previous topic - Next topic

3mrhythm

my forum is www.nhfragswap.com/forum

the theme is darkmark

i would love to be able to change the regular PM buttom  to a PM button with a exclaimation or something on it when there is a new message. I posted in the theme builders support thread a long time ago and never got a response.. figured someone might have an idea of how i can make this happen :)


so essentially

no new messages = regular icon on menu bar

new messages = new image on menu bar (same image but with "new" or excalimation point or something


I can handle doing the images just fine i just need the snippet of code for the  theme.

Thanks!

willng to pay $10 paypal for a working code :)
www.nhfragswap.com
www.yariscentral.com

Illori

#1
is this a free or a paid theme? if free please provide a link to download it. if paid you will likely get no support here on changes as you paid for that when you bought the theme.


$context['menu_buttons'][$current_action]['active_button'] = true;

if (!$user_info['is_guest'] && $context['user']['unread_messages'] > 0 && isset($context['menu_buttons']['pm']))
{
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . ' [' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' [<strong>' . $context['user']['unread_messages'] . '</strong>]';
}


this is in Subs.php, so it is a core feature, looks like your theme edits/removes this function.


3mrhythm

installed packages


1.    Tapatalk SMF 2.0 RC3 Plugin    1.3.0    
2.    Aeva Media    1.3a
3.    Share This Topic    2.5.1    
4.    Ad Managment    2.3.6.4    
5.    SMF Trader System    1.5    
6.    Menu Buttons    1.1    
7.    Welcome Topic Mod    2.1
8.    Facebook_Like v.1.4    1.4    
9.    Aeva Media    1.4c
www.nhfragswap.com
www.yariscentral.com

3mrhythm

www.nhfragswap.com
www.yariscentral.com

Illori

please do not bump within 24 hours, we are all volunteers. when and if we know the answer we will reply.

MLM

#6
If you are talking about your nav bar do this:

index.template.php

FIND (select the whole foreach. Curly bracket { to curly bracket })

foreach ($context['menu_buttons'] as $act => $button)
{

}


REPLACE WITH:

foreach ($context['menu_buttons'] as $act => $button)
{
if($context['user']['messages'] != 1 && $button['title'] == "My Messages")
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '2.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}
else
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}
}


Then make pm2.png as what you want the image to be when you have a new message... put the image in (name of theme)/images/english/

Same diminsions as this:

My Themes:

My Mods:

Unsolved Threads:
  • None atm...

3mrhythm

#7
foreach ($context['menu_buttons'] as $act => $button)
if($context['user']['messages'] != 1 && $button['title'] == "My Messages")
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '2.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}
else
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}


echo '
</ul>
</div>';

}


this is what i had to put so that the bottom smf and powered by stuff didnt stack under the nav bar.  the only issue thus far is it shows pm2 when there are no messages
www.nhfragswap.com
www.yariscentral.com

MLM

try:


foreach ($context['menu_buttons'] as $act => $button)
{
if($context['user']['unread_messages'] >= 1 && $button['title'] == "My Messages")
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '2.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}
else
{
echo '<li><a href="', $button['href'], '" class="kwick opt1">', $settings['use_image_buttons'] ? '<img src="' . $settings['lang_images_url'] . '/' . $act . '.png" alt="' . $button['title'] . '" border="0" />' : $button['title'], '</a></li>', !empty($button['is_last']) ? '' : $context['menu_separator'];
}
}



My Themes:

My Mods:

Unsolved Threads:
  • None atm...

3mrhythm

its calling for the images backwards.. I  just renamed them :) and the problem  solved.

thanks!

whats ur paypal?
www.nhfragswap.com
www.yariscentral.com

MLM


My Themes:

My Mods:

Unsolved Threads:
  • None atm...

Advertisement: