Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

Unread Uddeim messages count in Community Buider

Unread Uddeim messages count in Community Buider

I would like to display in the Community Builder members directory list a column that indicates the number of unread Uddeim messages for each user. After x unread messages, I would like the count to start flashing red

No unread messages - green
unread messages - yellow
unread messages > X - red

Maranatha
Beginner Modder
ranks
useravatar
Offline
5 Posts
Administrator has disabled public posting

Re: Unread Uddeim messages count in Community Buider

This recipe uses MetaMod. The approach is that you will display a MetaMod module somewhere on your page e.g. a column in the directory. I assume there will be a suitable module position there for you to use.

Using some of the PHP code in the other thread (http://www.metamodpro.com/forums/topic?id=1387) you can retrieve the number of messages in the MetaMod PHP box:

Code:

$udduserid = $user->id; 

$uddsql="SELECT count(a.id) FROM #__uddeim AS a WHERE `a`.`delayed`=0 AND a.totrash=0 AND a.toread=0 AND a.toid=".(int)$udduserid;
$db->setQuery($uddsql);
$uddresult=(int)$db->loadResult();
$message = "Private Messages";
if ($uddresult > 0) $message .= " ($uddresult new)";

Then you simply need to use suitable CSS code around this message to make it green or yellow or red, and output it using an "echo" statement:

Code:

$cutoff = 10; // this number or above will flash red

if ( $uddresult == 0) $message = "<span style='color:green'>$message</span>";
if ( $uddresult > 0 and $uddresult < $cutoff ) $message = "<span style='color:green'>$message</span>";
if ( $uddresult >= $cutoff ) {
  $message = "
<!--[if lt IE 10]>
<script>
toggleItem = function(){
    var el = document.getElementsByTagName('blink')[0];
    if (el.style.display === 'block') {
        el.style.display = 'none';
    } else {
        el.style.display = 'block';
    }
}
setInterval(toggleItem, 1000);
</script>
<![endif]-->

<span style='color:red;'><blink>$message</blink></span>";

... and add the following CSS into your template's CSS file somewhere:

Code:

blink {

  -webkit-animation: blink 1s steps(5, start) infinite;
  -moz-animation:    blink 1s steps(5, start) infinite;
  -o-animation:      blink 1s steps(5, start) infinite;
  animation:         blink 1s steps(5, start) infinite;
}
@-webkit-keyframes blink {
  to { visibility: hidden; }
}
@-moz-keyframes blink {
  to { visibility: hidden; }
}
@-o-keyframes blink {
  to { visibility: hidden; }
}
@keyframes blink {
  to { visibility: hidden; }
}

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
4
User Info:
 
Total Users:
4378
Newest User:
miller2341
Members Online:
2
Guests Online:
209


Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked