<p>It sounds like this is something that could be done <a href="https://nystudio107.com/blog/enhancing-a-craft-cms-3-website-with-a-custom-module" rel="nofollow noreferrer">using a module</a>. You could use the sites field type to select the sites you want to enable the entry for, and then listen to the beforeSave event to enable the selected sites (and disable all others).</p>

<p>You would listen for, and act on, this event in your module's <code>init</code> method.</p>

<p>The beforeSave event gets called for <strong>every</strong> site the entry gets saved for, so it could be something like (untested):</p>

<pre><code>Event::on(Entry::class, Entry::EVENT_BEFORE_SAVE, function (ModelEvent $event) {
    // Get the entry from the event
    $entry = $event-&gt;sender;

    if (
        $entry-&gt;type-&gt;id == 1 // &lt;-- Section type ID for entry
        &amp;&amp; !in_array(
            $entry-&gt;siteId,
            $entry-&gt;getFieldValue('visibleOnSites')
        )
    ) {
        $entry-&gt;enabledForSite = false;
    }
}
</code></pre>

<p>This assumes that entries are enabled for every site by default, and that propagation for this section is active.</p>

CC BY-SA 3.0
2018-04-12T19:11:11.830Z
2018-04-12T19:11:11.830Z
Paul
<p>We've forked the plug-in and allowed for entry propagation trough different sites as a feature, if you enable propagation the plug-in will automatically enable the post for the selected sites.</p>

<p><a href="https://github.com/wirelab/craft3-sites-propegation-field" rel="nofollow noreferrer">https://github.com/wirelab/craft3-sites-propegation-field</a></p>

CC BY-SA 4.0
2019-08-26T11:26:36.557Z
2019-08-26T11:26:36.557Z
Len van Essen
<p>If a user has permission to publish on multiple sites, he by default publishes to all of them. If he wants to exclude some sites, he needs to go in each one and turn off the post for that site. This is ok if you have several sites, but on +100 sites it is a very time consuming task.</p>

<p>It occured to me that we could use one user account for publishing on one site and another for publishing on multiple sites, but again, if you don't want to publish on all 100+ sites, you still have to invest a lot of time to disable the post for unwanted sites.</p>

<p>I found this field type plugin, but i am not sure if it can accomplish what I want.
<a href="https://github.com/eastslopestudio/craft3-sites-field" rel="nofollow noreferrer">https://github.com/eastslopestudio/craft3-sites-field</a></p>

<p>I think something like a list with checkboxes would be ideal for this (like the one in user permissions for Sites) with the current Site being automaticaly initially checked. Or a multi select field maybe.</p>

<p>Is something like that doable? 
If not with core Craft then maybe with a plugin?</p>

<p>Thanks in advance for any advice!</p>

<craft3><entry><multi-site>
Craft 3 multi site publish options
# Craft 3 multi site publish options

(Asked by: username_0 on 2018-04-12)

If a user has permission to publish on multiple sites, he by default publishes to all of them. If he wants to exclude some sites, he needs to go in each one and turn off the post for that site. This is ok if you have several sites, but on +100 sites it is a very time consuming task.

It occured to me that we could use one user account for publishing on one site and another for publishing on multiple sites, but again, if you don't want to publish on all 100+ sites, you still have to invest a lot of time to disable the post for unwanted sites.

I found this field type plugin, but i am not sure if it can accomplish what I want.
<https://github.com/eastslopestudio/craft3-sites-field>

I think something like a list with checkboxes would be ideal for this (like the one in user permissions for Sites) with the current Site being automaticaly initially checked. Or a multi select field maybe.

Is something like that doable?
If not with core Craft then maybe with a plugin?

Thanks in advance for any advice!

**Tags:** craft3, entry, multi-site


---

## 2 answers

### Answer by username_1 on 2018-04-12. Score: 1

It sounds like this is something that could be done using a module. You could use the sites field type to select the sites you want to enable the entry for, and then listen to the beforeSave event to enable the selected sites (and disable all others).
You would listen for, and act on, this event in your module's init method.
The beforeSave event gets called for every site the entry gets saved for, so it could be something like (untested):
Event::on(Entry::class, Entry::EVENT_BEFORE_SAVE, function (ModelEvent $event) {
    // Get the entry from the event
    $entry = $event->sender;

    if (
        $entry->type->id == 1 // <-- Section type ID for entry
        && !in_array(
            $entry->siteId,
            $entry->getFieldValue('visibleOnSites')
        )
    ) {
        $entry->enabledForSite = false;
    }
}

This assumes that entries are enabled for every site by default, and that propagation for this section is active.


---

### Answer by username_2 on 2019-08-26. Score: 1

We've forked the plug-in and allowed for entry propagation trough different sites as a feature, if you enable propagation the plug-in will automatically enable the post for the selected sites.

<https://github.com/wirelab/craft3-sites-propegation-field>


---

