Jump to content

I am unable to display pilotid etc in the navbar


AidasP

Recommended Posts

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.

 

Link to comment
Share on other sites

  • Moderators

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"/> ';

-                                } ?>

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

I think he is talking about something like this:

2017-12-15_1745

 

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 by jnascar
Link to comment
Share on other sites

On 12/16/2017 at 1:49 AM, jnascar said:

I think he is talking about something like this:

2017-12-15_1745

 

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!

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...