Disabling email template for subsites
-
Hello, I implemented an email template with tarpaulin. This email template includes the logo and branding of the main site. When a subsite user sends an email to their customer/user, the parent site’s email template is used and the parent site’s branding appears. This causes some confusion.
Can I disable the email template for subsites? Any options or suggestions for this?
-
Hello @thecreator01,
I hope you’re doing great!
Could you please check if the following works as a workaround:
1. On the network level make sure the blank template is selected, by clicking “Start from Scratch” in Branda >> Emails >> Email Template:
https://prnt.sc/Je8hQhcpCa7W
https://prnt.sc/bc7u1ydtyMQc2. Navigate to Branda >> Settings >> Permissions >> Subsite Controls, and make sure that “Email Template” is enabled on subsites:
https://prnt.sc/4OkNL06aIrS13. Navigate to the main site’s Branda >> Emails section, and enable the template which you’d like to be using on the main site.
That’s it. Optionally, if you have previously enabled Branda for some user roles in Branda >> Settings >> Permissions >> User Permissions, but would like to disable access to the the email template for those roles, or for particular users, you can do this in Branda >> Admin Area >> Admin Menu: https://prnt.sc/7w99i4N2dGRx
I hope this helps. Please let us know if you have any questions.
Best Regards,
DmytroHello, thank you for your response. @wpmudevsupport16
I guess I didn’t explain the problem. First of all, isn’t the branda accessible only to the super admin (network administrator)? All settings here are for subsites.
However, the custom email template I implemented is used for all subsites. For example, woocommerce order e-mails that are active on subsites are used with the e-mail template I applied with branda. However, what I want is for the emails in the subsite not to use the email template I implemented in branda.
So I don’t want subsite users to access any branda settings. (Like using their own custom email templates)
Just disabling the email template applied in branda and setting email templates sent from subsites as default.
Thank you for response!
First of all, isn’t the branda accessible only to the super admin (network administrator)?
That depends on the settings on “Branda -> Settings -> Permissions” page.
You decide there whether you want to keep all settings “multisite wide” (that’s “Subsite Controls”option set to “None”) or if you want to allow settings some of the options differently for different subsites (that’s if you select either “All” or “Custom” option).
Then in “User Permissions” section on the same page you can select which user roles have access to those settings.
So what you can do here is:
– make sure that no user roles are enabled (except for default “Network Administrator” – that’d be superadmin)
– and set “Subsite Controls” to “Custom”, disabling everything except “Email Template”.This way your subsite users/admins will not be able to change those settings but you, as a superadmin, will be able to set different templates (in this case “blank”) for subsites.
Currently that’s the only “out of the box” way to configure Branda in different way for main site and subsites.
Disabling templates all together for subsites “automatically” and without enabling any “subsite controls” would require some custom code but I’m not sure if there are necessary filters built-in into plugin code to make it possible.
I’ve asked our developers about it so they’ll check and see if we could provide such solution. If it’s doable, we’ll share the code with you, otherwise we’ll let you know if it can’t be done.
I would, however, appreciate some patience as our developers are dealing with a lot of complex tasks on daily basis and their response time may be a bit longer than ours. We’ll update you here as soon as we got feedback from them.
Kind regards,
AdamHi again @thecreator01
Apparently, I got response faster than I expected ??
Adding below code to the site should do the trick and make all the subsites NOT use Branda’s e-mail templates; only a main site will use them. I tested it on my test setup and it seems to work just fine.
The code is:
<?php add_action( 'init', 'wpmudev_remove_sub_branda_email_template' ); function wpmudev_remove_sub_branda_email_template() { if ( is_main_site() ) { return; } global $wp_filter; $tag = 'wp_mail'; $hook_method = 'wp_mail'; $hook_class = 'Branda_Email_Template'; if ( ! isset( $wp_filter[$tag] ) ) { return; } foreach ( $wp_filter[$tag]->callbacks as $key => $callback_array ) { foreach ( $callback_array as $c_key => $callback ) { if ( substr_compare( $c_key, $hook_method, strlen( $c_key ) - strlen( $hook_method ), strlen( $hook_method ) ) === 0 ) { if ( $callback['function'][0] instanceof $hook_class ){ unset( $wp_filter[$tag]->callbacks[$key][$c_key] ); } } } } }
To add it to the site:
– access your WordPress install using FTP, cPanel “File Manager” or similar way
– create an empty file with a .php extension (e.g. “branda-subsites-disable-templates.php” or similar) in the “/wp-content/mu-plugins” folder of your site’s WordPress install
– copy above code and paste it into that file
– save the file and purge all cache on site/serverand it should then work out of the box.
Kind regards,
AdamHello, thank you very much for your help. @wpmudev-support8
Yes this code works the way I want and it’s great ?? Thanks again.
Hello @thecreator01,
Thank you for the confirmation! Glad to hear the code snippet works as expected.
We’ll be marking this thread as resolved for now, but please feel free to reopen it if you have any further questions, or there’s anything we can help you with.
Best Regards,
Dmytro
- You must be logged in to reply to this topic.