Login     Sign up
Notification Color
Abhimanyu (@abhimanyusharma003)
Join date: Aug 12th 2010
Community posts: 124
View Profile
Send Message

How to change color of notification and in-box messages.

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

do you mean the number of unread notifications and unread inbox messages ? In Facebook they are white with red background.

if yes, goto includes/libs/common.inc.php

functions msg_unread and note_unread

change in both functions the line

[code]
return '<span> ('.$num.')</span>';
[/code]

174 months ago
Abhimanyu (@abhimanyusharma003)
Join date: Aug 12th 2010
Community posts: 124
View Profile
Send Message

ya i want this..
but a little problem.
This modification only changes the color of number
eg:-

Inbox[b] 3[/b]

can it done like this

[b]Inbox 3[/b]

174 months ago
Jcow Master (@falcone)
Join date: Sep 2nd 2010
Community posts: 917
View Profile
Send Message

a few changes in page.tpl.php

[code]
echo '
<td align="right">'.url('u/'.$client['uname'],$client['uname']).' | '.$friendslink.' | '.msg_unread().' | '.note_unread().' | <span class="sub">'.url('member/logout',t('Logout') ).'</span>
</td>';
[/code]

in common.inc.php

[code]
function msg_unread() {
global $client, $ubase;
if ($client['id']) {
$res = sql_query("select count(*) as num from ".tb()."messages where to_id='{$client['id']}' and from_id>0 and !hasread");
$row = sql_fetch_array($res);
$num = $row['num'];
if ($num) {
return '<span><a style="color:red" href="'.$ubase.'message">'.t('Inbox').' ('.$num.')</a></span>';
}
else {
return '<span>'.url('message',t('Inbox')).'</span>';
}
}
else {
return '<span>'.url('message',t('Inbox')).'</span>';
}
}

function note_unread() {
global $client, $ubase;
if ($client['id']) {
$res = sql_query("select count(*) as num from ".tb()."messages where to_id='{$client['id']}' and from_id=0 and !hasread");
$row = sql_fetch_array($res);
$num = $row['num'];
if ($num) {
return '<span><a style="color:red" href="'.$ubase.'notifications">'.t('Notifications').' ('.$num.')</a></span>';
}
else {
return '<span>'.url('notifications',t('Notifications')).'</span>';
}
}
else {
return '<span>'.url('notifications',t('Notifications')).'</span>';
}
}
[/code]

174 months ago
Abhimanyu (@abhimanyusharma003)
Join date: Aug 12th 2010
Community posts: 124
View Profile
Send Message

Thanks works great..!!

174 months ago
DeFender (@defender)
Join date: Oct 1st 2010
Community posts: 167
View Profile
Send Message

and how to change for friends request ? number only

174 months ago
Abhimanyu (@abhimanyusharma003)
Join date: Aug 12th 2010
Community posts: 124
View Profile
Send Message

function frd_request

[code]
return url('friends/requests',t('Friends').'<span> ('.$row['num'].')</span>'); [/code]

174 months ago
DeFender (@defender)
Join date: Oct 1st 2010
Community posts: 167
View Profile
Send Message

thank you abhimanyusharma003

174 months ago