Census group don't working
3 posters
Page 1 of 1
Census group don't working
Technical Details
Forum version : #ModernBB
Position : Founder
Concerned browser(s) : Google Chrome
Who the problem concerns : Yourself
When the problem appeared : census group don't working
Forum link : ( link is hidden, you must reply to see )
Description of problem
Hello, I have a problem with the census script I have placed in index_body and it is not counting people for me. I will give an example I have Yokai - 0, and I would like the number 0, to be 1 after the person added, etc. That is why I am asking for help.My forum is Modernbb
HTML:
- Code:
<div class="qeel-groups">
<a href="#">Ludzie <span id="census_Ludzie" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Pradawni <span id="census_Pradawni" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="/g5-yokai">Yokai <span id="censusYokai" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Hanyou <span id="census_Hanyou" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Gobliny <span id="census_Gobliny" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Daishin <span id="census_Daishin" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">Inne Istoty <span id="census_InneIstoty" class="censusValue"><span class="censusCount">0</span></span></a>
<a href="#">NPC <span id="census_NPC" class="censusValue"><span class="censusCount">0</span></span></a></div></div>
Javascript:
- Code:
<![CDATA[
(function() {
window._faCensus = {
title : 'Group census', // main title
// syntax : 'GROUP_NAME' : 'GROUP_ID'
groups : {
'Hanyou' : 6,
'Pradawni' : 2,
'Yokai' : 5,
'Ludzie' : 4,
'Daishin' : 3,
'Gobliny' : 7,
'Inne Istoty' : 8,
'NPC' : 13
},
// get group member count from AJAX or storage
getCount : function(id, callback) {
var count = 0, pages, storage = window.localStorage;
if (storage && storage['group_count_' + id] && storage['group_count_' + id + '_exp'] > +new Date - 1*60*60*1000) callback(storage['group_count_' + id]);
else jQuery.get('/g' + id + '-?change_version=prosilver', function(d) {
count = jQuery('.forumbg-table a[href^="/u"]', d).length;
pages = jQuery('.pagination span a:not(.pag-img):last', d);
if (pages[0]) {
pages = +jQuery(pages).text();
count = count * pages;
}
if (storage) {
storage['group_count_' + id] = count;
storage['group_count_' + id + '_exp'] = +new Date;
}
callback(count);
});
}
};
var census = document.createElement('DIV'),
node = document.getElementById('censusNode'),
i,
row;
census.id = 'faCensus';
census.innerHTML = '<div id="censusMainTitle">' + _faCensus.title + '</div>';
// set content
for (i in _faCensus.groups) {
row = document.createElement('DIV');
row.innerHTML = 'loading...';
row.className = 'censusRow';
_faCensus.getCount(_faCensus.groups[i], function(count) {
row.innerHTML = '<span class="censusTitle">' + i + '</span><span id="census_' + i.replace(/\s/g, '_') + '" class="censusValue"><span class="censusCount">' + count + '</span></span>';
});
census.appendChild(row); // add the row to the census
}
censusNode.appendChild(census); // append the census to the drop point
})();
// par ange tuteur
//]]>
please help me
Last edited by Amadeus on March 11th 2021, 4:43 am; edited 1 time in total
Amadeus- Forumember
- Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland
Re: Census group don't working
skouliki wrote:hello
where did you find this code ?
I found it in one of the existing topics here on this forum.
https://help.forumotion.com/t143474-want-to-have-a-simple-census-widget-for-the-usergroups-on-my-site?highlight=census
https://help.forumotion.com/t143424-how-to-make-a-census-widget?highlight=census
Amadeus- Forumember
- Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland
Re: Census group don't working
The reason it is not working is the forum version is not the same and the code is looking for parts that don't exist on your forum version or if it does it's not named the same.
Re: Census group don't working
Ape wrote:The reason it is not working is the forum version is not the same and the code is looking for parts that don't exist on your forum version or if it does it's not named the same.
What I know, the person who modified it so much on my forum that he does not charge it at all. Can you help me please to make it work for me on modernbb please?
Amadeus- Forumember
- Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland
Re: Census group don't working
Sadly I am not a coder so I would not know where to start you maybe better off tagging the one who made the code in hope they will help.
Re: Census group don't working
Ape wrote:Sadly I am not a coder so I would not know where to start you maybe better off tagging the one who made the code in hope they will help.
After a few attempts I've grasped javascript and everything works as it should. The topic can be closed.
Amadeus- Forumember
- Posts : 157
Reputation : 1
Language : Polish, English
Location : Poland
Re: Census group don't working
Problem solved & topic archived.
|
Similar topics
» Guild census code not working
» Guild Census Widget Not Working
» Glowcode/shadowcode for a username group, not working
» im think html dont work on my templates orr i dont know because im new in forumotion
» How to Make a Census Widget
» Guild Census Widget Not Working
» Glowcode/shadowcode for a username group, not working
» im think html dont work on my templates orr i dont know because im new in forumotion
» How to Make a Census Widget
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum