Osclass Support Forums

General osclass questions => Plugins => Topic started by: Aleš Tomažič on November 28, 2022, 07:39:28 PM

Title: Instant Messenger Plugin - How to show message count
Post by: Aleš Tomažič on November 28, 2022, 07:39:28 PM
Hi, can someone help me out. I want to make custom menu in header for Instant Messenger, and i managed to get uniform resource locator but i can't figure out, how to get message count. I i've tried this <?php echo $message_count; ?>, but for some reason it doesn't work. What did I missed?
Title: Re: Instant Messenger Plugin - How to show message count
Post by: mwindey on November 29, 2022, 04:13:00 PM
Try...
Code: [Select]
<?php if($mes_counter 0) { ?>
<span class="counter"><?php echo $mes_counter?></span>
<?php ?>   
Title: Re: Instant Messenger Plugin - How to show message count
Post by: MB Themes on November 29, 2022, 05:49:25 PM
@mwindey
You miss most important part :)

Code: [Select]
  $message_count = 0;
  if(function_exists('im_messages')) {
    if(osc_is_web_user_logged_in()) {
      $message_count = ModelIM::newInstance()->countMessagesByUserId( osc_logged_user_id() );
      $message_count = $message_count['i_count'];
    }
  }
Title: Re: Instant Messenger Plugin - How to show message count
Post by: Aleš Tomažič on November 29, 2022, 07:05:13 PM
Hi
 
I want to express my gratitude to both of you, it's working perfectly  :-* :-* :-*.

Thank you.
Title: Re: Instant Messenger Plugin - How to show message count
Post by: mwindey on November 30, 2022, 06:19:15 PM
@MB Themes

Sorry i forgot about that part  :D

@: Aleš Tomažič

Glad to hear we could help you out ..... :P