Quantcast
Channel: RaGEZONE - MMO Development Forums
Viewing all articles
Browse latest Browse all 14533

[REVCMS] Account settings addon

$
0
0
Hey,

I know this is out there, but it is surely someone in need who are not so good at finding.

So this is an add for account settings, block friends requests, follow visibility, online visibility and some others.

hehe.png

First, go to,
app\tpl\skins\(your skin)\account.php (or whatever the account settings file is)

Find this similar code, and replace with the code below. From <form method="post" id="profileForm"> TO </form>

PHP Code:

<form method="post" id="profileForm">
                                            <
h3>Your motto</h3>
                                            <
p>Your motto is what other users will see on your {hotelNameHome page and when clicking your user in the Hotel.</p>
                                            <
p><label>Motto:<input type="text" name="acc_motto" size="32" maxlength="32" value="{motto}" id="avatarmotto"></label></p>
                                         
<
h3>Block Trading</h3>
                                            <
p>Setting to "0" will not allow any user to trade youSetting to "1" will allow any user to trade you.</p>
                                            <
p><label>Setting:<input type="text" name="acc_trade" size="32" maxlength="32" value="{acc_trade}" id="avatarmotto"></label></p>
                                         
<
h3>Block New Friends</h3>
                                            <
p>Setting to "1" will not allow any user to add youSetting to "0" will allow any user to add you.</p>
                                            <
p><label>Setting:<input type="text" name="acc_frndreq" size="32" maxlength="32" value="{acc_frndreq}" id="avatarmotto"></label></p>
                                       
                                            <
h3>Online Visibility</h3>
                                            <
p>Setting to "1" will not allow other users to notice your online statusSetting to "0" will allow other users to notice your online status.  <br/>    ON OFF</p>
                                            <
p><label>Setting:<input type="text" name="acc_online" size="32" maxlength="32" value="{acc_online}" id="avatarmotto"></label></p>
                                       
                                            <
h3>Follow Ability</h3>
                                            <
p>Setting to "1" will not allow your friends to Follow youSetting to "0" will allow your friends to follow you.<br/>    ON OFF</p>
                                            <
p><label>Setting:<input type="text" name="acc_follow" size="32" maxlength="32" value="{acc_follow}" id="avatarmotto"></label></p>
                                       
                                            <
h3>Your email address</h3>
                                            <
p>Your email address is what you may need to reset your password incase you forget it.</p>
                                            <
p><label>Email:<input type="text" name="acc_email" size="32" value="{email}" id="avatarmotto"></p>
                                            <
h3>Current Password</h3>
                                            <
p>Your current password is the password you use to login to the main websiteOnly fill this in if you wish to change your login password.</p>
                                            <
p><label>Password:<input type="password" name="acc_old_password" value="" id="avatarmotto"></p>
                                            <
h3>New Password</h3>
                                            <
p>Please only change this field if you wish to change your login password.</p>
                                            <
p><label>New Password:<input type="password" name="acc_new_password" value="" id="avatarmotto"></p>                                   
                                   
                                            <
div class="settings-buttons">
                                                <
input type="submit" value="Save changes" name="account" class="submit" style="float:right">
                                            </
div>
                                        </
form

Then, CTRL+S (saves), then exit out of that document.
-----------------------------------------------------------------------------

Next, go to, app\class.users.php find Account Settings, and replace with the code below.

PHP Code:

/*-------------------------------Account settings-------------------------------------*/
 
    
final public function updateAccount()
    {
        global 
$template$_CONFIG$core$engine;
 
        if(isset(
$_POST['account']))
        {
 
                if(isset(
$_POST['acc_frndreq']) && strlen($_POST['acc_frndreq']) < && $_POST['acc_frndreq'] != $this->getInfo($_SESSION['user']['id'], 'block_newfriends'))
            {
                
$this->updateUser($_SESSION['user']['id'], 'block_newfriends'$engine->secure($_POST['acc_frndreq']));
                
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                exit;
            }
            else
            {
                
$template->form->error 'Setting is invalid.';
            }
 
     
 
 
                if(isset(
$_POST['acc_trade']) && strlen($_POST['acc_trade']) < && $_POST['acc_trade'] != $this->getInfo($_SESSION['user']['id'], 'accept_trading'))
            {
                
$this->updateUser($_SESSION['user']['id'], 'accept_trading'$engine->secure($_POST['acc_trade']));
                
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                exit;
            }
            else
            {
                
$template->form->error 'Setting is invalid.';
            }
 
 
            if(isset(
$_POST['acc_online']) && strlen($_POST['acc_online']) < && $_POST['acc_online'] != $this->getInfo($_SESSION['user']['id'], 'hide_online'))
            {
                
$this->updateUser($_SESSION['user']['id'], 'hide_online'$engine->secure($_POST['acc_online']));
                
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                exit;
            }
            else
            {
                
$template->form->error 'Setting is invalid.';
            }
 
            if(isset(
$_POST['acc_follow']) && strlen($_POST['acc_follow']) < && $_POST['acc_follow'] != $this->getInfo($_SESSION['user']['id'], 'hide_inroom'))
            {
                
$this->updateUser($_SESSION['user']['id'], 'hide_inroom'$engine->secure($_POST['acc_follow']));
                
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                exit;
            }
            else
            {
                
$template->form->error 'Setting is invalid.';
 
            }
 
 
 
            if(isset(
$_POST['acc_motto']) && strlen($_POST['acc_motto']) < 30 && $_POST['acc_motto'] != $this->getInfo($_SESSION['user']['id'], 'motto'))
            {
                
$this->updateUser($_SESSION['user']['id'], 'motto'$engine->secure($_POST['acc_motto']));
                
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                exit;
            }
            else
            {
                
$template->form->error 'Motto is invalid.';
            }
 
            if(isset(
$_POST['acc_email']) && $_POST['acc_email'] != $this->getInfo($_SESSION['user']['id'], 'mail'))
            {
                if(
$this->validEmail($_POST['acc_email']))
                {
                    
$this->updateUser($_SESSION['user']['id'], 'mail'$engine->secure($_POST['acc_email']));
                    
header('Location: '.$_CONFIG['hotel']['url'].'/account');
                    exit;
                }
                else
                {
                    
$template->form->error 'Email is not valid';
                    return;
                }
            }
 
            if(!empty(
$_POST['acc_old_password']) && !empty($_POST['acc_new_password']))
            {
                if(
$this->userValidation($this->getInfo($_SESSION['user']['id'], 'username'), $core->hashed($_POST['acc_old_password'])))
                {
                    if(
strlen($_POST['acc_new_password']) >= 8)
                    {
                        
$this->updateUser($_SESSION['user']['id'], 'password'$core->hashed($_POST['acc_new_password']));
                        
header('Location: '.$_CONFIG['hotel']['url'].'/me');
                        exit;
                    }
                    else
                    {
                        
$template->form->error 'New password is too short';
                        return;
                    }
                }
                else
                {
                    
$template->form->error 'Current password is wrong';
                    return;
                }
            }
        }
    }
 
 
    final public function 
turnOn($k)
    {
        
$j $this->getID($k);
        
$this->createSSO($j);
        
$_SESSION['user']['id'] = $j;
        
$this->cacheUser($j);
        unset(
$j);
    } 

Then, CTRL+S (saves), then exit out of that document.
------------------------------------------------------------------------
Next, go to, app\class.template.php

Find the code below,

PHP Code:

if($users->isLogged())
        {
            
$this->setParams('username'$users->getInfo($_SESSION['user']['id'], 'username'));
            
$this->setParams('rank'$users->getInfo($_SESSION['user']['id'], 'rank'));
            
$this->setParams('motto'$users->getInfo($_SESSION['user']['id'], 'motto'));
            
$this->setParams('email'$users->getInfo($_SESSION['user']['id'], 'mail'));
            
$this->setParams('coins'$users->getInfo($_SESSION['user']['id'] ,'credits'));
            
$this->setParams('activitypoints'$users->getInfo($_SESSION['user']['id'], 'activity_points'));
            
$this->setParams('shells'$users->getInfo($_SESSION['user']['id'], 'vip_points'));
            
$this->setParams('figure'$users->getInfo($_SESSION['user']['id'], 'look'));
            
$this->setParams('ip_last'$users->getInfo($_SESSION['user']['id'], 'ip_last'));
            
$this->setParams('lastSignedIn',  date('M j, Y H:i:s A'$users->getInfo($_SESSION['user']['id'],  'last_online'))); 

Add the code below, underneath the existing code,

PHP Code:

$this->setParams('acc_frndreq'$users->getInfo($_SESSION['user']['id'], 'block_newfriends'));
            
$this->setParams('acc_trade'$users->getInfo($_SESSION['user']['id'], 'accept_trading'));
            
$this->setParams('acc_online'$users->getInfo($_SESSION['user']['id'], 'hide_online'));
            
$this->setParams('acc_follow'$users->getInfo($_SESSION['user']['id'], 'hide_inroom')); 

Enjoy, btw this fix is not mine.
Attached Images

Viewing all articles
Browse latest Browse all 14533

Trending Articles