Return to Snippet

Revision: 10438
at January 29, 2009 16:17 by krunkosaurus


Updated Code
// 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>');
        });
    }
})();

Revision: 10437
at December 29, 2008 11:41 by krunkosaurus


Initial Code
// place in your header
(function(){
    // Your login page
    var loginPage = "http://affiliate.kickapps.com/user/displayUserLoginPage.kickAction?as=5166";
    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 = newLogin;
        //console.log(1);
    }

    // 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>');
        });
    }
})();

Initial URL


Initial Description
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.

--<br>
For more tips and tricks checkout the <a href="http://www.kickdeveloper.com/resources">KickApps resources page</a>.

Initial Title
Faux community privacy for your KickApps community

Initial Tags
javascript

Initial Language
JavaScript