Disable social sharing options Open edX tutor

Hello,

Does anyone know if it’s possible to disable the options for sharing courses on Facebook and Twitter?

image

Thanks.

This might be what you’re looking for?
https://openedx.atlassian.net/wiki/spaces/AC/pages/34734726/edX+Feature+Flags

SOCIAL_SHARING_SETTINGS

{
Note: Ensure 'CUSTOM_COURSE_URLS' has a matching value in cms/envs/common.py
'CUSTOM_COURSE_URLS': False,
'DASHBOARD_FACEBOOK': False,
'CERTIFICATE_FACEBOOK': False,
'CERTIFICATE_FACEBOOK_TEXT': None,
'CERTIFICATE_TWITTER': False,
'CERTIFICATE_TWITTER_TEXT': None,
'DASHBOARD_TWITTER': False,
'DASHBOARD_TWITTER_TEXT': None
}

Yes, thank you!

I tried to create a plugin but it doesn’t work:

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
(
“openedx-lms-common-settings”,
“FEATURES[‘SOCIAL_SHARING_SETTINGS’] =
‘CUSTOM_COURSE_URLS’: False,
‘DASHBOARD_FACEBOOK’: False,
‘CERTIFICATE_FACEBOOK’: False,
‘CERTIFICATE_FACEBOOK_TEXT’: None,
‘CERTIFICATE_TWITTER’: False,
‘CERTIFICATE_TWITTER_TEXT’: None,
‘DASHBOARD_TWITTER’: False,
‘DASHBOARD_TWITTER_TEXT’: None”
)
)

When I try to enable the plugin I get this error:

Error applying action: func=<function discover_module..load at 0x7fcbdad3aca0> contexts=[‘plugins’]’
Traceback (most recent call last):
File “/usr/local/bin/tutor”, line 8, in
sys.exit(main())
File “/usr/local/lib/python3.8/dist-packages/tutor/commands/cli.py”, line 27, in main
cli() # pylint: disable=no-value-for-parameter
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 1130, in call
return self.main(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 1055, in main
rv = self.invoke(ctx)
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/usr/local/lib/python3.8/dist-packages/click/core.py”, line 760, in invoke
return __callback(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/click/decorators.py”, line 38, in new_func
return f(get_current_context().obj, *args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/tutor/commands/plugins.py”, line 140, in enable
plugins.load(plugin)
File “/usr/local/lib/python3.8/dist-packages/tutor/plugins/init.py”, line 98, in load
hooks.Actions.PLUGIN_LOADED.do(name)
File “/usr/local/lib/python3.8/dist-packages/tutor/core/hooks/actions.py”, line 116, in do
self.do_from_context(None, *args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/tutor/core/hooks/actions.py”, line 135, in do_from_context
callback.do(
File “/usr/local/lib/python3.8/dist-packages/tutor/core/hooks/actions.py”, line 36, in do
self.func(*args, **kwargs)
File “/usr/local/lib/python3.8/dist-packages/tutor/plugins/v1.py”, line 56, in load
spec.loader.exec_module(module)
File “”, line 844, in exec_module
File “”, line 981, in get_code
File “”, line 911, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “/root/.local/share/tutor-plugins/social.py”, line 6
"FEATURES[‘SOCIAL_SHARING_SETTINGS’] =
^
SyntaxError: EOL while scanning string literal

Hi @antonio did you ever figure this out? I found this thread wanting to disable that social stuff too once I saw it showing up in my logs…

FWIW I can see that you have not the pre single quote ’ but the “fancy” single quote (I have no idea its name), that gets inserted when you use some non-plaintext editors: ‘ and I don’t know if that would be handled correctly. (The same goes for the double quotes.)

Also I couldn’t figure out the correct multi-line syntax for this (I kept also getting errors) but the following single-line version at least seems to pass the “tutor plugins enable ” sanity checks:

from tutor import hooks

hooks.Filters.ENV_PATCHES.add_item(
	(
	"openedx-lms-common-settings",
	"FEATURES['SOCIAL_SHARING_SETTINGS'] = {'DASHBOARD_FACEBOOK': False,'CERTIFICATE_FACEBOOK': False, 'CERTIFICATE_FACEBOOK': False,'CERTIFICATE_FACEBOOK_TEXT': None, 'CERTIFICATE_TWITTER': False, 'CERTIFICATE_TWITTER_TEXT': None,'DASHBOARD_TWITTER': False,'DASHBOARD_TWITTER_TEXT': None}",
	)
)

As far as I can tell though this isn’t working, because those icons you showed at the top are still present on my About class pages…