WebFlake is currently in the process of upgrading fully to IPS 4.2.
We are aware that various functions may not be working correctly, or missing entirely.
Please use our Bug Tracker and Suggestions Tracker to help us with this transition.

You can dismiss this message at your discretion. Thanks!

Jump to content
Sign in to follow this  
unknoweb

[Solved] How save settings for each member ?

Recommended Posts

unknoweb    3

Hi,

I try to modified ChatBox 2.0.0 for adding setting menu.

I remove toggle sound and replace with settings menu and in settings menu I added 2 checkbox "Form (Yes/No)"

When I clicked save is no longer saved I don't know how save options for each members

Code in chatbox.php under module/front

/*-------------------------------------------------------------------------*/
// Chatbox options panel
/*-------------------------------------------------------------------------*/        
    public function cboptions()
    {
        #can view settings
        if ( ! \IPS\Application::load('bimchatbox')->can_Chat() || in_array(\IPS\Member::loggedIn()->member_id, explode(",", \IPS\Settings::i()->chatbox_conf_blocklist)) )
        {
            \IPS\Output::i()->json( array( 'type' => 'error', 'message' => \IPS\Member::loggedIn()->language()->get( 'chatbox_error_cannotchat' ) ) );
            exit;            
        }    
        
        # Form
        $formoptions = new \IPS\Helpers\Form;
        
        $formoptions->add( new \IPS\Helpers\Form\YesNo( 'chatbox_moving', \IPS\Settings::i()->chatbox_moving ) );
        
        $formoptions->add( new \IPS\Helpers\Form\YesNo( 'chatbox_sound', \IPS\Settings::i()->chatbox_sound ) );
        
        $formoptions->class = 'ipsForm_vertical';
        
        if ( $values = $formoptions->values() )
        {
            $formoptions->saveAsSettings();
            \IPS\Output::i()->redirect( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : \IPS\Http\Url::internal( '' ) );
        }
        
        /* Output */
        \IPS\Output::i()->breadcrumb[] = array( NULL, \IPS\Member::loggedIn()->language()->addToStack('chatbox_manage') );
        \IPS\Output::i()->title        = \IPS\Member::loggedIn()->language()->addToStack('chatbox_manage');            
        \IPS\Output::i()->output    = \IPS\Theme::i()->getTemplate( 'chat' )->settings($formoptions);        
    }

code under main in theme setting under bimchatbox/front/chat

<ul class="ipsPos_right ipsList_inline ipsList_noSpacing">          
          {{if \IPS\Application::load('bimchatbox')->can_Chat()}}
                <li>
                    <a href="#" class="cbBtn" data-ipsDialog data-ipsDialog-url='{url="app=bimchatbox&module=chatbox&controller=chatbox&do=cboptions"}' data-ipsDialog-size='narrow' data-ipstooltip="" title='{lang="chatbox_management"}'><i class="fa fa-wrench"></i></a>            
                </li>
            {{endif}}    
             <!-- <li>
                <a href="#" class="cbBtn" data-action="toggleSound" data-ipstooltip="" title='{lang="chatbox_togglesound"}'><i class="fa fa-volume-up"></i></a>
            </li> -->
            {{if \IPS\Application::load('bimchatbox')->can_Manage()}}
                <li>
                    <a href="#" class="cbBtn" data-ipsDialog data-ipsDialog-url='{url="app=bimchatbox&module=chatbox&controller=chatbox&do=cbmanage"}' data-ipsDialog-size='narrow' data-ipstooltip="" title='{lang="chatbox_management"}'><i class="fa fa-wrench"></i></a>            
                </li>
            {{endif}}        
</ul>

I tested some code but here it's my last code thx in advance for your help

Edited by unknoweb
solved

Share this post


Link to post
Share on other sites
What do you think? Remember the human.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×