Widget code help please.
3 posters
Page 1 of 1
Widget code help please.
Hey there,
I was wondering if there is any way to allow only a certain member group to view a single Widget?
For example, I wish to create a chat box (Using cbox.com) for each of my member groups where only that specific group can enter it. Whether this is by password or simply that the other member groups cannot view it entirely. Is there a way to do this? Can someone help please. I'm not too great with coding, I know only the basics.
I have researched it and I can only find a code to disallow a member group to view all of my widgets but that's not what I'm looking for.
This is my webpage: Kumari
I was wondering if there is any way to allow only a certain member group to view a single Widget?
For example, I wish to create a chat box (Using cbox.com) for each of my member groups where only that specific group can enter it. Whether this is by password or simply that the other member groups cannot view it entirely. Is there a way to do this? Can someone help please. I'm not too great with coding, I know only the basics.
I have researched it and I can only find a code to disallow a member group to view all of my widgets but that's not what I'm looking for.
This is my webpage: Kumari
Last edited by Kumari on October 18th 2014, 3:58 pm; edited 1 time in total
Re: Widget code help please.
Admin panel>Modules>Portal&widgets
choose either forum widgets or portal widgets witch ever your trying to add permission to
click structure
remove the widgets from the structure that you only want certain groups to see
now scroll down to
Addition of existing widgets < for default widgets
or
Addition/deletion of personal widgets < for custom made widgets
choose your rights to who you want to be allowed to see it and click add widget
organize the widgets back to the way you want them then click save below the widget structure
choose either forum widgets or portal widgets witch ever your trying to add permission to
click structure
remove the widgets from the structure that you only want certain groups to see
now scroll down to
Addition of existing widgets < for default widgets
or
Addition/deletion of personal widgets < for custom made widgets
choose your rights to who you want to be allowed to see it and click add widget
organize the widgets back to the way you want them then click save below the widget structure
Re: Widget code help please.
Thankyou for such a quick response, but this is not wht I am looking for. This only gives the option to allow/disallowthetwistedkilla wrote:Admin panel>Modules>Portal&widgets
choose either forum widgets or portal widgets witch ever your trying to add permission to
click structure
remove the widgets from the structure that you only want certain groups to see
now scroll down to
Addition of existing widgets < for default widgets
or
Addition/deletion of personal widgets < for custom made widgets
choose your rights to who you want to be allowed to see it and click add widget
organize the widgets back to the way you want them then click save below the widget structure
" Administrators Moderators Members Guests"
I want to allow specific member groups which I have created AKA "Nayati, Kostas" (groups taken from my site) to only view certain Widgets and was wondering if there is a code for this? Perhaps a code that allows a Widget to be password protected?
Re: Widget code help please.
i will look around see what i can figure out but think your gonna need some javascript for this.. so you will prob have to wait for ange to gets on
Re: Widget code help please.
Hello Kumari,
It's partially possible, however, protection by JavaScript(passwords) can be easily bypassed. I do have an Idea which could be useful, you would just need to supply me with what the widget contents will be.
It's partially possible, however, protection by JavaScript(passwords) can be easily bypassed. I do have an Idea which could be useful, you would just need to supply me with what the widget contents will be.
Re: Widget code help please.
ange if he has toolbar active couldn't u grab the user group the person is in
and do like
if grouptitle="admin" then
element.display=normal
else
element.display=none
and do like
if grouptitle="admin" then
element.display=normal
else
element.display=none
Re: Widget code help please.
A portion of _userdata is still accessible even if the toolbar is disabled. ^^
I was thinking something like.. :
It's for phpbb3(html), but I'll write it for phpbb2 for them when I know what they want.
I was thinking something like.. :
- Code:
<script type="text/javascript">
_widget = new Object();
_widget.allowed = ['Ange Tuteur', 'Test Dummy'];
_widget.title = 'Widget Title';
_widget.content = 'Widget Content';
</script>
<div id="theWidget" class="module" style="display:none">
<div class="inner">
<span class="corners-top"><span></span></span>
<div id="theTitle" class="h3"></div>
<span id="widgetContent"></span>
<span class="corners-bottom"><span></span></span>
</div>
</div>
<script type="text/javascript">(function() {
var allowed = false, memb = _widget.allowed;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
document.getElementById('theWidget').style.display = '';
document.getElementById('theTitle').innerHTML = _widget.title;
document.getElementById('widgetContent').innerHTML = _widget.content;
} else return;
})();</script>
It's for phpbb3(html), but I'll write it for phpbb2 for them when I know what they want.
Re: Widget code help please.
Ange Tuteur wrote:Hello Kumari,
It's partially possible, however, protection by JavaScript(passwords) can be easily bypassed. I do have an Idea which could be useful, you would just need to supply me with what the widget contents will be.
Ohhh an idea is better than none! hha We can play aroun with it as much as need be
Here is the code that will be in the widget.
It is a chatbox.
As I said before, there will be a few with some different chat boxes in, so perhaps once we work out what works, can you please mark the place where the cbox code would go?
- Code:
<script type="text/javascript">
function popcbox() {
cboxwin = window.open("","Cbox","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Cbox</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3412857" style="border: 0px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=form" noresize="true" scrolling="no" name="cboxform3-3412857" style="border: 0px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
</script>
<a href="JavaScript:popcbox();">Pop up my Cbox</a>
Re: Widget code help please.
Try adding this to a widget :
Titles : Your choice
Use a table type : No
At the top you will see :
This is a list of the users allowed to view the widget. Add their username to the list and they can view the widget. Note : The name must be spelt exactly the same as it appears on the forum. The name must be between the single quotes and multiple names must be separated by a comma.
Titles : Your choice
Use a table type : No
- Code:
<script type="text/javascript">
_widget_allowed = ['Member 1', 'Member2', 'Member 3'];
</script>
<div id="cbContent"></div>
<script type="text/javascript">(function() {
var allowed = false, memb = _widget_allowed;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
popcbox = function() {
cboxwin = window.open("","Cbox","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Cbox</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3412857" style="border: 0px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=form" noresize="true" scrolling="no" name="cboxform3-3412857" style="border: 0px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
document.getElementById('cbContent').innerHTML = '<a href="JavaScript:popcbox();">Pop up my Cbox</a>';
} else return;
})();</script>
At the top you will see :
- Code:
_widget_allowed = ['Member 1', 'Member2', 'Member 3']
This is a list of the users allowed to view the widget. Add their username to the list and they can view the widget. Note : The name must be spelt exactly the same as it appears on the forum. The name must be between the single quotes and multiple names must be separated by a comma.
Re: Widget code help please.
OMG! THIS IS PERFECT!!! Thank you sooooo much Ange! I'm in love with it!
EDIT: I made another on with a different chat box in it for different members but the two keep clashing. One either won't work or one will just disappear all together when they're both place as working widgets.
I have even tried to put one on the left and one on the right sides of my forum, but it still doesnt work together, is there any way to change this please?
Maybe I made a mistake in the code when making a new one?
Here are the two codes:
Kostas:
Nayati:
I had it working at one stage, but when I tried to move them I lost it completely. I've been trying different ways to make it work or the past hour and half but I've come up with nothing
EDIT: I made another on with a different chat box in it for different members but the two keep clashing. One either won't work or one will just disappear all together when they're both place as working widgets.
I have even tried to put one on the left and one on the right sides of my forum, but it still doesnt work together, is there any way to change this please?
Maybe I made a mistake in the code when making a new one?
Here are the two codes:
Kostas:
- Code:
<script type="text/javascript">
_widget_allowed = ['Bladewolf', 'Nammia', 'Ashlyn', 'Aleria', 'Pandora', 'Zigan', 'Benjamin Nekishu', 'Charon', 'Kostas Modertor'];
</script>
<div id="cbContent">
</div><script type="text/javascript">(function() {
var allowed = false, memb = _widget_allowed;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
popcbox = function() {
cboxwin = window.open("","Kostas Chat","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Kostas Chat</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3412857" style="border: 0px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3412857&boxtag=9ew4kz&sec=form" noresize="true" scrolling="no" name="cboxform3-3412857" style="border: 0px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
document.getElementById('cbContent').innerHTML = '<a href="JavaScript:popcbox();">Kostas Chat</a>';
} else return;
})();</script>
Nayati:
- Code:
<script type="text/javascript">
_widget_allowed = ['Benjamin Nekishu', 'Kara', 'Charon', 'Freya Dark', 'Griffin', 'SunRise'];
</script>
<div id="cbContent">
</div><script type="text/javascript">(function() {
var allowed = false, memb = _widget_allowed;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
popcbox = function popcbox() {
cboxwin = window.open("","Nayati Chat","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Nayati Chat</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3415280" style="border:#000000 1px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=form" noresize="true" scrolling="no" name="cboxform3-3415280" style="border:#000000 1px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
document.getElementById('cbContent').innerHTML = '<a href="JavaScript:popcbox();">Nayati Chat</a>';
} else return;
})();</script>
I had it working at one stage, but when I tried to move them I lost it completely. I've been trying different ways to make it work or the past hour and half but I've come up with nothing
Re: Widget code help please.
This is probably because the variables and ids are the same, try replacing your Nayati one by :
I changed _widget_allowed to _widget_allowed2
and cbContent to cbContent2
You can use a text document to easily replace these.
Sorry I should of let you know this.
Let me know if that works for you.
- Code:
<script type="text/javascript">
_widget_allowed2 = ['Benjamin Nekishu', 'Kara', 'Charon', 'Freya Dark', 'Griffin', 'SunRise'];
</script>
<div id="cbContent2">
</div><script type="text/javascript">(function() {
var allowed = false, memb = _widget_allowed2;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
popcbox = function popcbox() {
cboxwin = window.open("","Nayati Chat","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Nayati Chat</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3415280" style="border:#000000 1px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=form" noresize="true" scrolling="no" name="cboxform3-3415280" style="border:#000000 1px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
document.getElementById('cbContent2').innerHTML = '<a href="JavaScript:popcbox();">Nayati Chat</a>';
} else return;
})();</script>
I changed _widget_allowed to _widget_allowed2
and cbContent to cbContent2
You can use a text document to easily replace these.
Sorry I should of let you know this.
Let me know if that works for you.
Re: Widget code help please.
That's okay! No need to worry, I thought it had something to do with something like that but I just didn't know what exactly to change; but alas It still did not work
When I'm clicking on either of the chats, it's still showing only one. It doesn't seem to matter which one I click. Which ever is below the other seems to be the primary eg:
I have them set on the web page as follows:
Nayati Chat (On top)
Kostas Chat (On bottom)
But when I open either of them they automatically go to Kostas Chat; and vise versa when the Nayati Chat is on the bottom.
When I'm clicking on either of the chats, it's still showing only one. It doesn't seem to matter which one I click. Which ever is below the other seems to be the primary eg:
I have them set on the web page as follows:
Nayati Chat (On top)
Kostas Chat (On bottom)
But when I open either of them they automatically go to Kostas Chat; and vise versa when the Nayati Chat is on the bottom.
Re: Widget code help please.
Oooh, I think I forgot to change the function name popcbox() to popcbox2().
Try now :
( Replace the same widget ^^ )
Try now :
( Replace the same widget ^^ )
- Code:
<script type="text/javascript">
_widget_allowed2 = ['Benjamin Nekishu', 'Kara', 'Charon', 'Freya Dark', 'Griffin', 'SunRise'];
</script>
<div id="cbContent2">
</div><script type="text/javascript">(function() {
var allowed = false, memb = _widget_allowed2;
for (i=0; i<memb.length; i++) if (memb[i] === _userdata.username) var allowed = true;
if (allowed === true) {
popcbox = function popcbox2() {
cboxwin = window.open("","Nayati Chat","width=200,height=380,toolbar=no,scrollbars=no,status=no,resizable=yes");
cboxwin.document.write('<html><head><title>Nayati Chat</title></head><frameset rows="*,75" frameborder="0" framespacing="0">');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=main" noresize="true" scrolling="auto" name="cboxmain3-3415280" style="border:#000000 1px solid;"/>');
cboxwin.document.write('<frame marginwidth="2" marginheight="2" src="http://www3.cbox.ws/box/?boxid=3415280&boxtag=55l4xf&sec=form" noresize="true" scrolling="no" name="cboxform3-3415280" style="border:#000000 1px solid;border-top:0px"/>');
cboxwin.document.write('</frameset>');
cboxwin.document.write('<noframes>Cbox needs frames!</noframes></html>');
try {
x = screen.width;
y = screen.height;
cboxwin.moveTo(Math.max((x/2)-100, 0), Math.max((y/3)-190));
} catch (e) {};
}
document.getElementById('cbContent2').innerHTML = '<a href="JavaScript:popcbox2();">Nayati Chat</a>';
} else return;
})();</script>
Re: Widget code help please.
You're welcome !
Topic archived
If you have any problems you can let us know by creating a new topic. Have a great weekend !
Topic archived
If you have any problems you can let us know by creating a new topic. Have a great weekend !
Similar topics
» How to do this Advanced Hiding Widget Code as well as the Recent Topic's Widget Modification
» New Widget Code
» What code of this 2 widget?
» Shortcuts Widget Code
» Portal Widget Code
» New Widget Code
» What code of this 2 widget?
» Shortcuts Widget Code
» Portal Widget Code
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum