Jump to content

Downloads controlled by rank [SOLVED]


NAdams

Recommended Posts

I think this topic has been brought up before, but I have searched the forums up and down and couldn't

find it anywhere...

Is there a way to tie the downloads to rank, so the pilot can't download a certain plane until he reaches a certain rank. Even though the dowloads are there, they can't access them

until they reach the rank that the download is attached to.

Link to comment
Share on other sites

  • 2 weeks later...

here is my code for the downloads_list.tpl, where would be the best place to insert the code above? or does it go somewhere else

also, for the numerical value of the ranking list, if i had 8 ranks, then it would be rank level - 1, rank level-2, and so on....

<div class="mcright">
<br>
<p><img alt="" src="http://x-usairways.com/images/downloads.png" /></p>

<?php 
if(!$allcategories)
{
echo 'There are no downloads available!';
return;
}

foreach($allcategories as $category)
{
?>
<p><h2><strong><?php echo $category->name?></strong></h2></p>
<ul>

<?php	
# This loops through every download available in the category
$alldownloads = DownloadData::GetDownloads($category->id);

if(!$alldownloads)
{
	echo 'There are no downloads under this category';
	$alldownloads = array();
}

foreach($alldownloads as $download)
{
?>
<li>
	<a href="<?php echo url('/downloads/dl/'.$download->id);?>">
		<?php echo $download->name?></a><br />
      <?php echo $download->description?><br />
         <em>Downloaded <?php echo $download->hits?> times</em></li>
<?php
}
?><br />
</ul>
<?php
}
?>
</div>

Link to comment
Share on other sites

Something like

if(Auth::$userinfo->ranklevel > your required rank level)
	{
		//give em the download
	}

This would be based on the numerical value of your ranking system.

That would work if ALL downloads are reachable after a certain rank is achieved. I suppose what he actually meant was to restric the download of certain items depending on the rank level which sounds logical to me. For example, if your fleet has Turboprops and Jets, the Jets packages/liveries wouldn't be available for download until the user achieved the rank appropriate for flying the jets.

Another issue (???) is that once the download link is known, a "privileged" (in terms of rank achieved) user can pass the download link (or post it) to a lower "pilot". Anyways, that isn't important.

Link to comment
Share on other sites

yep, that's exactly what i'm trying to do

I want to control what downloads they can get at certain ranks. so pilots don't sign up for the VA and download all the stuff and then jump ship

i'm not sure how it works in the FS world, but we all run xplane and it happens pretty often, pilots just see what they can get and then leave

we maintain our own fleet and design our own scenery, so we only want to make that available to pilots who are commited to the VA and actually have to "fly" to rank up and get more stuff

Link to comment
Share on other sites

  • Administrators

You can split it by category. Something like:

// This is that foreach line from above:
foreach($allcategories as $category) {
 // If this is the category turboprops, and their rank level is less than 2, then don't show this
 if ($category->name == 'Turboprops' && Auth::$userinfo->ranklevel < 2) {
   continue;
 }
 ...
}

Link to comment
Share on other sites

You can split it by category. Something like:

// This is that foreach line from above:
foreach($allcategories as $category) {
 // If this is the category turboprops, and their rank level is less than 2, then don't show this
 if ($category->name == 'Turboprops' && Auth::$userinfo->ranklevel < 2) {
   continue;
 }
 ...
}

Possible and quite valid but in some airlines (like mine-to-be) you don't want them to download the Dash 8-Q400 until they have enough rank and many hours of flight (per rank), otherwise they are stuck with a smaller Turboprop like the delicious Twin Otter.

I think what the other VA guy wants can be done with adding a new column to the Downloads table "minrank" and then if it is 0 it has no restriction, otherwise the rank level has to be at least that.

Anyway, that is how I would do it but the software isn't mine. He can do the change in the database but in an upgrade it would be gone or probably cause problems.

Link to comment
Share on other sites

  • Administrators

Possible and quite valid but in some airlines (like mine-to-be) you don't want them to download the Dash 8-Q400 until they have enough rank and many hours of flight (per rank), otherwise they are stuck with a smaller Turboprop like the delicious Twin Otter.

I think what the other VA guy wants can be done with adding a new column to the Downloads table "minrank" and then if it is 0 it has no restriction, otherwise the rank level has to be at least that.

Anyway, that is how I would do it but the software isn't mine. He can do the change in the database but in an upgrade it would be gone or probably cause problems.

It's open source, you can change it to work exactly how you'd like it to work.

  • Like 1
Link to comment
Share on other sites

alright, i got everything working like it should

in addition to controlling the categories, i just used the same code and changed it for the downloads, now i can control the individual downloads based in rank also

thanks so much for the help guys

- nick

<div class="mcright">
<br>

<p><img alt="" src="http://x-usairways.com/images/downloads.png" /></p>
<br>
<br>
<?php 
if(!$allcategories)
{
echo 'There are no downloads available!';
return;
}

foreach($allcategories as $category) {
 // If this is the category scenery, and their rank level is less than 2, then don't show this
 if ($category->name == 'Scenery' && Auth::$userinfo->ranklevel < 2) {
   continue;
 }
// If this is the category add-ons, and their rank level is less than 2, then don't show this
 if ($category->name == 'Add-Ons' && Auth::$userinfo->ranklevel < 2) {
   continue;
 }




?>
<p><h2><strong><?php echo $category->name?></strong></h2></p>
<ul>

<?php	
# This loops through every download available in the category
$alldownloads = DownloadData::GetDownloads($category->id);

if(!$alldownloads)
{
	echo 'There are no downloads under this category';
	$alldownloads = array();
}

foreach($alldownloads as $download)
{
           // If this is the download a319, and their rank level is less than 2, then don't show this
 if ($download->name == 'A319' && Auth::$userinfo->ranklevel < 4) {
   continue;
 }


           ?>
<li>
	<a href="<?php echo url('/downloads/dl/'.$download->id);?>">
		<?php echo $download->name?></a><br />
      <?php echo $download->description?><br />
       </li>
<?php
}
?><br />
</ul>
<?php
}
?>
</div>

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