I have added field = fieldname, operator = equal to, and value = 0 on the conditions tab
Result: no mails are being send...
Probably because your condition doesn't make any sense. An image field will never have a value of 0. I'm guessing you're trying to condition against the approved column of a field. To do that you need to use a custom value substitution like the following.
Field: Custom > Value
Custom Value: [avatarapproved]
Operator: Not Equal To
Value: 1
This would pass the condition if the avatar image field is not approved. The approved column is always [FIELD_NAMEapproved] format for its substitution.
What do I do wrong and how can I configure it that for upload imageA, email A is send and for upload imageB, email B is send?
You'll likely need to do a field value comparison. That trigger contains the following variables.
Code:
$_PLUGINS->trigger( 'onAfterUserAvatarUpdate', array( &$user, &$user, $isModerator, $newFileName ) );
They count from left to right. So var1 is $user, var2 is $user (doubled due to legacy code), var3 is $isModerator, and var4 is $newFileName. It does not contain the field name of the field being uploaded to. It is properly going to be easier to use the below usage so you can compare new value vs old value to confirm that a field has actually changed values.
Global
Triggers: onAfterUpdateUser, onAfterUserUpdate
User: Automatic
Access: Everybody
Conditions (custom value)
1: [var1_FIELD_NAME] Not Equal To [var3_FIELD_NAME]
2: [var1_FIELD_NAMEapproved] Not Equal To 1
With the above it will check if the supplied FIELD_NAME has changed its value and that its approved column is not equal to 1 (so not approved). This will function for backend and frontend profile updates. So for example if you wanted to do this for the avatar field your conditions would look like the following.
1: [var1_avatar] Not Equal To [var3_avatar]
2: [var1_avatarapproved] Not Equal To 1
You can use this usage (minus the approved column since it only applies to image fields) for any field to perform an action on field value change.