ffxpwns Posted April 3, 2012 Share Posted April 3, 2012 Hi, I want have this code (below), how would I check if a user is logged in? I want to make it so they can only see 500 chars, or the full thing if they're logged in. Thanks! public function __construct( $data=array() ) { if ( isset( $data['id'] ) ) $this->id = (int) $data['id']; if ( isset( $data['publicationDate'] ) ) $this->publicationDate = (int) $data['publicationDate']; if ( isset( $data['title'] ) ) $this->title = preg_replace ( "/[^\.\,\-\_\'\"\@\?\!\:\$ a-zA-Z0-9()]/", "", $data['title'] ); if ( isset( $data['summary'] ) ) $this->summary = preg_replace ( "/[^\.\,\-\_\'\"\@\?\!\:\$ a-zA-Z0-9()]/", "", $data['summary'] ); if ( isset( $data['content'] ) ) $this->content = $data['content']; if ( isset( $data['tags'] ) ) $this->tags = $data['tags']; } Quote Link to comment https://forums.phpfreaks.com/topic/260269-check-if-a-user-is-logged-in/ Share on other sites More sharing options...
ffxpwns Posted April 3, 2012 Author Share Posted April 3, 2012 Whoops. didn't mention where I wanted it. I want it in the content section. I put if($user -> uid.... then if I put an else statement beneath, would that work? Quote Link to comment https://forums.phpfreaks.com/topic/260269-check-if-a-user-is-logged-in/#findComment-1333991 Share on other sites More sharing options...
smerny Posted April 3, 2012 Share Posted April 3, 2012 depends on what user->uid is try it, see what happens. if it doesn't work, provide more details Quote Link to comment https://forums.phpfreaks.com/topic/260269-check-if-a-user-is-logged-in/#findComment-1333992 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.