Skip to Content.
Sympa Menu

en - RE: [sympa-users] Populating Subscriber metadata from datasources

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: Steve Shipway <address@concealed>
  • To: "address@concealed" <address@concealed>
  • Subject: RE: [sympa-users] Populating Subscriber metadata from datasources
  • Date: Tue, 2 Jun 2015 05:12:30 +0000

Here’s an easy way to do it for include_list in 6.1.

 

In the file List.pm, function _include_users_list, around line 8700, after the check for user already included –

 

        ## Check if user has already been included

        if ($users->{$user->{'email'}}) {

            if ($tied) {

                %u = split "\n",$users->{$user->{'email'}};

            }else {

                %u = %{$users->{$user->{'email'}}};

            }

        }else {

            %u = %{$default_user_options};

            $total++;

        }

 

    # SJS START: copy over custom attributes

    if($user->{'custom_attribute'}) {

        if( !ref $user->{'custom_attribute'} ) { # should never happen

            my %custom_attr = &parseCustomAttribute($user->{'custom_attribute'});

            $user->{'custom_attribute'} = \%custom_attr;

        }

        foreach my $k ( keys %{$user->{'custom_attribute'}} ) {

            $u{'custom_attributes'}{$k} = $user->{'custom_attribute'}{$k};

        }

        $u{'custom_attribute'} = &createXMLCustomAttribute($u{'custom_attributes'});

    }

    # SJS END

 

This little snippet will copy over custom attributes on inclusion from another local list, preserving any additional local attributes, provided the list has attributes of the same name.  Tests out OK and works here in our 6.1.23.

 

This one was easy; doing the same for LDAP and SQL requires adding config fields to map returned values to attributes, so I’m not going to knock that one out so quickly.

 

Steve

 

Steve Shipway

address@concealed

(GNU Terry Pratchett)

 

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature



  • RE: [sympa-users] Populating Subscriber metadata from datasources, Steve Shipway, 06/02/2015

Archive powered by MHonArc 2.6.19+.

Top of Page