Hook: mam_brevo_contact_attributes

Signature

$attributes = apply_filters( 'mam_brevo_contact_attributes', array $attributes, int $user_id );
Parameter Type Description
$attributes array NAME => value. Starts with FIRSTNAME and LASTNAME when the user has them.
$user_id int The WordPress user being synced.

Return the array.


Rules

  • Names are sent in UPPER CASE (the plugin upper-cases them for you). Brevo requires this.
  • The attribute must exist in the Brevo account, or Brevo drops the value. Use Create missing attributes in Brevo on the settings screen, and declare the type with mam_brevo_attribute_definitions.
  • Values must be scalars: string, number or boolean. Dates as YYYY-MM-DD. null values are left out, so a value you do not know does not overwrite one Brevo already has.
  • For a category (single choice) attribute you can send the option’s label, for example couple. It is matched to the option in Brevo (case does not matter) and sent as that option’s number. A number is sent as is.
  • EMAIL is ignored here. The email always comes from the WordPress user.
  • Values are sent as given. They are not sanitized.

When it runs

Inside the background sync job, each time a user is synced: signup, profile update, role change, mam_brevo_sync_user, backfill and “Sync one user now”. It also runs for the current admin when the settings screen lists the attributes this site sends.

Changes to the attributes are only sent when something triggers a sync. If your value changes on its own schedule (a plan renewal, a date passing), fire mam_brevo_sync_user at that moment.


Example

add_filter( 'mam_brevo_contact_attributes', function ( $attributes, $user_id ) {
    $user = get_userdata( $user_id );

    $attributes['ROLE']         = in_array( 'wedding-planner', (array) $user->roles, true ) ? 'planner' : 'couple';
    $attributes['WEDDING_DATE'] = get_user_meta( $user_id, 'wedding_date', true ) ?: null;
    $attributes['PLAN']         = get_user_meta( $user_id, 'plan', true ) ?: null;

    return $attributes;
}, 10, 2 );

  • MAM Brevo Email Manager Overview
  • Hook: mam_brevo_attribute_definitions
  • Hook: mam_brevo_sync_user

Metadata

Field Value
Article type Hook Reference
Plugin slug mam-brevo-email-manager
Applies to plugin version 26.41.1+ (category labels 26.41.2+)
Category Extending MAM Suite
Hook type filter
Audience PHP developer
Last verified 2026-10-05
Was this article helpful?
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!