Entity ID field that can refer to multiple tables?
One idea comes from extending the analogy of interfaces in object-oriented programming. You can have an IGeneratesNotification "interface" entity that the Posts and Photos entities "implement", as well as an IAuditable "interface" entity that the Posts and Users entities "implement". It would be possible for an entity to implement multiple interface entities, such as in the case of Posts. Here's a diagram of how this can be done.



Note that the fields containing references to the interface entities would be unique.

Advantages:


You can enforce referential integrity to the interface entity that can be implemented by one of several entities.
If there are fields common to all implementing entities, they can be abstracted out to the interface entity.


Disadvantages:


It is possible for the id of an interface entity to be present in 0, or more than one, implementing entities.
The service layer would be required to determine which entity the notification or audit action applies to before knowing which table to query.