/ 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 <a href="http://www.kickdeveloper.com/resources">KickApps resources page</a>.
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 <a href="http://www.kickdeveloper.com/resources">KickApps resources page</a>.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// place in your header (function(){ // Your login page var loginPage = "http://awesome.krunkosaurus.com/user/displayUserLoginPage.kickAction?as=5166"; var registerPage = "http://awesome.krunkosaurus.com/user/displayUserRegisterPage.kickAction?as=5166&STATUS=MAIN"; var accessMessage = "You must be a member to access this site."; var newLogin = loginPage + '&a=nonmember'; // if user is not logged-in and not on login page send them to login page if ( Ka.Info.USERID === '' && window.location.href !== loginPage && window.location.href !== newLogin && window.location.href !== registerPage) { window.location = newLogin; } // if nonmember detected and on login page display message if (window.location.href === newLogin && Ka.Util.getLocationParam('a') === 'nonmember'){ $j(function(){ $j('#loginHeader').after('<p class="ka_Alert">' + accessMessage + '</p>'); }); } })();