Support » Plugin: MailPoet Newsletters (Previous) » Bug in Updating Custom Fields from Custom Form

  • I have followed all the tutorials and instructions on creating custom signup forms for Mailpoet, as I am trying to do a couple custom things. Everything else I have working, but I can’t seem to get a custom field to update along with a users other information. I have tried both approaches mentioned here and here.

    $data_subscriber = array(
         'user' => array(
             'email' => sanitize_email( $_POST['email'] ),
          	 'firstname' => sanitize_text_field( $_POST['firstname'] ),
          	 'lastname' => sanitize_text_field( $_POST['lastname'] ),
          ),
          'user_list' => array(
              'list_ids' => $list_ids
          ),
          'user_field' => array(
               'cf_1' => $phone_number
           )
    );
    \WYSIJA::get( 'user', 'helper' )->addSubscriber( $data_subscriber );
    

    Now, these do work if a new subscriber is being added from the custom form (the custom field is added and set), but it does not update an existing subscribers information. So if on the form the person is looking to update their subscriptions, how are they supposed to also be able to update custom fields (or their first/last name, for that matter) using the addSubscriber method? I have poured through the source code, but haven’t gotten anything to work or found an alternate method. I see that this is possible in the views/front/confirm.php file and found the referencing code in the controllers/front/confirm.php file (line 281-285) but it is the same call to WJ_FieldHandler::handle_all() which doesn’t seem to work for me at all on my custom form.

    Any ideas? Is this a bug? Intended behavior?

  • The topic ‘Bug in Updating Custom Fields from Custom Form’ is closed to new replies.