Advertisement:

Author Topic: silly lightweight PM notification adjustment [2.0.15]  (Read 429 times)

Offline drewactual

  • Full Member
  • ***
  • Posts: 618
    • College Football Fan Site CFB51
silly lightweight PM notification adjustment [2.0.15]
« on: July 07, 2019, 03:59:40 AM »
as much as i like some of the alert systems out there both premium and freely available in the mod sets, i simply don't want to bog the page anymore than i have to... this is SO simple i don't know why i've not done it prior. 

in your sources/subs.php, find:
Code: [Select]
$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>]';


replace with:
Code: [Select]
$context['menu_buttons']['pm']['alttitle'] = $context['menu_buttons']['pm']['title'] . '[' . $context['user']['unread_messages'] . ']';
$context['menu_buttons']['pm']['title'] .= ' <span class="pmz-noty">' . $context['user']['unread_messages'] . '</span> ';

in your theme's CSS file, add something like this at the bottom; adjust as you see fit:
Code: [Select]
#button_pm .pmz-noty{background:red;border:1px solid #fff;border-radius:100%;padding:3px 6px;color:#fff;font-weight:700;text-align:center}


here is the product on my page in action.. you can tool the CSS however you want, but the point is it jumps out so users don't miss messages and it creates zero additional load (js) on a page....

« Last Edit: July 07, 2019, 07:11:07 AM by drewactual »

Online SychO

  • Lead Customizer
  • Sophist Member
  • *
  • Posts: 1,274
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #1 on: July 09, 2019, 08:08:48 AM »
Simple and effective :)

Imazighen

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,127
  • Gender: Male
    • i30 Owners Club
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #2 on: July 09, 2019, 08:31:43 AM »
It looks great on Crip's BlackBox theme

Offline vbgamer45

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 21,298
    • smfhacks on Facebook
    • VBGAMER45 on GitHub
    • @createaforum on Twitter
    • SMF For Free
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #3 on: July 09, 2019, 08:46:04 AM »
Nice tip!
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Offline GigaWatt

  • The Smiley Guy
  • Support Specialist
  • SMF Hero
  • *
  • Posts: 2,027
  • Gender: Male
    • Macedonian electronics forum
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #4 on: July 09, 2019, 06:41:53 PM »
Yeah, thanks for the tip ;).
"This is really a generic concept about human thinking - when faced with large tasks we're naturally inclined to try to break them down into a bunch of smaller tasks that together make up the whole."

"A 500 error loosely translates to the webserver saying, "WTF?"..."

Offline Rock Lee

  • Native Language Support Specialist
  • SMF Hero
  • *
  • Posts: 2,649
  • Gender: Male
  • I also speak english :D
    • BomberCode.Oficial on Facebook
    • RockLee-BC on GitHub
    • @Bomber_Code on Twitter
    • Bomber Code ~ La nueva era del conocimiento
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #5 on: Yesterday at 12:22:33 PM »
simple and direct, as I like it :).


Regards!
¡Regresando como cual Fenix! ~ Bomber Code © 2018
Ayudas - Aportes - Tutoriales - Y mucho mas!!!


Ayudame via PayPal

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,250
  • Master of BBC Abuse
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #6 on: Yesterday at 07:09:06 PM »
Nice touch. I remember doing something similar years ago in a bit of custom theming, and I always rather liked the effect. From memory, I used relative positioning on the parent element and absolute on the span, to position it above the menu links as its own little pop-up. There are umpteen ways you can style the thing and most of them are pretty easy to arrange. :)

I'm surprised someone hasn't turned this into a mod before now. The Subs.php edit is really basic and unlikely to ever break anything.

Offline Diego Andrés

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,146
  • Gender: Male
  • We know, we'll be coming
    • MeTiroAtuTia on GitHub
    • @bihgetter on Twitter
    • SMF Tricks - Free & Premium Themes
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #7 on: Yesterday at 08:01:58 PM »
Simple and useful.

Also as a detail, I believe it shouldn't be necessary to replace the <strong> tag since the only appearance of those in the menu is precisely for those numbers (PM's, reports and other stuff depending on a few mods available like DevCenter for errors log in Admin button). So could just play around with the strong tag along with the menu classes.

Regards :P

SMF Tricks - Free & Premium Responsive Themes for SMF.

Offline drewactual

  • Full Member
  • ***
  • Posts: 618
    • College Football Fan Site CFB51
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #8 on: Yesterday at 09:13:42 PM »
yeah, the 'strong' tag 'can' be manipulated for that div id (button_pm) and avoid the subs.php edit altogether, but.... it's not clean or valid, which means a browser can stop honoring it at any point or a browser may just ignore it as it is right now just to honor it the next time... it can certainly be left in the strong tag, but wrapping it in a class harms nothing yet allows whatever css to be applied that meets the need of the user- square, transparent, float or anchored.... it can even be given an absolute and/or fixed and a z-index above other elements an staying on the screen (upper right, let's say) just so you KNOW it is seen by the user...

i think the point is to just get it into a class where the user can manipulate it at will and with ease, and that is valid. 

i'm happy others can take this and use it- it is SO silly a little thing it should have been done a long time ago and addressed by many.  at least i should have done it on my own pages a long time ago... it's one of those things that easily fall off the radar, ya know?

Offline Antechinus

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 24,250
  • Master of BBC Abuse
Re: silly lightweight PM notification adjustment [2.0.15]
« Reply #9 on: Today at 12:26:35 AM »
There's nothing wrong with using the strong tag. It's perfectly valid HTML, and no browser is likely to stop recognising it in the foreseeable future. A class isn't strictly necessary, and the lack of one doesn't stop you styling the tag any way you like. Obviously you'd have to declare display: block; for some styling options, but that's fine.

By using descendants you could easily target the CSS to the PM button even if there were other strong tags floating around. Slightly less efficient in terms of CSS processing, but slightly more efficient in terms of HTML. For this example nobody is ever likely to notice the difference even if they are benchmarking nuts.

The strong tag isn't bound to bold text or to being an inline element. It's just meant to indicate text that should have attention paid to it, which is ideal for this use case. Within reason you can pretty much use it however you like without any browser or semantics nerd throwing a wobbly over it. So if someone wants to use the same idea without editing Subs.php there's nothing to stop them doing it.