Jump to content

Does this look right?


Kyle

Recommended Posts

  • Moderators

Hey Guys, I'm trying to firgure out what's wrong. So I don't want any pilots to access the retired pilots public profiles and here's my code from profile.php.

if(!pilot::retired())
	{
		$this->set('message', 'Sorry! This Profile Is Not Available! ');
		$this->render('core_error.tpl');
		return;
	}

Can anyone help me to guide in the right direction and I'll be happy to give you 1+ rep if you helped me. Thanks! :)

Link to comment
Share on other sites

Assuming you're working within the view function, place the following somewhere after $userinfo is defined.

if($userinfo->retired == 1)
               {
                       $this->set('message', 'Sorry! This Profile Is Not Available!');
                       $this->render('core_error.tpl');
                       return;
               }

Hopefully should work :P

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Moderators

Is this your looking for. I ripped it off my porfile.php....

class Profile extends CodonModule
{

public function index()
{
	if(!Auth::LoggedIn())
	{
		$this->set('message', 'You must be logged in to access this feature!');
		$this->render('core_error.tpl');
		return;
	}

	/*
	 * This is from /profile/editprofile
	 */
	 if(isset($this->post->action))
	 {
		if($this->post->action == 'saveprofile')
		{
			$this->save_profile_post

Link to comment
Share on other sites

My bad you want the view function... Assuming you haven't modified it, and I haven't modified it (taking this from EUG profile.php which I may have edited):

public function view($pilotid='')
{

	if(!is_numeric($pilotid))
	{
		preg_match('/^([A-Za-z]*)(\d*)/', $pilotid, $matches);
		$code = $matches[1];
		$pilotid = intval($matches[2]) - Config::Get('PILOTID_OFFSET');
	}

	$userinfo = PilotData::getPilotData($pilotid);

	if($userinfo->retired == '1'){
		$this->set('message', 'Sorry, this profile is not available.');
		$this->render('core_error.tpl');
		return;
	}

	$this->title = 'Profile of '.$userinfo->firstname.' '.$userinfo->lastname;

	$this->set('userinfo', $userinfo);
	$this->set('allfields', PilotData::GetFieldData($pilotid, false));
	$this->set('pireps', PIREPData::GetAllReportsForPilot($pilotid));
	$this->set('pilotcode', PilotData::GetPilotCode($userinfo->code, $userinfo->pilotid));
	$this->set('allawards', AwardsData::GetPilotAwards($userinfo->pilotid));

	$this->render('pilot_public_profile.tpl');
	$this->render('pireps_viewall.tpl');
}

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...