Forum

Thread tagged as: Question, MailChimp, Members

Mailchimp on Members Registration Form?

Is it possible to add Mailchimp to the Members App registration form?

The documentation suggests it is possible with Standard Forms but trying it on a Members form doesn't work for me. I thought I would check...

https://docs.grabaperch.com/addons/mailchimp/template-tags/

Dan Lee

Dan Lee 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, it should be fine. What are you trying?

Dan Lee

Dan Lee 1 points

I added perch_mailchimp to app attribute and along with double-optin="true" and send-welcome="true" to <perch:form> like so

<perch:form id="register" method="post" app="perch_mailchimp perch_members" type="default" double-optin="true" send-welcome="true">

I then entered some data and nothing eas stored in the admin area after submitting.

Drew McLellan

Drew McLellan 2638 points
Perch Support

That looks like it should work.

If you turn on debug and submit the form, what does it output?

Dan Lee

Dan Lee 1 points

Nothing showing in the debug on the registration page. I tested again and the form does submit to the Members App but not the Mailchimp App.

  • The site is on local machine
  • I have double checked that the API is in the Settings area
  • Below is the registration page and the debug on the Mailchimp App.

Registration Code

<perch:form id="register" method="post" app="perch_mailchimp perch_members" type="default" double-optin="true" send-welcome="true">

<fieldset>
    <legend>Your Details</legend>

    <div>
        <perch:label for="member_title">Title</perch:label>
        <perch:input class="radius" type="text" id="member_title" required="true" placeholder="Mr, Mrs, Miss, Dr" label="Title" />
        <perch:error for="member_title" type="required">Please add your title</perch:error>
    </div>

    <div>
        <perch:label for="first_name">First name</perch:label>
        <perch:input class="radius" type="text" id="first_name" required="true" label="First name" mailer="FNAME" />
        <perch:error for="first_name" type="required">Please add your name</perch:error>
    </div>

    <div>
        <perch:label for="last_name">Last name</perch:label>
        <perch:input class="radius" type="text" id="last_name" required="true" label="Last name" mailer="LNAME" />
        <perch:error for="last_name" type="required">Please add your name</perch:error>
    </div>

    <div>
        <perch:label for="job_title">Job Title</perch:label>
        <perch:input class="radius" type="text" id="job_title" required="true" label="Title" />
        <perch:error for="job_title" type="required">Please add your job title</perch:error>
    </div>

    <div>
        <perch:label for="email">Email</perch:label>
        <perch:input class="radius" type="email" id="email" required="true" placeholder="you@company.com" helper="PerchMembers_Members::check_email" mailer="email" />
        <perch:error for="email" type="required">Please add your email address</perch:error>
        <perch:error for="email" type="helper">That email address is already in use</perch:error>
    </div>

    <div>
        <perch:label for="password">Password</perch:label>
        <perch:input class="radius" type="password" id="password" required="true" match-with="password2" />
        <perch:error for="password" type="required">Please add a password</perch:error>
        <perch:error for="password" type="match">Passwords do not match</perch:error>
    </div>

    <div>
        <perch:label for="password2">Password again</perch:label>
        <perch:input class="radius" type="password" id="password2" required="true" />
        <perch:error for="password2" type="required">Please repeat your password</perch:error>
    </div>

</fieldset>

<fieldset>
    <legend>Your Organisation</legend>

    <div>
        <perch:label for="org_name">Organisation Name</perch:label>
        <perch:input class="radius" type="text" id="org_name" required="true" label="Organisation Name" />
        <perch:error for="org_name" type="required">Please add your organisation</perch:error>
    </div>

    <div>
        <perch:label for="org_type">Organisation Type</perch:label>
        <perch:input class="radius" type="text" id="org_type" required="true" label="Organisation Name" />
        <perch:error for="org_type" type="required">Please add the type of organisation</perch:error>
    </div>

    <div>
        <perch:label for="org_sector">Organisation Sector</perch:label>
        <perch:input class="radius" type="text" id="org_sector" required="true" label="Organisation Sector" />
        <perch:error for="org_sector" type="required">Please add the organisation's sector</perch:error>
    </div>
</fieldset>

<fieldset>
    <legend>Address</legend>

    <div>
        <perch:label for="address_one">Address Line 1</perch:label>
        <perch:input class="radius" type="text" id="address_one" required="true" label="Address One" />
        <perch:error for="address_one" type="required">Please add the first line of your address</perch:error>
    </div>

    <div>
        <perch:label for="address_two">Address Line 2</perch:label>
        <perch:input class="radius" type="text" id="address_two" label="Address Two" />
    </div>

    <div>
        <perch:label for="address_town_city">Town / City</perch:label>
        <perch:input class="radius" type="text" id="address_town_city" required="true" label="Town / City" />
        <perch:error for="address_town_city" type="required">Please add the twon or city</perch:error>
    </div>

    <div>
        <perch:label for="address_county_state">County / State</perch:label>
        <perch:input class="radius" type="text" id="address_county_state" required="true" label="County / State" />
        <perch:error for="address_county_state" type="required">Please add the county or state</perch:error>
    </div>

    <div>
        <perch:label for="address_country">Country</perch:label>
        <perch:input class="radius" type="select" id="address_country" label="Country" class="form-control" required="true" 
        options="Afghanistan,Ã…land Islands,Albania,Algeria,American Samoa,Andorra,Angola,Anguilla,Antarctica,Antigua And Barbuda,Argentina,Armenia,Aruba,Australia,Austria,Azerbaijan,Bahamas,Bahrain,Bangladesh,Barbados,Belarus,Belgium,Belize,Benin,Bermuda,Bhutan,Bolivia,Bosnia And Herzegovina,Botswana,Bouvet Island,Brazil,British Indian Ocean Territory,Brunei Darussalam,Bulgaria,Burkina Faso,Burundi,Cambodia,Cameroon,Canada,Cape Verde,Cayman Islands,Central African Republic,Chad,Chile,China,Christmas Island,Cocos (Keeling) Islands,Colombia,Comoros,Congo,Congo - The Democratic Republic Of The,Cook Islands,Costa Rica,Cote D'ivoire,Croatia,Cuba,Cyprus,Czech Republic,Denmark,Djibouti,Dominica,Dominican Republic,Ecuador,Egypt,El Salvador,Equatorial Guinea,Eritrea,Estonia,Ethiopia,Falkland Islands (Malvinas),Faroe Islands,Fiji,Finland,France,French Guiana,French Polynesia,French Southern Territories,Gabon,Gambia,Georgia,Germany,Ghana,Gibraltar,Greece,Greenland,Grenada,Guadeloupe,Guam,Guatemala,Guernsey,Guinea,Guinea-bissau,Guyana,Haiti,Heard Island And Mcdonald Islands,Holy See (Vatican City State),Honduras,Hong Kong,Hungary,Iceland,India,Indonesia,Iran - Islamic Republic Of,Iraq,Ireland,Isle Of Man,Israel,Italy,Jamaica,Japan,Jersey,Jordan,Kazakhstan,Kenya,Kiribati,Korea - Democratic People's Republic Of,Korea - Republic Of,Kuwait,Kyrgyzstan,Lao People's Democratic Republic,Latvia,Lebanon,Lesotho,Liberia,Libyan Arab Jamahiriya,Liechtenstein,Lithuania,Luxembourg,Macao,Macedonia - The Former Yugoslav Republic Of,Madagascar,Malawi,Malaysia,Maldives,Mali,Malta,Marshall Islands,Martinique,Mauritania,Mauritius,Mayotte,Mexico,Micronesia - Federated States Of,Moldova - Republic Of,Monaco,Mongolia,Montenegro,Montserrat,Morocco,Mozambique,Myanmar,Namibia,Nauru,Nepal,Netherlands,Netherlands Antilles,New Caledonia,New Zealand,Nicaragua,Niger,Nigeria,Niue,Norfolk Island,Northern Mariana Islands,Norway,Oman,Pakistan,Palau,Palestinian Territory - Occupied,Panama,Papua New Guinea,Paraguay,Peru,Philippines,Pitcairn,Poland,Portugal,Puerto Rico,Qatar,Reunion,Romania,Russian Federation,Rwanda,Saint Helena,Saint Kitts And Nevis,Saint Lucia,Saint Pierre And Miquelon,Saint Vincent And The Grenadines,Samoa,San Marino,Sao Tome And Principe,Saudi Arabia,Senegal,Serbia,Seychelles,Sierra Leone,Singapore,Slovakia,Slovenia,Solomon Islands,Somalia,South Africa,South Georgia And The South Sandwich Islands,Spain,Sri Lanka,Sudan,Suriname,Svalbard And Jan Mayen,Swaziland,Sweden,Switzerland,Syrian Arab Republic,Taiwan - Province Of China,Tajikistan,Tanzania - United Republic Of,Thailand,Timor-leste,Togo,Tokelau,Tonga,Trinidad And Tobago,Tunisia,Turkey,Turkmenistan,Turks And Caicos Islands,Tuvalu,Uganda,Ukraine,United Arab Emirates,United Kingdom,United States,United States Minor Outlying Islands,Uruguay,Uzbekistan,Vanuatu,Venezuela,Viet Nam,Virgin Islands - British,Virgin Islands - U.S.,Wallis And Futuna,Western Sahara,Yemen,Zambia,Zimbabwe" />
        <perch:error for="address_country" type="required">Please add the country</perch:error>
    </div>

</fieldset>


    <div>
        <perch:input class="radius" type="submit" value="Register" class="button radius" />
        <perch:input type="hidden" value="1" id="confirm" mailer="confirm_subscribe" />
    </div>

    <perch:success>
        <p>Thanks!</p>
    </perch:success>

</perch:form>

Debug in Mailchimp App Area

SELECT u.*, r.* FROM perch2_users u, perch2_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='86fc54d0a011dee20ce2c36d1dc7d1ae' LIMIT 1
UPDATE perch2_users SET userHash='f7eef744127d1ed906d176ebce296b46' WHERE userID=1
SELECT p.privKey FROM perch2_user_privileges p
SELECT * FROM (SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=1 OR userID=0 ORDER BY userID DESC) AS settings GROUP BY settingID
SELECT SQL_CALC_FOUND_ROWS DISTINCT * FROM perch2_mailchimp_subscribers ORDER BY subscriberID DESC LIMIT 0, 15
SELECT FOUND_ROWS() AS `count`
Attempting app installation: perch_mailchimp
SHOW TABLES LIKE "perch2_mailchimp_subscribers"
Setting alert: There are no subscribers yet. Have you imported the list? (notice)
Queries: 8
Memory: 2.0678
Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you have any redirects happening on the form submission? You should get debug if you've added it to the page. Do you get the closing </html> tag?

Dan Lee

Dan Lee 1 points

Worked out how to show the Debug on the Registration page... spot anything?

Before Submitting

Debug Message
SELECT * FROM perch2_pages WHERE pagePath='/register.php' LIMIT 1
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
Using template: /templates/members/forms/register.html

After Submitting

Debug Message
SELECT * FROM perch2_pages WHERE pagePath='/register.php' LIMIT 1
SELECT DISTINCT settingID, settingValue FROM perch2_settings WHERE userID=0
SELECT COUNT(*) FROM perch2_members WHERE memberEmail='joe.bloggs@uk-cpi.com'
SELECT COUNT(*) FROM perch2_members WHERE memberEmail='joe.bloggs@uk-cpi.com'
SELECT * FROM perch2_members_forms WHERE formKey='register.default' LIMIT 1
INSERT INTO perch2_members(memberAuthType,memberEmail,memberPassword,memberStatus,memberCreated,memberProperties) VALUES('native','joe.bloggs@uk-cpi.com','$P$B8QRjnprr9ddQFgSw1GYbR/xMUJsZZ.','pending','2015-04-30 12:10:52','{\"member_title\":\"Mr\",\"first_name\":\"Joe\",\"last_name\":\"Blogs\",\"job_title\":\"Designer\",\"org_name\":\"CPI\",\"org_type\":\"Science\",\"org_sector\":\"Manufacturing\",\"address_one\":\"Test\",\"address_two\":\"test\",\"address_town_city\":\"test\",\"address_county_state\":\"test\",\"address_country\":\"Albania\",\"confirm\":\"1\"}')
SELECT * FROM perch2_members WHERE memberID='5' LIMIT 1
No ids to log.
UPDATE perch2_members SET memberAuthID='5', memberStatus='active' WHERE memberID=5
No ids to log.
PerchMembers_Member Object
(
    [table:protected] => perch2_members
    [pk:protected] => memberID
    [static_fields] => Array
        (
            [0] => memberID
            [1] => memberAuthType
            [2] => memberAuthID
            [3] => memberEmail
            [4] => memberPassword
            [5] => memberStatus
            [6] => memberCreated
            [7] => memberExpires
            [8] => memberProperties
        )

    [field_aliases] => Array
        (
            [email] => memberEmail
            [status] => memberStatus
            [expires] => memberExpires
            [auth_id] => memberAuthID
            [id] => memberID
        )

    [api:protected] => PerchAPI Object
        (
            [app_id] => perch_members
            [version] => 1
            [Lang:PerchAPI:private] => 
        )

    [db:protected] => PerchDB_MySQL Object
        (
            [link:PerchDB_MySQL:private] => PDO Object
                (
                )

            [errored] => 
            [error_msg] => 
            [dsn] => mysql:host=localhost;dbname=eugreat;
        )

    [details:protected] => Array
        (
            [memberID] => 5
            [memberAuthType] => native
            [memberAuthID] => 5
            [memberEmail] => joe.bloggs@uk-cpi.com
            [memberPassword] => $P$B8QRjnprr9ddQFgSw1GYbR/xMUJsZZ.
            [memberStatus] => active
            [memberCreated] => 2015-04-30 12:10:52
            [memberExpires] => 
            [memberProperties] => {"member_title":"Mr","first_name":"Joe","last_name":"Blogs","job_title":"Designer","org_name":"CPI","org_type":"Science","org_sector":"Manufacturing","address_one":"Test","address_two":"test","address_town_city":"test","address_county_state":"test","address_country":"Albania","confirm":"1"}
        )

    [index_table:protected] => 
    [event_prefix:protected] => 
    [can_log_resources:protected] => 1
    [modified_date_column:protected] => 
)
Using template: /templates/members/forms/register.html
Drew McLellan

Drew McLellan 2638 points
Perch Support

Is the Mailchimp app in your apps.php ?

Dan Lee

Dan Lee 1 points

Yes it is.

Dan Lee

Dan Lee 1 points

I have it working!