Posted By

krunkosaurus on 12/29/08


Tagged

javascript community kickapps privacy


Versions (?)

Faux community privacy for your KickApps community


 / Published in: JavaScript
 

This is a basic script that will redirect a non-member to the login page with a custom message. Place the code between script tags in your Affiliate Center header.

To use: 1) replace loginPage variable with your *login URL.

2) replace accessMessage variable with your custom message.

*If you're current login URL does not contain a query string (?) you should change '&a=nonmember' inside newLogin variable to '?a=nonmember'.

Note that real community privacy for KickApps is on the way and this method should be considered transitional -- it can be circumvented by simply disabling JavaScript before visiting your site.

-- For more tips and tricks checkout the KickApps resources page.

  1. // place in your header
  2. (function(){
  3. // Your login page
  4. var loginPage = "http://awesome.krunkosaurus.com/user/displayUserLoginPage.kickAction?as=5166";
  5. var registerPage = "http://awesome.krunkosaurus.com/user/displayUserRegisterPage.kickAction?as=5166&STATUS=MAIN";
  6. var accessMessage = "You must be a member to access this site.";
  7. var newLogin = loginPage + '&a=nonmember';
  8.  
  9.  
  10. // if user is not logged-in and not on login page send them to login page
  11. if ( Ka.Info.USERID === '' && window.location.href !== loginPage && window.location.href !== newLogin && window.location.href !== registerPage) {
  12. window.location = newLogin;
  13. }
  14.  
  15. // if nonmember detected and on login page display message
  16. if (window.location.href === newLogin && Ka.Util.getLocationParam('a') === 'nonmember'){
  17. $j(function(){
  18. $j('#loginHeader').after('<p class="ka_Alert">' + accessMessage + '</p>');
  19. });
  20. }
  21. })();

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: krunkosaurus on December 29, 2008

More KickApps tips and tricks by looking for the kickapps tag.

Posted By: cainux on March 4, 2009

Any idea when real community privacy is coming?

You need to login to post a comment.