Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class "MailchimpWrapper" not found while use Unsubscribe #13

Closed
n3rotech opened this issue Mar 21, 2014 · 6 comments
Closed

Class "MailchimpWrapper" not found while use Unsubscribe #13

n3rotech opened this issue Mar 21, 2014 · 6 comments

Comments

@n3rotech
Copy link

i was wonder why get "class MailchimpWrapper" not found in phpunit if try to unsubscribe. (note: i have set Provider and Aliases, run composer dump-autoload). Thank you
error class mailchimpwrapper

@n3rotech n3rotech changed the title Class "MailchimpWrapper" not found Class "MailchimpWrapper" not found while use Unsubscribe Mar 24, 2014
@snipe
Copy link

snipe commented Aug 28, 2014

I'm having a similar problem:

if (Input::get('newsletter')=='1') {
        \Hugofirth\Mailchimp\MailchimpServiceProvider\MailchimpWrapper::lists()
        ->subscribe(
        'XXXXX', array(
        'email' => $user->email_address),
        array(
            'FirstName' => $user->first_name,
            'LastName' => $user->last_name)
        );
    } else {
        // Hugofirth\Mailchimp\MailchimpServiceProvider
        \Hugofirth\Mailchimp\MailchimpServiceProvider\MailchimpWrapper::lists()
        ->unsubscribe('XXXX',
            array(
            'email' => $user->email_address)
            );
}

Returns:

Symfony \ Component \ Debug \ Exception \ FatalErrorException Class 'Hugofirth\Mailchimp\MailchimpServiceProvider\MailchimpWrapper' not found

But it's only triggering this error on the unsub. Any ideas?

@snipe
Copy link

snipe commented Aug 28, 2014

Nevermind - I got it sorted :)

@MaartenW
Copy link

@snipe got sort of the same error. Care to elaborate on how you got it sorted? Thanks

@snipe
Copy link

snipe commented Nov 24, 2014

@MaartenW Honestly, I'm not sure I remember, it was a few months ago. I can show you the code that is working for me now tho. It may not be helpful, since I don't remember what I changed, but it's the best I can do.

// if they have checked the newsletter box
    if (Input::get('newsletter')) {

        // and they are not already subscribed
        if ($subscribed_status == 0) {

        // subscribe them
        try
            {
                MailchimpWrapper::lists()
                ->subscribe(
                'XXX', array(
                'email' => $user->email),
                array(
                    'FNAME'             => $user->first_name,
                    'LNAME'             => $user->last_name,
                    'update_existing'   => true,
                    'send_welcome'      => false,
                    'double_optin'      => false,
                    )
                );
                $subscribed_status = 1;
            } catch (Exception $e) {

            }

        }

    } elseif ($pending!=1) {

        // If they unchecked the subscribe box, and they were previously subscribed, unsubscribe them
        if ($subscribed_status==1) {

            try
            {
                MailchimpWrapper::lists()
                ->unsubscribe('XXX',
                    array(
                    'email'         => $user->email)
                    );
                $subscribed_status = 0;

            } catch (Exception $e) {

            }
        }

    }

@MaartenW
Copy link

MaartenW commented Dec 8, 2014

@snipe thanks. Your comment sent me in the right direction. For me it all had to do with caps... Followed a tut which was mixing up caps and non-caps.

@snipe
Copy link

snipe commented Dec 8, 2014

In retrospect, that sounds right. I'm glad you got it sorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants