View Single Post
  #1  
Old 11-14-2012, 01:14 PM
schepers12's Avatar
schepers12 schepers12 is offline
Member
 
Join Date: Sep 2012
Location: netherlands
Posts: 30
Gender: Male
Credits: 7,893
schepers12 is on a distinguished road
Default place the money amount user has where you want to

hello all, i saw some people on this board wanted to have a separate money bar for the script (saw it in a very old post), well, here it is~ :3c

instructions provided in the board aswell the zip file~



please don't shoot me if i did something wrong, i'm a human and i do make mistakes, so please back-up your adoptables site before you start~!

It works for me though.. :3c


instructions below:

replace he original functions "getlinks, getsidebar" by these 3 functions in the main function file by this:
PHP Code:
function getlinks(){
$isloggedin $GLOBALS['isloggedin'];
if(
$isloggedin == "yes"){
//This function gets the links for the top bar from the database 
// We will be getting our links from the database...
    
$links "<div class='ddmenu'>\n
             "
;
             
    
$stmt $GLOBALS['adopts']->select("links", array(), "linkparent < 1 ORDER BY id ASC");
        
    while (
$category $stmt->fetchObject()) {
        
$links .= "\n <a class='hide' href='{$category->linkurl}'>{$category->linktext}</a><br />
               \n"
;
        
$stmt2 $GLOBALS['adopts']->select("links", array(), "linkparent='{$category->id}' ORDER BY id ASC");
        while(
$item $stmt2->fetchObject()){
            
$links .= "&nbsp; - &nbsp; <a href='{$item->linkurl}' title='{$item->linktext}'>{$item->linktext}</a><br />";      
        }
        
$links .= "
              \n"
;
    }
    
    
$links .= "\n";
} else {
    
$links "Please login or register first!";
}
    return 
$links;

--------------------------------
--IF YOU HAVE THE HOUSE MOD INSTALLED, ADD THIS FUNCTION (under the getlinks function):
--
PHP Code:
function getmoney() {
    
$isloggedin $GLOBALS['isloggedin'];
    
$loggedinname $GLOBALS['loggedinname'];
    if(
$isloggedin == "yes") {
        
$sideba "- You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}. <a href='donate.php'>Donate to users</a>";
        
$sideba .= "<br />- you have {$GLOBALS['houses']} houses. <a href='houses.php'>Buy more houses</a>";
    } else { 
$sideba ""; }
    return 
$sideba;

--------------------------------
--OTHERWISE, USE THIS:
PHP Code:
function getmoney() {
    
$isloggedin $GLOBALS['isloggedin'];
    
$loggedinname $GLOBALS['loggedinname'];
    if(
$isloggedin == "yes") {
        
$sideba "You have {$GLOBALS['money']} {$GLOBALS['settings']['cost']}. <a href='donate.php'>Donate to users</a>";
    } else { 
$sideba ""; }
    return 
$sideba;

--------------------------------

PHP Code:
function getsidebar() {
    
//This function determines what shows in the side bar of the template
    
$isloggedin $GLOBALS['isloggedin'];
    
$loggedinname $GLOBALS['loggedinname'];
    if(
$isloggedin == "yes") {
        
$msgctr "<a href='messages.php'>Messages</a>";        
        
$data $GLOBALS['adopts']->select("messages", array(), "touser='{$loggedinname}' and status='unread'")->fetchAll();

        if(
count($data) > 0) {
            
$msgctr "<a href='messages.php'>Messages <b>(".count($data).")</b></a>";
        }
        
$sidebar "
        <strong>Your links:</strong><br />
        <ul><li><a href='adopt.php'>Adopt New Pets</a></li>
        <li><a href='pound.php'>Acquire Pounded Pets</a></li>
        <li><a href='myadopts.php'>Manage Adoptables</a></li>
        <li><a href='account.php'>Go to My Account</a></li>
        <li>
{$msgctr}
        <li><a href='changestyle.php'>Change Theme</a></li>
        <li><a href='logout.php'>Log Out</a></li>"
;



    
$wpath =$GLOBALS['houses'];
    
$housing $wpath;
    
$sidebar.= "<li><a href='houses.php'>you have {$housing} houses</a></li>";
        
$row $GLOBALS['adopts']->select("users", array(), "username='{$loggedinname}' and usergroup='1'")->fetchObject();        
        if(
is_object($row)) $sidebar .= "<li><a href='admincp/index.php'>Admin Center</a></li><br />";

        
$row1 $GLOBALS['adopts']->select("online", array(), "username != 'Visitor'")->fetchAll();
        
$total1 count($row1);
        
$row2 $GLOBALS['adopts']->select("online", array(), "username = 'Visitor'")->fetchAll();
        
$total2 count($row2);
        
$sidebar .= "<a href='online.php'>This site has {$total1} members and {$total2} guests online.</a></ul>";
    }
    else {
        
$sidebar "<b><u>Member Login:</u></b><br />
        <form name='form1' method='post' action='login.php'>
          <p>Username: 
            <input name='username' type='text' id='username'>
        </p>
          <p>Password: 
        <p>    <input name='password' type='password' id='password'>
        </p>
          <p>
            <input type='submit' name='Submit' value='Log In'>
          </p>
        </form>Don't have an account?<br /><a href='register.php'>Register Free</a><br /><a href='forgotpass.php'>Forgot Password?</a>"
;
        
$row1 $GLOBALS['adopts']->select("online", array(), "username != 'Visitor'")->fetchAll();
        
$total1 count($row1);
        
$row2 $GLOBALS['adopts']->select("online", array(), "username = 'Visitor'")->fetchAll();
        
$total2 count($row2);
        
$sidebar .= "<br />This site currently has {$total1} members and {$total2} guests.";

    }
    return 
$sidebar;

_____________________________


then add the -modified- template "elements" in the templates folder, replace the original (difference with original is that the center is 800px wide in this mod)

______________________________
last:
replace the function showpage (almost at the end of the functions file) by this:


PHP Code:
function showpage($title$content$date) {
    
$theme $GLOBALS['usersettings']['theme'];
    if (
$theme == ''$theme grabanysetting("theme");
    
$acpthemeurl "../templates/acp/template.html";
    
$themeurl "templates/{$theme}/template.html";
    
$patterns = array("/:ARTICLETITLE:/","/:ARTICLECONTENT:/""/:ARTICLEDATE:/""/:BROWSERTITLE:/""/:SITENAME:/""/:SLOGAN:/""/:LINKSBAR:/""/:SIDEFEED:/""/:MONEY:/""/:ADS:/");
    
// if we have said we are in an admin area, don't show ads and show admin links
    
if (defined("SUBDIR") and SUBDIR == "AdminCP") {
        
$replacements = array($title$content$dategrabanysetting("browsertitle")." ".$titlegrabanysetting("sitename"), grabanysetting("slogan"), getadmlinks(), getsidebar(), getmoney(), "");
         
$template file_get_contents($acpthemeurl);
    }
    else {
        
$replacements = array($title$content$dategrabanysetting("browsertitle")." ".$titlegrabanysetting("sitename"), grabanysetting("slogan"), getlinks(), getsidebar(),getmoney(), getads("any"));
         
$template file_get_contents($themeurl);
    }
    
// now that we have our stuff, let's start making it all into a webpage

    
$template =  preg_replace($patterns$replacements$template);
    return 
$template;

this modification is compatible with MYS 1.3.1
and provided by me~ :3
i hope you will enjoy this mod~ ^^
Attached Files
File Type: zip seperate money bar.zip (111.1 KB, 3 views)
__________________
~
Reply With Quote