Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Unread Uddeim messages count in...
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
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; }
}
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Unread Uddeim messages count in...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 150
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked