[REVCMS] Account settings addon

Status
Not open for further replies.
Junior Spellweaver
Joined
Oct 5, 2012
Messages
114
Reaction score
34
Location
Norway
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.

heh - [REVCMS] Account settings addon - RaGEZONE Forums

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:
<form method="post" id="profileForm">
                                            <h3>Your motto</h3>
                                            <p>Your motto is what other users will see on your {hotelName} Home 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 you. Setting 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 you. Setting 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 status. Setting to "0" will allow other users to notice your online status.  <br/>    0 = ON | 1 = 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 you. Setting to "0" will allow your friends to follow you.<br/>    0 = ON | 1 = 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 website. Only 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:
/*-------------------------------Account settings-------------------------------------*/
 
    final public function updateAccount()
    {
        global $template, $_CONFIG, $core, $engine;
 
        if(isset($_POST['account']))
        {
 
                if(isset($_POST['acc_frndreq']) && strlen($_POST['acc_frndreq']) < 2 && $_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']) < 2 && $_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']) < 2 && $_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']) < 2 && $_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:
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:
$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.
 
Good release. However why not use something like
<input type='radio' name='os' value='1' >No one
<input type='radio' name='os' value='0' checked>All
<br><br>

<h3>Follow me:</h3>
<p>Choose who gets to follow you from room to room:</p>
<input type='radio' name='fm' value='1' >No one
<input type='radio' name='fm' value='0' checked>My Friends/Anyone

Just pulled from control u from my hotle.
 
There is another version of this with radiobuttons and not textboxes. Google it.

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

I know that, Einstein.

Good release. However why not use something like
<input type='radio' name='os' value='1' >No one
<input type='radio' name='os' value='0' checked>All
<br><br>

<h3>Follow me:</h3>
<p>Choose who gets to follow you from room to room:</p>
<input type='radio' name='fm' value='1' >No one
<input type='radio' name='fm' value='0' checked>My Friends/Anyone

Just pulled from control u from my hotle.

Hehe, ask the person who made it :)
 
I have googled for radiobuttons, ending up with no resault.. I would be happy for the radiobutton versin instead of this..
Thanks
 
Very nice release. I might release a CMS that has all of this already and is not PHPRetro, UberCMS or RevCMS... It is much lighter and has a load time of 0,1 seconds.. Very cool... But anyway! Thanks for this release. Should help alot of people.
 
Status
Not open for further replies.
Back