Recent Topics

1 Nov 23, 2005 21:15    

Hello, I'm interested in controlling access to some of my Blogs right column content. Allowing only users that are logged in to view certain content. I'm hoping there is some way using PHP to check for whether a blog user is or is not currently logged in.

As example: lets say I only want logged in users to be able to obtain RSS feed from my blog is there some PHP code I can wrap the RSS HTML in that does an IF -> Else type of check for whether the user is logged in.

NOTE: I realise that the above may or may not be a realistic example but the concept is there, e.g. I'm trying to protect certain content or functionality from un-authenticated users.

Thanks,

3 Nov 25, 2005 07:30

This worked well, how would 'is not logged in' look?

4 Nov 25, 2005 07:45

markfaulkner wrote:

This worked well, how would 'is not logged in' look?

if youre impatient (for an answer), thats not really necessary. you can work from the premise that they are logged in, and go from there:



if( is_logged_in() ) {x=1} else {x!=1}

use the else :)

5 Nov 25, 2005 14:01

That would work. Or if you don't want to do anything for logged in users, you could do it like this:

if ( ! ( is_logged_in ) ) {
            //   stuff to do for non-members
}


Form is loading...