Hi everyone. I've just begun customizing my network. I've used a couple of text boxes that I put images and code into so that I could display them on the main page of my network before a user logs in. The thing is, I DON'T want these modules displaying after the user logs in. Also, I want to remove many of the other modules from the prelogin page. Our idea is that the prelogin page should be rather sparse, only offering some graphics and text about what the site is for, and sign-in/sign-up buttons. Does anyone know how to specify if a module displays pre or post login?
Hi Mike. Thanks so much for your help! Couple of quick questions:
1. Could you give me an example of the JavaScript I'll need to write that calls the php? I'm a designer who knows how to code, but I'm not very advanced with JavaScript just yet.
2. So I can embed the call to this loggedin.php file to the text boxes I create, which allows me to only display them pre or post log in. But what about for the standard modules? Forums, videos, etc? We only want these modules displayed after the user logs in. Is there a way for me to embed this php into those modules by rebuilding them with a text box and including the call to Forums and to the php? This sounds like it could be very buggy...
I have a way that you may be abler to this a little bit easier but i am not sure if you are willing to spend the money i am a member of a site called Widget Laboratory and a friend of mine his user name is evil genius may be able to help you with this that site have made a software you can add to your network and then buy there products they are great and there product don't cost much except for 2 of them they are expensive. but have a look WidgetLaboratory.com
Hello Mike, this is very helpful! I've been playing with the code to embed a flash banner when not logged in (one that would get users to join) and then just displaying text when logged in. I use swfobject.js to display the swf which works great. I'll paste my code below.
But I am having issues...
1. The call to the loggedin or loggedout parameter isn't really working. It's always displaying the second parameter whether logged in or not. But even when I play around with it, having the first instance as "if(response == 'true')" it always goes to the "else", whether logged in or not. Either my php is bad, or there is something wrong with the javascript. Here's my php file: http://liveon.ning.com/loggedin.php
2. Form code. I want to use this javascript in another text box, that will give you the form code for the signup only when logged out, and when logged in maybe I'll just put an image there. How do I generate the form code into the javascript? I can't just paste the html form code can I?
Here's my swf embed code for logged out users. Let me know if you see any errors which may be causing the text box to always display the "else". I'm new at js:
var loggedOutOnlyText = document.getElementById("loggedOutOnlyText");
if(response == 'false') {
loggedOutOnlyText.innerHTML = new SWFObject('https://api.ning.com/files/bYkSVgwejIwMGF9TcVjavhDgK6zUbLVsIjJ5ryyLeM8kqKUqrgZvlOt2tz6LTCMwSM0WWvV9Dlm-3YWMKyZX8LLdO0Xdob*3/introbanner.swf','mpl','500','350','7');
so.addVariable('autostart','true');
so.write('loggedOutOnlyText');
} else {
loggedOutOnlyText.innerHTML = "You are on the LiveOnNetwork. Browse our Forums to find out about all of our new products and services. Hear feedback from other members, or post questions you may have.";
}
}
function ajax(url, vars, callbackFunction) {
var request = window.XMLHttpRequest ?
new XMLHttpRequest() :
new ActiveXObject("MSXML2.XMLHTTP.3.0");
request.open("POST", url, true);
request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded");
request.onreadystatechange = function() {
if (request.readyState == 4 && request.status == 200) {
if (request.responseText) {
callbackFunction(request.responseText);
}
}
};
request.send(vars);
}
ajax("/loggedin.php", null, processLoggedIn);
So in my next text box, I need to put form code where I currently have the SWFObject call, I need to include the sign in form. Also, what's the best way to make it display an image?
Ok, I've got the php switch working, woo! It's displaying the flash banner when logged out, and a message when logged in.
Now for the other text box. I need it to display the signup form code when logged out, and something else when logged in. I thought I could do this by putting the form html inside the div, which the js would replace when logged in. But it's not working. Just displays the form code at all times.
This is what I've got. Ideas on how to make it work??
form action="http://liveon.ning.com/main/authorization/doSignIn?target=http%3A%2F%2Fliveon.ning.com%2F" method="post">