Technical Details
Forum version : #phpBB2
Position : Founder
Concerned browser(s) : Mozilla Firefox, Google Chrome, Internet Explorer, Opera, Safari
Screenshot of problem : http://prntscr.com/fwsn40
Who the problem concerns : All members
When the problem appeared : Today
Forum link : http://www.canvastutorials.org/
Description of problem
So I used the following code on my forum:- Code:
<ul id="staff_widget">
</ul><script type="text/javascript">
/*
* CĂłdigo: Widget staff online
* Criado no dia: 18/07/2014
* Ăltima atualização: 15/07/2017
* Feito por: Daemon
* Não distribuir, ou remover os créditos do autor
*/
jQuery(document).on("ready", function() {
var staffWidget = jQuery("#staff_widget"); // VariĂĄvel que captura o id do elemento staff_widget
storedValue = sessionStorage.getItem("online_staff");
(storedValue) ? staffWidget.html(storedValue) : staffOnline();
setInterval(function() {
sessionStorage.removeItem("online_staff");
staffOnline();
}, 180000); // staffOnline function, reload every 3 minutes
function staffOnline() {
var staff = {
"Administrator": "4C94FF",
"Community Manager": "00F0AC",
"Content Coordinator": "E38800"
};
jQuery.ajax({
type: "GET",
url: "/viewonline",
beforeSend: function() {
staffWidget.html("Loading...");
},
success: function(data) {
staffWidget.html("");
var table = jQuery(".table, .table1, .ipbtable, .three-col .forumline", data); // PunBB, PHPBB3, Invision, PHPBB2
var staffColor;
jQuery.each(staff, function(group, color) {
staffColor = table.find("span[style*='" + color + "']");
if (staffColor.length) {
var elStaff, userLink, userId, avatarSrc;
staffColor.each(function() {
elStaff = jQuery(this).parent().prop("outerHTML");
userLink = jQuery(elStaff).attr("href");
userId = userLink.split("/u")[1];
jQuery.get(userLink, function(e) {
avatarSrc = jQuery("#profile-advanced-right .module:eq(0) img:eq(0), .forumline td.row1.gensmall:first img:eq(0)", e).attr("src"); // PunBB, PHPBB3, Invision, PHPBB2
staffWidget.append(
"<li class='online_staff clearfix'>" +
" <div class='div-icon-staff'>" +
" <div class='staff-avatar'><img src='" + avatarSrc + "' alt='avatar'></div>" +
" </div>" +
" <div class='div-main-staff'>" +
" <div class='staff-name'>" + elStaff + "</div>" +
" <p class='staff-rank'>" + group + "</p>" +
" </div>" +
"</li>"
);
sessionStorage.setItem("online_staff", staffWidget.html());
});
});
}
});
},
error: function(jqXhr, textStatus, errorThrown) {
console.log(errorThrown);
}
});
}
});
</script><style type="text/css">
ul#staff_widget { margin-left: 0!important; padding-left: 0!important; }
#staff_widget:empty:before {
content: "There is no staff online!";
}
#staff_widget .online_staff {
display: block;
font-size: 14px;
padding: 1px 0;
zoom: 1;
}
#staff_widget .div-icon-staff {
width: 25px;
min-width: 25px;
padding: 0 3px;
}
#staff_widget .div-icon-staff, #staff_widget .div-main-staff {
display: table-cell;
padding: 0 3px;
vertical-align: top;
}
#staff_widget .staff-avatar {
background: #fff;
vertical-align: middle;
display: inline-block;
line-height: 1px;
position: relative;
margin: 2px;
border-radius: 100%;
}
#staff_widget .staff-avatar img {
width: 34px;
height: 34px;
border: 1px solid #ddd;
border-radius: 100%;
}
#staff_widget .staff-mp {
display: inline-block;
float: right;
margin-right: -25px;
}
#staff_widget .staff-rank {
color: rgb(150, 150, 150);
margin-top: 5px;
}
#left td.catLeft {
border-bottom: solid 1px #2f2f2f;
box-shadow: 0 1px 0 #0e0e0e;
text-transform: uppercase; }
.module-title { text-align: left; }
</style>
Everything works fine and I managed to alter the styling to my liking, but for some reason it shows the Staff name as "Valoish" for 2 different users.. (Refer to screenshot).
The user with the mint coloered picture should be "Pantone" and the pink colored picture should be "Valoish"
I'm assuming the issue is coming from this line in the coding
- Code:
" <div class='staff-name'>" + elStaff + "</div>" +
Last edited by Valoish on July 18th 2017, 5:51 pm; edited 1 time in total