Eve Support Community
Forums
OpenTopic
OpenTopic Assistance
Advertising to only a specific security group?|
Go
![]() |
New
![]() |
Find
![]() |
Notify
![]() |
Tools
![]() |
Reply
![]() |
|
|
Groupee Member |
Someone recently told me that there was a way of delivering banner (or popup) adverts per security group (eg. deliever them to free members but not to our paying GOLD members), but I can't find anything about it. Was he correct? (unfortunately he didn't tell me where he saw it
In particular, is there a way for me to deliver one pop-up per session to non-registered viewers? -James Corbett. |
||
|
|
Groupee VIP |
Hello James
Security group info is set as part of the user preferences at login. This was used in the beta boards you tested to show a banner *only* to people who didn't belong to a specific security group. This would do what I think you want. I'll email you that link privately. How is your javascript hacking ?? To make it work you need to figure out the id number of your gold security group. Subsititute it into the javascript code. Also edit the banner URLs to fit. Test like crazy before you unleash it on your users!! Making a banner appear *once* per session involves setting a session cookie to flag a user as having seen the advert. You would need need to develop a little js code to detect it and render the banner accordingly. The first task above is cut * paste once you have your security group id info. The latter is a little more advanced. Let us know how it turns out. Michael Farris OpenTopic/UBB.x Product Manager |
|||
|
|
Groupee Member |
Yes, that's exactly what I want Michael - thanks!
Please post or email the javascript code I require. I'm not a great programmer but don't have a problem with a small bit of tweaking -James Corbett. |
|||
|
|
Groupee Member |
Ok I've seen what I think is the javascript being used for this trick and it appears to be checking the ID of the security group. Soooo.... how do I determine the IDs of my security groups?
-James Corbett. |
|||
|
|
|
Hi James,
You can get the security group id on the security group settings page. Look in the URL and you'll see a parameter &g=XXX where XXX is the security group id. Regards, Brian Lenz Infopop Corporation |
|||
|
|
Groupee VIP |
Hello James
Here's code -- without warranty Add this to the After Body Tag area of your style. <script language="JavaScript"> // copy the HTML code you want inserted between the single quotes below insert_this_code = '< your code here >'; // choose true or false to show=true or hide=false the code to certain security groups show_code_to_security_groups = false; //You MUST find the security group ID number: the &g=NNNNNNN of your URL while viewing a Security Group in the CP // Multiple group ids are separated by commas 'NNNNN,MMMMM,WWWWW'. No spaces. security_grp_id_list = 'NNNNN'; /// Change nothing below this line security_group_match = false; security_grp_id_array = security_grp_id_list.split(","); for (i=0;i<security_grp_id_array.length;i++){ if (document. cookie.indexOf(security_grp_id_array[i]) != -1) { security_group_match = true; break; } } if ((security_group_match == true)&&(show_code_to_security_groups==true)) { document.write(insert_this_code); } else if ((show_code_to_security_groups == false) && (security_group_match == false)) { document.write(insert_this_code); } </script> This is a little different from the code on the beta site. You can use multiple security groups in a list and you can specify that the code *appears* to certain groups -- or that it is *hidden* from certain security groups. PS -- you have to close up the space in document. cookie above to make the script work. OpenTopic block that pharse for security reasons. Attached is the code in a txt file. [This message was edited by Michael Farris on May 30, 2002 at 03:22 PM.] security.doc (20 Kb, 22 downloads) example |
|||
|
Groupee VIP![]() |
|
|||
|
|
Groupee Member |
Michael, I just couldn't get the code to work on my site. I created a new (clean) forum style with just the code you supplied (changed as necessary) and applied it to an existing forum. Yes I closed the space you specified too.
My IE 5.5 was displaying "Done, but with errors on page" in the status bar, so I suppose therein lies the source of the problem? I realise there are more important things for you to worry about than supporting 'no-guarantee' hacks so there's no rush with replying..... I'll keep messing around with it. -James Corbett. |
|||
|
|
Groupee VIP |
Hello Roberto
First my apology for not seeing your response. It got so far down the 'what's new' list I didn't see it. My guess is that you've copied and pasted the code and left in the line breaks in the comment tags Something like this // a comment tag line is here will break things everytime it has to be like this // a comment tag line is here The other common error is losing the two single quotes ' that mark the beginning and end of a value. Another is to use a ' in your HTML code. Don't use them at all or make sure to 'escape' them with a backslash: \' whenever they appear inside your HTML code. Michael Farris OpenTopic/UBB.x Product Manager |
|||
|
|
Groupee Newbie |
Hi,
The javascript might not be working because there appears to be a spurious space character inserted between 'document' and 'cookie'. That is, the code if (document. cookie.indexOf(security_grp_id_array[i]) != -1) should probably be if (***************.indexOf(security_grp_id_array[i]) != -1) Hope this helps. |
|||
|
|
Groupee Newbie |
Oh dear. I've managed to miss reading the PS on Michael Farris's post, where he explains why the space is there (heh, what happens when you don't take it out is illustrated handily by my previous message).
Apologies for the 'spam' (I'd just edit the previous post, but I can't figure out how to do that on this bulletin board). |
|||
|
|
Groupee VIP |
here's one. (I'm not good at scripting so I haven't taken a good look at the code)
is that code able to be setup for multiple security groups at once? would it be so simple as doing some of the code twice in the page? |
|||
|
|
|
Hi flyingember,
You definitely could follow the same logic for multiple security groups. Instead of checking for one single group ID, you'd simply check for multiple group IDs. It would just be a slight modification. So, the answer to your question is: YES! Regards, Brian Lenz Infopop Corporation |
|||
|
![]() |
As I read MF's code above, it appears it already supports that feature - just separate the group ids with commas (so the comment says).
Graeme Moderator: UBB.classic Assistance Forum NOTE: Any email requests for support will be ignored. "The ships hung in the sky in much the same way that bricks don't." --Douglas Adams |
|||
|
|
Groupee Newbie |
I implemented the suggested javascript for hiding categories from certain security groups, and it worked fine on ubb.x. Unfortunately this functionality has been broken by the upgrade to Eve.
Does anyone have any idea how to fix this? <script language="JavaScript"> function isInGroup(idlist) { security_group_match = false; security_grp_id_array = idlist.split(","); for (i = 0; i < security_grp_id_array.length; i++){ if (document.cookie.indexOf(security_grp_id_array[i]) != -1) { security_group_match = true; break; } } return security_group_match; } function hideElement(elemid) { var elem = document.getElementById(elemid); if (elem != null) elem.style.display = 'none'; } // Set Steering Committee section visibility if ( !isInGroup('4146002961,2036092271') ) { hideElement('gs_desc_forum_list_1346002961'); hideElement('gs_frm_id_1346002961'); } // Set Working Groups section visibility if ( !isInGroup('4146002961,2036092271,5126008371') ) { hideElement('gs_desc_forum_list_5716008371'); hideElement('gs_frm_id_5716008371'); } </script> Thanks, Andrew |
|||
|
| Previous Topic | Next Topic | powered by eve community |
| Please Wait. Your request is being processed... |
|
Eve Support Community
Forums
OpenTopic
OpenTopic Assistance
Advertising to only a specific security group?
