Controlling the Chatbox: Group based access.
3 posters
Page 1 of 1
Controlling the Chatbox: Group based access.
Hey!
I'm sorry I've been posting so many tough questions, requests and challenges lately, but I wanna do this right this time... Conformity and unity all the way!
I've got a question about chat. I'm using AWC, but I think that won't matter trying to solve this: I'm looking for a way, based on group membership, to control who's able to enter chat and who's not, regardless of bans and so on AND automatically after X posts. I want to apply this to the premium membership still to be set up on my board.
Thanks!
I'm sorry I've been posting so many tough questions, requests and challenges lately, but I wanna do this right this time... Conformity and unity all the way!
I've got a question about chat. I'm using AWC, but I think that won't matter trying to solve this: I'm looking for a way, based on group membership, to control who's able to enter chat and who's not, regardless of bans and so on AND automatically after X posts. I want to apply this to the premium membership still to be set up on my board.
Thanks!
Guest- Guest
Re: Controlling the Chatbox: Group based access.
Hello Samantha,
As far as I know, even if you do block the chatbox on the index / forum they can still access it by /chatbox. e.g. https://help.forumotion.com/chatbox
If you're going by automatic access I'd recommend a condition based on posts. For example :
As far as I know, even if you do block the chatbox on the index / forum they can still access it by /chatbox. e.g. https://help.forumotion.com/chatbox
If you're going by automatic access I'd recommend a condition based on posts. For example :
- Code:
if (_userdata.user_posts >= 100) initChat();
Re: Controlling the Chatbox: Group based access.
Should that code go into a separate JS?
If I remember well, I've got this CSS code to hide the main chatbox:
Would that make any difference?
If I remember well, I've got this CSS code to hide the main chatbox:
- Code:
/**** AWC HIDE FULL CHATBOX ****/
body.chatbox {visibility: hidden;}
#chatbox {display: none;}
p.page-bottom + .h3, p.page-bottom + .h3 + div.page-bottom, #chatbox_popup {display: none;}
/**** END AWC HIDE FULL CHATBOX ****/
Would that make any difference?
Guest- Guest
Re: Controlling the Chatbox: Group based access.
That'll work for those that don't know how to use developer tools. What are you using for the chat ?
Re: Controlling the Chatbox: Group based access.
Ange Tuteur wrote:That'll work for those that don't know how to use developer tools. What are you using for the chat ?
AWC if that's what you meant. But I opened a ticket on LG's forum for having the main (default) replaced on a different tab by his. He's still got to answer that on avacweb.com. Meanwhile, I'm looking for a way to have total control of who's got permission to enter chat and who's not.
To me, being able to access a chatbox is like having earned a privilege, not a standard common thingy.
Twisted Mods, you and I got some real hours into this and I wanna make this work!
Guest- Guest
Re: Controlling the Chatbox: Group based access.
how do you want to let people view i mean ..after 100 post you can use the chat or you put in each user you want to be able to use the chat or groups
Re: Controlling the Chatbox: Group based access.
If you want to choose how the chat displays for, that being the button, wrap your chat code with one of the following. It should work.
Choose who enters by user ID :
Access to chat granted if userposts are greater than or equal to 100 :
Choose who enters by user ID :
- Code:
$(function() {
var allowed = [1,2,3,4,5],i;
for (i=0; i<allowed.length; i++) {
if (_userdata.user_id == allowed[i]) {
// CONTENT HERE
}
}
});
Access to chat granted if userposts are greater than or equal to 100 :
- Code:
$(function() {
if (_userdata.user_posts >= 100) {
// CONTENT HERE
}
});
Re: Controlling the Chatbox: Group based access.
_Twisted_Mods_ wrote:how do you want to let people view i mean ..after 100 post you can use the chat or you put in each user you want to be able to use the chat or groups
Well I can only define certain groups in the navbar for instance. I can't apply another group for them to be able to see the chatbox button, so... I thought, perhaps based on something, like X # of posts or related to maybe something else it might.
Guest- Guest
Re: Controlling the Chatbox: Group based access.
Ange Tuteur wrote:If you want to choose how the chat displays for, that being the button, wrap your chat code with one of the following. It should work.
Choose who enters by user ID :allowed is an array of user IDs. Insert the ID of the users you permit to use the chat, separated by commas of course.
- Code:
$(function() {
var allowed = [1,2,3,4,5],i;
for (i=0; i<allowed.length; i++) {
if (_userdata.user_id == allowed[i]) {
// CONTENT HERE
}
}
});
Access to chat granted if userposts are greater than or equal to 100 :Change 100 to the amount of posts you want.
- Code:
$(function() {
if (_userdata.user_posts >= 100) {
// CONTENT HERE
}
});
I think that might be exactly it. Is that the navbar chatbox button? And what's CONTENT HERE?
Guest- Guest
Re: Controlling the Chatbox: Group based access.
No idea, those are just empty conditions I wrote.
Whatever script you're using for the chat you can put in there and it should only execute if the condition is met.
Whatever script you're using for the chat you can put in there and it should only execute if the condition is met.
Re: Controlling the Chatbox: Group based access.
Ange Tuteur wrote:No idea, those are just empty conditions I wrote.
Whatever script you're using for the chat you can put in there and it should only execute if the condition is met.
Well, I'm the worst scripter ever. So, let me be absolutely clear on this. Your JS goes into my JS somewhere here? Like being merged?
- Code:
// **** AWC 1.9.1 CONFIG ****//
var avacweb_chat_config = {
version : '1-9-1',
new_chat_title : 'Friendcodes Live Chatbox',
stylesheet : 'http://chat.avacweb.net/avacweb_chat_2.css',
allow_private_messaging : 1,
allow_user_resize : 1,
allow_appear_offline : 0,
commands : {},
custom_placement : null,
can_open_tabs : [1],
disable_timeout : 1,
tabs : {"Nintendo" : ['Admin', 'Samantha', '_Twisted_Mods_', 'SuperSmashBros', 'FreeHugs'],"Sony" : ['Admin', 'Samantha', '_Twisted_Mods_', 'SuperSmashBros', 'FreeHugs'],"Microsoft" : ['Admin', 'Samantha', '_Twisted_Mods_', 'SuperSmashBros', 'FreeHugs'],"PC" : ['Admin', 'Samantha', '_Twisted_Mods_', 'SuperSmashBros', 'FreeHugs'],"Beheerders" : ['Admin', 'Samantha', '_Twisted_Mods_', 'SuperSmashBros', 'FreeHugs']},
allow_copyrights : 1, //please be kind and allow AWC to place small discreet copyrights and backlink on your forum.
// DO NOT TOUCH ANYTHING BELOW
message_hook:[],user_hook:[],events:{},add_event:function(t,f) {t in this.events?this.events[t].push(f):this.events[t]=[f]}};
document.write('<script type="text/javascript" src="http://chat.avacweb.net/v' + avacweb_chat_config.version + '.js" id="achat_script"></sc' + 'ript>');
//**** END AWC 1.9.1 CONFIG **** //
//**** HIDE THE MAIN CHATBOX ****//
avacweb_chat_config.add_event('onload', function() {
avacweb_chat.id('chatbox').style.display = 'block';
});
//**** END HIDE THE MAIN CHATBOX ****//
//**** ANIMATION ON AWC OPEN AND CLOSE ****//
avacweb_chat_config.add_event('onopen', function(e) {
e.preventDefault();
$('#avacweb_chat').slideDown();
avacweb_chat.button.style.backgroundColor = '';
});
avacweb_chat_config.add_event('onclose', function(e) {
e.preventDefault();
$('#avacweb_chat').slideUp();
});
//**** END ANIMATION ON AWC OPEN AND CLOSE ****//
//**** ADD SOUND TO AWC ****//
(function(awc){
awc.add_event('onload', function() {
this.settings.add('sound', 1, true).add_ui('sound');
$('body').append('<span id="achat_sound"></span>');
});
awc.add_event('onnew', function() {
var sound_file = 'http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3'; //change this URL to your own sound file if you want
if( this.settings.on('sound') ) {
document.getElementById('achat_sound').innerHTML = '<embed src="' + sound_file + '" hidden="true" autostart="true" loop="false"/>';
}
});
})(avacweb_chat_config);
//**** END ADD SOUND TO AWC ****//
//**** WELCOME MESSAGE ****//
avacweb_chat_config.add_event('onlogin', function(e) {
if( !this.cookie('intro') ) { //using avacweb_chat's built in cookie function.
this.popup('Welkom in de Friendcodes Live ChatBox. Een lijst met chatbox commando\'s is beshikbaar door /cmd in de berichtenbalk in te typen.
Veel plezier!');
this.cookie('intro', true);
}
});
//**** END WELCOME MESSAGE ****//
//**** CONFIRM LOGOUT ****//
avacweb_chat_config.add_event('onlogout', function(e) {
if( !this.skip_confirm && !confirm('Weet je zeker dat je je chatsessie wilt sluiten?') ) {
e.preventDefault();
}
document.getElementById('achat_sound').innerHTML = '<embed src="http://www.mariomayhem.com/downloads/sounds/super_mario_bros/smb_gameover.wav" hidden="true" autostart="true" loop="false" />';
this.skip_confirm = false;
if( avacweb_chat.settings.on('open') ) avacweb_chat.settings.toggle('open');
});
//**** END CONFIRM LOGOUT ****//
//**** REPLACE THE ADD SYMBOL ****//
avacweb_chat_config.message_hook.push(function(row, username, user_id, user) {
user.innerHTML = user.innerHTML.replace(/@(?=\W)/, '✰ '); //perform @ replacement
});
avacweb_chat_config.user_hook.push(function(row, username, user_id) {
var u = row.getElementsByTagName('a')[0];
if(u) u.innerHTML = u.innerHTML.replace(/@(?=\W)/, '✰ '); //perform @ replacement
});
//**** END REPLACE THE ADD SYMBOL ****//
//**** CHANGE AWAY COLOR ****//
(function(awc){
awc.add_event('onload', function() {
avacweb_chat.away_list = {};
});
awc.user_hook.push(function(row, username, userid) {
var away_list = $('.away', avacweb_chat.id('chatbox_members'))[0], id = 'u' + userid;
if(away_list && away_list.nextSibling.innerHTML.indexOf(row.innerHTML) !== -1) {
avacweb_chat.away_list[id] = 1;
row.getElementsByTagName('a')[0].className = 'away-user';
}
else {
delete avacweb_chat.away_list[id];
}
});
awc.message_hook.push(function(row, username, uid) {
if('u' + uid in avacweb_chat.away_list) {
row.getElementsByTagName('a')[0].className = 'away-user';
}
});
})(avacweb_chat_config);
//**** END CHANGE AWAY COLOR ****//
//**** CHANGE RIGHT CLICK TO LEFT CLICK FOR USER MENU **** //
avacweb_chat_config.user_hook.push(function(row) {
var l = row.getElementsByTagName('a')[0];
if(l) {
l.setAttribute('onclick', 'if(event) event.preventDefault(); ' + l.getAttribute('oncontextmenu'));
l.removeAttribute('oncontextmenu');
}
});
//**** CHANGE RIGHT CLICK TO LEFT CLICK FOR USER MENU ****//
//**** READING MODE NOTIFY ****//
avacweb_chat_config.add_event('onsettingchange', function(e) {
if(e.data === 'reading') {
this.send_message('/me ' + this.t( this.settings.on('reading') ? 'has entered reading mode' : 'has exited reading mode' ) );
}
});
//**** END READING MODE NOTIFY ****//
//**** MEMBER LIST TOGGLER ****//
avacweb_chat_config.add_event('onload', function () {
$(avacweb_chat.id('achat_color_button')).after('<div class="achat_button" id="toggle_members">Close List</div>');
var members = $(avacweb_chat.id('chatbox_members'));
var chatbox = $(avacweb_chat.id('chatbox'));
var toggle = $(avacweb_chat.id('toggle_members'));
toggle.toggle(function() {
members.stop().animate({left:-181},1000);
chatbox.stop().animate({left:0},1000);
toggle.html('Open List');
},
function() {
members.stop().animate({left:0},1000);
chatbox.stop().animate({left:181},1000);
toggle.html('Close List');
});
});
//**** END MEMBER LIST TOGGLER ****//
//**** WORD CENSOR ****//
avacweb_chat_config.message_hook.push(function(row, username, user_id, user, msg) {
var censored = ['idiot', 'stupid', 'loser']; //add more words here
msg.innerHTML = msg.innerHTML.replace(RegExp('\\b(' + censored.join('|') + ')\\b', 'gi'), '[CENSORED]');
});
//**** END WORD CENSOR ****//
//**** STOP SPAMMING ****//
avacweb_chat_config.add_event('onsend', function(e) {
if(!avacweb_chat.spam_check) {
avacweb_chat.spam_check = [];
}
var message = e.data, i = 0, x, spam_limit = 5;
if( avacweb_chat.spam_check.push(message) > spam_limit ) {
avacweb_chat.spam_check.shift();
}
for( ; (message === avacweb_chat.spam_check[i++]); );
if(i > spam_limit) {
avacweb_chat.skip_confirm = true;
avacweb_chat.login(1); //log the user out.
}
});
//**** END OF STOP SPAMMING ****//
//**** POKE SYSTEM ****//
(function(awc) {
('Avacweb chat Plug in Poke System');
//add the poke command.
awc.commands.poke = {
description: '/poke username - Poke a user in the chatbox to get their attention.',
run : function(msg) {
var uid = avacweb_chat.get_user_data(msg).id;
if(!uid) {
avacweb_chat.popup(msg + ' ' + avacweb_chat.t('is not in the chat'));
return false;
}
return '[table class="achat_poke" rel="' + uid + '"][tr][td][/td][/tr][/table]';
}
};
awc.message_hook.push(function(row, username, user_id) {
var poke = $('.achat_poke', row)[0]
, ac = avacweb_chat;
if(poke) {
var poker = parseInt(user_id)
, poked = parseInt(poke.getAttribute('rel'))
, time = $('.date-and-time', row)[0].innerHTML;
if(!ac.user('id') || !poker || !poked) {
return row.innerHTML = '';
}
//if we are being poked...
if(poked === ac.user('id')) {
if( !ac.pokes[time] ) {
ac.pokes[time] = 1;
document.title = username + ' ' + ac.t('Poked You') + '!';
$('body').append('<embed src="http://www.freesfx.co.uk/rx2/mp3s/2/1305_1256857800.mp3" hidden="true" autostart="true" loop="false" />');
//save the pokes.
JSON && ac.cookie('pokes', JSON.stringify(ac.pokes), 0);
}
row.innerHTML = '<span class="poke">' + username + ' ' + ac.t('Poked You') + '!</span>' + time;
}
else if(poker === ac.user('id')) {
row.innerHTML = '<span class="poke">' + ac.t('You poked') + ' ' + ac.get_user_data(poked).name + '.</span>' + time;
}
else {
row.innerHTML = '';
row.style.display = 'none';
}
}
});
//load the pokes.
awc.add_event('onload', function() {
avacweb_chat.pokes = {};
avacweb_chat.original_title = document.title;
var cookie = avacweb_chat.cookie('pokes');
if(cookie && JSON) {
avacweb_chat.pokes = JSON.parse(cookie);
}
});
awc.add_event('onsend', function() {
document.title = this.original_title;
});
})(avacweb_chat_config);
//**** END POKE SYSTEM ****//
//**** SYSTEM AND WARNING MESSAGE ****//
avacweb_chat_config.commands.system = {
description : '/system message - post a system message',
run : function(text) {
if(text && text.length) {
return '[table class="system-message"][tr][td]' + text + '[/td][/tr][/table]';
}
return false;
}
};
avacweb_chat_config.commands.warning = {
description : '/warning message - post a warning message',
run : function(text) {
if(text && text.length) {
return '[table class="warning-message"][tr][td]' + text + '[/td][/tr][/table]';
}
return false;
}
};
avacweb_chat_config.message_hook.push(function(row) {
var m = $('.system-message, .warning-message', row)[0];
if(m) {
var msg = m.getElementsByTagName('td')[0].innerHTML;
row.innerHTML = '<div class="' + m.className + '">' + msg + '</div>';
}
});
//**** END SYSTEM AND WARNING MESSAGE ****//
//**** PLUGIN YTVIDS ****//
avacweb_chat_config.message_hook.push(function(row, username, user_id, user, msg) {
var video = msg.children;
var regex= /embed|object/i;
for(var i =0; i<video.length;i++){
if(video[i].nodeType !== 1) continue;
if(regex.test(video[i].tagName)){
avacweb_chat.toggle_setting('reading');
cancelReading();
}
}
function cancelReading(){
avacweb_chat.id('chatbox').addEventListener('scroll', toggleSetting ,false);
}
function toggleSetting(){
avacweb_chat.toggle_setting('reading');
avacweb_chat.id('chatbox').removeEventListener('scroll', toggleSetting,false);
}
});
//**** PLUGIN YTVIDS ****//
//**** PREVENT EXTERNAL LINKS IN AWC ****//
avacweb_chat_config.message_hook.push(function(row, username, user_id, usr, msg) {
var links = msg.getElementsByTagName('a'), whitelist = [location.hostname, 'youtube', 'twitter', 'facebook', 'tinypic', 'photobucket'];
for(var i = 0, l; (l = links[i++]); ) {
if(l.href.charAt(0) !== '/' && !l.href.match(RegExp('(' + whitelist.join('|') + ')', 'i'))) {
l.href = '/';
l.innerHTML = '[External links are banned in the chatbox]';
}
}
});
//**** END PREVENT EXTERNAL LINKS IN AWC ****//
//**** AWC TRANSLATION DUTCH ****//
window.avacweb_chat_translation = {
'public' : 'Chatbox',
'log in' : 'Aanmelden',
'log out': 'Afmelden',
'chat' : 'Chatbox',
'on' : 'Aan',
'off' : 'Uit',
'close' : 'Sluit',
'smilies': 'Smilies',
'colors' : 'Kleuren',
'send' : 'Verstuur',
'archives' : 'Archief',
'message': 'Bericht',
'refresh': 'Vernieuwen',
'you are disconnected. click log in to join the chat.' : 'De verbinding met de chatbox is verbroken. Druk op Aanmelden om opnieuw verbinding te maken.',
'user options' : 'Opties',
'color' : 'Kleur',
'bold' : 'Vet',
'underline' : 'Onderstreept',
'strike' : 'Doorstreept',
'italic' : 'Schuin',
'private message' : 'Privé Bericht',
'loading smilies...' : 'Smilies laden ...',
'this command is not available or does not exist' : 'Deze opdracht bestaat niet of is niet beschikbaar',
'user not found' : 'Gebruiker niet gevonden',
'view profile' : 'Bekijk Profiel',
'send private message' : 'Verstuur PM',
'kick from chat' : 'Uit de chatbox verwijderen',
'remove from moderators' : 'Verwijderen uit de Moderators groep',
'send friend request' : 'Vriendenverzoek versturen',
'add to moderators' : 'Voeg toe als Chatbox Moderator',
'away' : 'Afwezig',
'reading' : 'Lezen',
'sound' : 'Geluid',
'merge messages' : 'Berichten combineren',
'disable timeout' : 'Timeout uitschakelen',
'newest first' : 'Nieuwste eerst'
};
//**** END AWC TRANSLATION DUTCH ****//
Guest- Guest
Re: Controlling the Chatbox: Group based access.
After looking at it, the most I can think of doing is creating a new script for one of these :
Post based access :
ID based access :
Post based access :
- Code:
$(function() {
var ac = document.getElementById('avacweb_chat_button');
ac.style.display = 'none';
if (_userdata.user_posts >= 100) ac.style.display = '';
else ac.parentNode.removeChild(ac);
});
ID based access :
- Code:
$(function() {
var allowed = [1,2,3,4,5], i, ac = document.getElementById('avacweb_chat_button');
ac.style.display = 'none';
for (i=0; i<allowed.length; i++) {
if (_userdata.user_id == allowed[i]) ac.style.display = '';
else if (i == allowed.length - 1) ac.parentNode.removeChild(ac);
}
});
Re: Controlling the Chatbox: Group based access.
to be honest with u its kinda pointless because people can just goto the /chatbox and get in no matter what you do
Re: Controlling the Chatbox: Group based access.
_Twisted_Mods_ wrote:to be honest with u its kinda pointless because people can just goto the /chatbox and get in no matter what you do
Hmm.. I see... So, if you enter the link as an URL you're still able to access it?
Last edited by SamanthaS on November 28th 2014, 6:31 am; edited 1 time in total
Guest- Guest
Re: Controlling the Chatbox: Group based access.
You can create a forum for a group that you want to see the chatbox and add the link to the chatbox in the forum. Set the permissions for that forum for the group.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
You need one post to send a PM.
When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
Re: Controlling the Chatbox: Group based access.
@_Twisted_Mods: I'm sorry. Now that I've re-read what you wrote I see I can also read it another way. At first I thought you said that "to be honest, with u its kinda pointless...", but I now see I can also read it like "to be honest with u, its kinda pointless...". I take it you meant the second, so no harm done and I edited the prior post.
@SLGray. Thanks. So then it's like a hidden forum? I know how to do that. But then still, if you know the URL you're able to access it, right? I mean like what _Twisted_Mods_ said about that.
@SLGray. Thanks. So then it's like a hidden forum? I know how to do that. But then still, if you know the URL you're able to access it, right? I mean like what _Twisted_Mods_ said about that.
Guest- Guest
Re: Controlling the Chatbox: Group based access.
there is nothing you can do your header is not in the page so you cant use javascript or css and unfortunately forumotion does not give you a option to use javascript or css on the page
Re: Controlling the Chatbox: Group based access.
Hmm.... That's the 3rd big battle I lost this week. I had such a great ideas, yk... Oh, swell... Let's have this topic closed then.
Guest- Guest
Similar topics
» Controlling Bot Access & Indexing of Pages
» How do I add a colored bar based on group?
» (Only Topic) My Forum won't open
» Post-head colour based on group colour of user
» Make a 2nd group have acp access
» How do I add a colored bar based on group?
» (Only Topic) My Forum won't open
» Post-head colour based on group colour of user
» Make a 2nd group have acp access
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum