Support » Plugin: LiveChat - WP live chat plugin for WordPress » Allow non-Administrators to edit plugin settings

  • Resolved Patrick Johanneson

    (@pjohanneson)


    Related: https://wordpress.org/support/topic/use-chat-on-editor-role/

    We are running a WordPress Multisite network, and we don’t give any users Administrator privileges on their sites. It would be handy if there was a way — say, by using a filter — to allow Editors to make changes to the plugin’s settings.

    For instance, in plugin_files/LiveChatAdmin.class.php, replace:

    
    		add_menu_page(
    			'LiveChat',
    			$this->is_installed() ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
    			'administrator',
    			'livechat',
    			array( $this, 'livechat_settings_page' ),
    			$this->module->get_plugin_url() . 'images/livechat-icon.svg'
    		);
    
    		add_submenu_page(
    			'livechat',
    			__( 'Settings', 'wp-live-chat-software-for-wordpress' ),
    			__( 'Settings', 'wp-live-chat-software-for-wordpress' ),
    			'administrator',
    			'livechat_settings',
    			array( $this, 'livechat_settings_page' )
    		);
    
    		add_submenu_page(
    			'livechat',
    			__( 'Resources', 'wp-live-chat-software-for-wordpress' ),
    			__( 'Resources', 'wp-live-chat-software-for-wordpress' ),
    			'administrator',
    			'livechat_resources',
    			array( $this, 'livechat_resources_page' )
    		);
    

    …with:

    
    		add_menu_page(
    			'LiveChat',
    			$this->is_installed() ? 'LiveChat' : 'LiveChat <span class="awaiting-mod">!</span>',
    			apply_filters( 'lc_user_menu_level', 'administrator' ),
    			'livechat',
    			array( $this, 'livechat_settings_page' ),
    			$this->module->get_plugin_url() . 'images/livechat-icon.svg'
    		);
    
    		add_submenu_page(
    			'livechat',
    			__( 'Settings', 'wp-live-chat-software-for-wordpress' ),
    			__( 'Settings', 'wp-live-chat-software-for-wordpress' ),
    			apply_filters( 'lc_user_menu_level', 'administrator' ),
    			'livechat_settings',
    			array( $this, 'livechat_settings_page' )
    		);
    
    		add_submenu_page(
    			'livechat',
    			__( 'Resources', 'wp-live-chat-software-for-wordpress' ),
    			__( 'Resources', 'wp-live-chat-software-for-wordpress' ),
    			apply_filters( 'lc_user_menu_level', 'administrator' ),
    			'livechat_resources',
    			array( $this, 'livechat_resources_page' )
    		);
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author LiveChat

    (@livechat)

    Hi @pjohanneson — while there may be some security concerns, we understand that most companies, including yours, must have robust security precautions in place. This could be useful and we’ll have a discussion around the implementation.

    Separately, thanks for going the extra mile and creating that example — we’ll have it reviewed.

    Mind reaching us at apps[at]livechatinc.com so we can have your contact details in case we need to discuss this further?

    Thread Starter Patrick Johanneson

    (@pjohanneson)

    Sent my contact info.

    If it helps your discussions, I’ve implemented the above code changes, and it’s working just fine (I granted Editor-level users access to the settings).

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Allow non-Administrators to edit plugin settings’ is closed to new replies.