Jump to content
WebFlake
  • 0

[Solved] How save settings for each member ?


unknoweb

Question

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
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
As your topic appears to be a support topic for IPS 4.2, we have moved it to the appropriate forum.
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

  • 0
The question(s) in this support topic have been answered and the topic author has resolved their issue. This topic is now closed. If you have other questions, please open a new topic.
  • Support Team - September 9th, 2017 - June 8, 2018
  • Junior Moderator - December 14th 2018 - November 16th, 2019
  • Designer - November 16th, 2019 - June 5th, 2020
  • Moderator - June 5th, 2020 - August 28th, 2020
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...