[% FOREACH pa_class IN patron_attribute_classes %]
diff --git a/opac/opac-memberentry.pl b/opac/opac-memberentry.pl
index e33ab0391e..3eb94b2ab6 100755
--- a/opac/opac-memberentry.pl
+++ b/opac/opac-memberentry.pl
@@ -190,6 +190,7 @@ if ( $action eq 'create' ) {
$borrower{password} = Koha::AuthUtils::generate_password(Koha::Patron::Categories->find($borrower{categorycode})) unless $borrower{password};
$borrower{verification_token} = $verification_token;
+ $borrower{extended_attributes} = to_json($attributes);
Koha::Patron::Modification->new( \%borrower )->store();
#Send verification email
diff --git a/opac/opac-registration-verify.pl b/opac/opac-registration-verify.pl
index 99651eef5c..90eb16e629 100755
--- a/opac/opac-registration-verify.pl
+++ b/opac/opac-registration-verify.pl
@@ -67,12 +67,19 @@ if (
delete $patron_attrs->{timestamp};
delete $patron_attrs->{verification_token};
delete $patron_attrs->{changed_fields};
+ delete $patron_attrs->{extended_attributes};
my $patron = Koha::Patron->new( $patron_attrs )->store;
Koha::Patron::Consent->new({ borrowernumber => $patron->borrowernumber, type => 'GDPR_PROCESSING', given_on => $consent_dt })->store if $consent_dt;
if ($patron) {
- $m->delete();
+ if( $m->extended_attributes ){
+ $m->borrowernumber( $patron->borrowernumber);
+ $m->changed_fields(['extended_attributes']);
+ $m->approve();
+ } else {
+ $m->delete();
+ }
C4::Form::MessagingPreferences::handle_form_action($cgi, { borrowernumber => $patron->borrowernumber }, $template, 1, C4::Context->preference('PatronSelfRegistrationDefaultCategory') ) if C4::Context->preference('EnhancedMessagingPreferences');
$template->param( password_cleartext => $patron->plain_text_password );