AidasP Posted December 6, 2017 Report Share Posted December 6, 2017 I tried using many methods of displaying the pilots Id on the main menu, i tried: <?php echo PilotData::getPilotCode(); ?> also: <?php echo $pilotcode; ?> full example: <li><a href="<?php echo url('/pilots'); ?>"><?php echo PilotData::getPilotCode();?></a></li> (etc) I can only get these to work, when i am in pilotcenter, i need them in my core_navigation main. Quote Link to comment Share on other sites More sharing options...
Moderators shakamonkey88 Posted December 6, 2017 Moderators Report Share Posted December 6, 2017 It's because you're not calling it from the database - try something like this: <?php $pilotcode = PilotData::getPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid); ?> Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 6, 2017 Author Report Share Posted December 6, 2017 Just now, shakamonkey88 said: It's because you're not calling it from the database - try something like this: <?php $pilotcode = PilotData::getPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid); ?> will do Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 6, 2017 Author Report Share Posted December 6, 2017 (edited) No success Edited December 6, 2017 by AidasP Quote Link to comment Share on other sites More sharing options...
Moderators shakamonkey88 Posted December 6, 2017 Moderators Report Share Posted December 6, 2017 OK, try something a little more robust: <?php - if (!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilot.'.png')) { ?> - <img src="<?= SITE_URL ?>/lib/images/noavatar.png" alt="No Avatar" style="width: 50px" class="img-responsive"/> - <?php - } else { - echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilot.'.png'.'" alt="No Avatar" class="img-responsive"/> '; - } ?> Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 6, 2017 Author Report Share Posted December 6, 2017 Ok Thanks! Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 6, 2017 Author Report Share Posted December 6, 2017 Nope still no luck Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 6, 2017 Author Report Share Posted December 6, 2017 Thats my code for it: <li> <a href="<?php echo url('/userprofile'); ?>"> <img style="position:absolute;top:3px;left:-15px;width:30px;height:30px;" src="<?php echo PilotData::getPilotAvatar($pilotcode); ?>" /> <?php - if (!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilot.'.png')) { ?> - <img src="<?= SITE_URL ?>/lib/images/noavatar.png" alt="No Avatar" style="width: 50px" class="img-responsive"/> - <?php - } else { - echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilot.'.png'.'" alt="No Avatar" class="img-responsive"/> '; - } ?> </a> </li> (also displaying the avatar beside) Quote Link to comment Share on other sites More sharing options...
LeonardIGO4036 Posted December 10, 2017 Report Share Posted December 10, 2017 On 06/12/2017 at 7:29 PM, AidasP said: Thats my code for it: <li> <a href="<?php echo url('/userprofile'); ?>"> <img style="position:absolute;top:3px;left:-15px;width:30px;height:30px;" src="<?php echo PilotData::getPilotAvatar($pilotcode); ?>" /> <?php - if (!file_exists(SITE_ROOT.AVATAR_PATH.'/'.$pilot.'.png')) { ?> - <img src="<?= SITE_URL ?>/lib/images/noavatar.png" alt="No Avatar" style="width: 50px" class="img-responsive"/> - <?php - } else { - echo '<img src="'.SITE_URL.AVATAR_PATH.'/'.$pilot.'.png'.'" alt="No Avatar" class="img-responsive"/> '; - } ?> </a> </li> (also displaying the avatar beside) Hey mate, What page are you trying to display the pilot id? From what I understand from your first post, and If i'm not wrong, you are getting the ID displayed on the Crew Center but not on the Landing page correct? I haven't done this before, but try out the REST API. Quote Link to comment Share on other sites More sharing options...
Moderators servetas Posted December 11, 2017 Moderators Report Share Posted December 11, 2017 I do not understand what are you trying to show. Could you please explain to us? In the above code that you pasted you do not use the getPilotCode function anywhere. Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 15, 2017 Author Report Share Posted December 15, 2017 Well since, I am on my school computer.... Anyways, I am trying to display, pilot id + pilot's avatar, on all pages, it only shows up in pilot center, im making a profile page where they can change pass avatar etc., im not using the default phpvms, fully customizing it by hand, and unable to use bootstrap..... Hope htisanwers someones question! AidasP Quote Link to comment Share on other sites More sharing options...
in2tech Posted December 15, 2017 Report Share Posted December 15, 2017 (edited) I think he is talking about something like this: I might be wrong, but it displays on all pages, when logged in! This is the entire code in the default crystal skin: <?php /* Quick example of how to see if they're logged in or not Only show this login form if they're logged in */ if(Auth::LoggedIn() == false) { ?> <form name="loginform" action="<?php echo url('/login'); ?>" method="post"> Sign-in with your pilot id or email, or <a href="<?php echo url('/registration'); ?>">register</a><br /> <input type="text" name="email" value="" onClick="this.value=''" /> <input type="password" name="password" value="" /> <input type="hidden" name="remember" value="on" /> <input type="hidden" name="redir" value="index.php/profile" /> <input type="hidden" name="action" value="login" /> <input type="submit" name="submit" value="Log In" /> </form> <?php } /* End the Auth::LoggedIn() if */ else /* else - they're logged in, so show some info about the pilot, and a few links */ { /* Auth::$userinfo has the information about the user currently logged in We will use this next line - this gets their full pilot id, formatted properly */ $pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid); ?> <img align="left" height="50px" width="50px" style="margin-right: 10px;" src="<?php echo PilotData::getPilotAvatar($pilotid);?>" /> <strong>Pilot ID: </strong> <?php echo $pilotid ; ?> <strong>Rank: </strong><?php echo Auth::$userinfo->rank;?><br /> <strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?>, <strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?> <br /> <a href="<?php echo url('/pireps/new');?>">File a New PIREP</a> | <a href="<?php echo url('/schedules/bids');?>">View My Bids</a> | <a href="<?php echo url('/profile/');?>">View Pilot Center</a> <?php } /* End the else */ ?> That will show you exactly what is in the screen shot WHEN they login! There might be some additional code in there, not sure. And you can edit it for ONLY what you want show! Edited December 15, 2017 by jnascar Quote Link to comment Share on other sites More sharing options...
AidasP Posted December 18, 2017 Author Report Share Posted December 18, 2017 On 12/16/2017 at 1:49 AM, jnascar said: I think he is talking about something like this: I might be wrong, but it displays on all pages, when logged in! This is the entire code in the default crystal skin: <?php /* Quick example of how to see if they're logged in or not Only show this login form if they're logged in */ if(Auth::LoggedIn() == false) { ?> <form name="loginform" action="<?php echo url('/login'); ?>" method="post"> Sign-in with your pilot id or email, or <a href="<?php echo url('/registration'); ?>">register</a><br /> <input type="text" name="email" value="" onClick="this.value=''" /> <input type="password" name="password" value="" /> <input type="hidden" name="remember" value="on" /> <input type="hidden" name="redir" value="index.php/profile" /> <input type="hidden" name="action" value="login" /> <input type="submit" name="submit" value="Log In" /> </form> <?php } /* End the Auth::LoggedIn() if */ else /* else - they're logged in, so show some info about the pilot, and a few links */ { /* Auth::$userinfo has the information about the user currently logged in We will use this next line - this gets their full pilot id, formatted properly */ $pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid); ?> <img align="left" height="50px" width="50px" style="margin-right: 10px;" src="<?php echo PilotData::getPilotAvatar($pilotid);?>" /> <strong>Pilot ID: </strong> <?php echo $pilotid ; ?> <strong>Rank: </strong><?php echo Auth::$userinfo->rank;?><br /> <strong>Total Flights: </strong><?php echo Auth::$userinfo->totalflights?>, <strong>Total Hours: </strong><?php echo Auth::$userinfo->totalhours;?> <br /> <a href="<?php echo url('/pireps/new');?>">File a New PIREP</a> | <a href="<?php echo url('/schedules/bids');?>">View My Bids</a> | <a href="<?php echo url('/profile/');?>">View Pilot Center</a> <?php } /* End the else */ ?> That will show you exactly what is in the screen shot WHEN they login! There might be some additional code in there, not sure. And you can edit it for ONLY what you want show! Works like a charm, Thanks! Quote Link to comment Share on other sites More sharing options...
in2tech Posted December 18, 2017 Report Share Posted December 18, 2017 Actually, don't thank me it was Nabeel in the original code I just directed you towards the code. Enjoy! Quote Link to comment 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.