Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mailchimp-3403152
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
mailchimp-3403152
Commits
649457b1
Commit
649457b1
authored
15 years ago
by
Lev Tsypin
Browse files
Options
Downloads
Patches
Plain Diff
User registration was not working correctly in some cases when newsletters were included,
#650974
parent
fbdcccfd
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mailchimp.module
+14
-7
14 additions, 7 deletions
mailchimp.module
with
14 additions
and
7 deletions
mailchimp.module
+
14
−
7
View file @
649457b1
...
...
@@ -17,6 +17,12 @@ define('MAILCHIMP_LISTTYPE_OPTOUT', 'optout');
* The list form fields are added to the registration and profile forms
*/
function
mailchimp_user
(
$op
,
&
$edit
,
&
$account
,
$category
=
NULL
)
{
// include the form in the user registration
if
(
$op
==
'register'
&&
variable_get
(
'mailchimp_user_register'
,
TRUE
)){
$form
=
mailchimp_subscribe_auth_form
(
NULL
,
$account
);
return
$form
;
}
if
(
in_array
(
$op
,
array
(
'insert'
,
'delete'
,
'update'
)))
{
$q
=
_mailchimp_get_api_object
();
foreach
((
array
)
_mailchimp_get_required_lists
()
as
$list
)
{
...
...
@@ -69,13 +75,15 @@ function mailchimp_user($op, &$edit, &$account, $category = NULL) {
*/
function
mailchimp_subscribe_auth_form
(
$form_state
,
$account
)
{
$form
=
array
();
$form
[
'uid'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
$account
->
uid
);
if
(
$q
=
_mailchimp_get_api_object
())
{
if
(
!
$account
->
uid
)
{
if
(
$account
->
uid
)
{
$form
[
'uid'
]
=
array
(
'#type'
=>
'hidden'
,
'#value'
=>
$account
->
uid
);
}
else
{
// user registration or admin creating new user
$account
->
roles
=
array
(
2
=>
'authenticated'
);
}
...
...
@@ -162,8 +170,7 @@ function mailchimp_subscribe_auth_form($form_state, $account) {
function
mailchimp_form_alter
(
&
$form
,
$form_state
,
$form_id
){
if
(
$form_id
==
'user_register'
){
if
(
variable_get
(
'mailchimp_user_register'
,
TRUE
)){
$form
[
'mailchimp'
]
=
mailchimp_subscribe_auth_form
(
NULL
,
$account
);
unset
(
$form
[
'mailchimp'
][
'submit'
]);
// need to set this here as the submit handler doesn't get triggered in hook_user
$form
[
'#submit'
][]
=
'mailchimp_subscribe_auth_form_submit'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment