GENERAL REQUIREMENTS:
- You are a professional php-developer
- You know Wordpress ([login to view URL])
- You know the Wordpress plugin Mailpoet / WYSIJA ([login to view URL])
- If needed I can grant you access to a test website with wordpress and Mailpoet
PROBLEM:
In Mailpoet it is possible to create custom fields, let's say the ZIP of a client.
I want to read out the VALUE of this field, but I didn't find a way to get it.
POSSIBLE HINT TO SOLVE IT:
I found this Mailpoet function, which returns the NAMES of the custom fields, but not the VALUES
WJ_Field::get_all(array('order_by' => 'name ASC'));
RESULT:
Array
(
[0] => WJ_Field Object
(
[table:WJ_Field:private] => wp_wysija_custom_field
[user_table:WJ_Field:private] => wp_wysija_user
[id] => 1
[name] => PLZ
[type] => input
[required] =>
[settings] => Array
(
[required] => 0
[validate] =>
)
)
)
YOUR TASK:
Develop a piece of code which returns the VALUES of a custom field of Mailpoet.
Hi there - My name is Jhalak. I’ve read your brief and can see that you’d like to build an Website. My team has 4 years experience designing and developing mobile apps and Websites. I would approach your project by starting with wireframes and getting the site completed, before starting the actual development phase. I am highly qualified for this project and would love to speak with you further about taking this project on. If you'd like to view my previous work, take a look at my Freelancer Portfolio.
Regards,
Jhalak
Thanks, Diamond looking forward for your reply.
Hi,
I checked the source code of mailpoet, and found a class WJ_FieldUser. Class WJ_Field access the wp_wysija_custom_field table which saves the name and setting of the custom fields, and the value of the custom fields for every user saves in the wp_wysija_use table. You can use the following code to get the value of custom fields of a user:
$UserFields = WJ_FieldUser::get_all(1);
foreach ($UserFields as $field) {
$field->value = $field->value();
$collection[] = $field;
}
print_r($collection);
Sincerely,
Emily