# Reverse events

An ordinary [event](Users-Events.md) runs for what its own user does. A reverse event goes the other way: it tells a user what **others** did in a folder they share. "A new file is in the project folder" is a reverse event.

## Turning it on

Reverse events are off on a new server, because every upload then has to be compared with the folders of other users. Turn on **User Manager Reverse Event Notifications** in [General](Prefs-General.md) first. Without it, the settings below are saved and nothing is sent.

## The two halves

A reverse notice needs a sender and a listener.

**The sender** is an event on the users whose activity shall be announced. In [the event editor](Users-Events-Editor.md):

| Part | Set |
|---|---|
| **Action** | **Send Reverse Notifications** |
| **Triggers** | under "When this user…": what shall be announced, such as **Uploads** |
| the groups to notify | leave empty to tell every user who has the folder, or name [groups](Users-Groups.md) to tell only their members |

Put it on `default` to have every user's activity announced.

**The listener** is an event on the users who shall hear of it:

| Part | Set |
|---|---|
| **Action** | **Send Email**, with a To address such as `{user_email}` |
| **Triggers** | under "When someone makes a change in one of this user's VFS folders…": **Uploads**, **Creates Folder**, **Deletes**, **Renames**, **Downloads** |
| **Condition** | **Always**, or one of the "below directory" entries to listen to one folder only |

Put it on a template to give it to a whole group of users.

## Who is told

When alex uploads a file, the server looks for every user who

1. has an event that listens for uploads, and
2. has, among their own folders, the place the file went to.

"The place" is the real location, not the name: a user who has the same storage folder under another name is told too. Each listener gets one notice with the files that are in **their** folders, and paths as they see them.

The mail can name who did it: `{user_reverse_event_trigger_user_name}`. The other user variables in the mail, such as `{user_name}` and `{user_email}`, are those of the listener.

By the server setting `reverse_events_skip_sender`, the user who did it is left out when they are a listener themselves.

## Subscriptions

Users can turn notices on for themselves, folder by folder, in the web interface:

1. Give the user the buttons **Subscribe To Events** and **Manage Subscribed Events**: see [Buttons](Users-WebInterface-Buttons.md).
2. Make an event with the action **Subscribe reverse notification event template** on the user, or on the template they inherit from. It is the pattern: its mail text is what subscribers get.
3. The user selects a folder, presses **Subscribe To Events**, and chooses what they want to hear of.

Each subscription becomes an event on the user, with a name that starts with `subscribe_`. They are in the list of the Events tab like the others, and can be looked at and deleted there. The user removes their own in **Manage Subscribed Events**.

The customization **Show subscribed events icon in the file listing** marks the folders a user subscribed to: see [Customizations](Users-WebInterface-Customizations.md).

## Things to know

- A reverse notice costs work on every activity: the server reads the listeners' folders to compare. On a server with many thousands of users, name groups in the sender instead of telling everybody.
- Nothing is sent to a user without a mail address.
- In the log, look for `Reverse event trigger` and `Reverse event does not match`: they say, per listener, whether a notice went out and why not.
