LiveChat is something you obviously don't need on your development sites, but there is no easy way of disabling the functionality through for example settings.php. A lot of other modules I use provide a global setting for enabling/disabling the functionality the module provides so I implemented this in LiveChat as well.

A patch is attached. This is the first patch I've ever made so fingers crossed. :p

Comments

TwiiK created an issue. See original summary.

twiik’s picture

rachel_norfolk’s picture

Status: Active » Needs work

Oh I like it!!

Nice one for a first patch, too! I do have a couple of questions, though.

1. How will we manage users that already have the module working but upgrade to a new version including this check? (hint: needs an upgrade hook to set variable in an already enabled module to TRUE)
2. Could we provide some help text on the toggle to suggest people can set it via settings.php?
3. Is there a way to look at the environment_indicator module and see what state it is in?

I’ll not rush in and do these myself - have a look!

twiik’s picture

1. I set the default variable value to TRUE so it shouldn't affect existing users in any way. There's no need for a hook to update it, it will just bypass my check until you manually set it to be FALSE in the admin settings.

2. I considered writing "This is useful for development environments" in the description text for the setting, but as far as I know this is fairly common practice and those who need it know how to use it, I guess. Examples of other modules I use which provide the same type of setting are:
https://www.drupal.org/project/advagg
https://www.drupal.org/project/reroute_email

For the advagg module the setting is presented as:

Label: Enable advanced aggregation
Description: Uncheck this box to completely disable AdvAgg functionality.

For the reroute_email module it's presented as:

Label: Enable rerouting
Description: Check this box if you want to enable email rerouting. Uncheck to disable rerouting.

And here's how we would use them in settings.php on a dev site:

$conf['reroute_email_enable'] = TRUE;
$conf['advagg_enabled'] = FALSE;
$conf['livechat_enabled'] = FALSE;

The reason being of course that we don't track settings.php in our git repositories and that way we can safely sync the database from a live site to a dev site and not have to worry about manually setting all the dev environment variables every time we do so.

3. I haven't used that module, but this is a variable just like any other so I don't see why not.

rachel_norfolk’s picture

Status: Needs work » Reviewed & tested by the community

1. Sorry - I really should have read it more carefully before commenting!! You are absolutely right - it would be fine for those upgrading.
2. It’s not important, just a thought.
3. Let’s keep things simple and go with the adopted standard you have mentioned.

I’ll set it to RTBC and, if no-one complains in a week, I’ll commit it to the dev branch for the next release.

Thanks for the patch!

rachel_norfolk’s picture

Assigned: Unassigned » rachel_norfolk
rachel_norfolk’s picture

Assigned: rachel_norfolk » Unassigned
Status: Reviewed & tested by the community » Fixed

applied to 7.x-1.x

git commit -m 'Issue #2618918 by TwiiK: Provide an easy way of disabling the functionality for dev environments' --author="git "

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.