Admins Can View All Active Promo Codes

Forum
Last Post
Threads / Messages

HIddenPanda

Premium Member
Premium Member
Joined
Jul 15, 2010
Messages
61
Points
8
Mysidian Dollar
3,655
This mod simply adds a page to view all of the current promo codes.

Step One:

Open Up admin.php

Find this string of code:

...
PHP:
$article_content = "Here you can add or edit the adoptables that are available to your site's visitors.  Please choose an option below...<br><br>
	<a href='admin.php?set=adopts&do=new'>Add a new adoptable</a><br><br>
	<a href='admin.php?set=adopts&do=addlevel'>Add A New Level to an Adoptable</a><br>
	<a href='admin.php?set=adopts&do=editlevels'>Edit Existing Levels or Images</a><br>
	<a href='admin.php?set=adopts&do=uploadimg'>Upload a new Adoptable Image</a><br>
	<a href='admin.php?set=adopts&do=manageimg'>Manage or Delete Images</a>";

Insert between the </a> and " the following code:
PHP:
<br>
<a href='admin.php?set=adopts&do=viewcodes'>View Current Promo Codes</a>

That creates a link in the "Change Adoptables" Page;
Now for the actual working code!

In admin.php now find (Note: This should be around Line 800 ish)
PHP:
	$i++;
	}

$article_content = $article_content."<p>    
    <input name='page' type='hidden' id='page' value='delimg'>
<input type='submit' name='Submit' value='Submit'>
  </p>
</form>";


}

After that insert the following:
PHP:
else if($do == "viewcodes"){
	
	$article_title = "Promo Codes";
	$article_content = "<table width='400' border='1'><tbody><tr><td><b>Type</b></td><td><b>Reward</b></td><td><b>Promo Code</b></td></tr>";
	$query = "SELECT * FROM " . $prefix . "adoptables WHERE whenisavail='promo'";
	$result = mysql_query($query);
	$promocodes = mysql_fetch_array($result);
	$num = mysql_num_rows($result);
	$i=1;
	while($i <= $num){
	$article_content = $article_content."<tr><td>Adoptable</td><td>".$promocodes['type']."</td><td>".$promocodes['promocode']."</td></tr>";
	$i++;
	}
	$article_content = $article_content."</tbody></table>";
}

There ya go! Now if you go into the admin panel and click the Change Adoptables page, it will include a link to view any adoptables that require promo codes to get!
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,119
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top