need help with adding custom fields and accessing in campaign through extension.

mayank2342

New Member
In Simple terms, when we create a campaign,
1. on the first step i want to add two columns, which will be specific to each campaign, i know we can use this hook : after_active_form_fields, but i dont know how.
2. i want to access those values in my another hook : delivery_server_before_send_email, can anyone help?

also their docs page is down : https://hooks-docs.mailwizz.com/
 
Last edited:
Hello,
You have some examples on how this is used in the Recaptcha extension: apps/common/extensions/recaptcha/RecaptchaExt.php:119
But keep in mind, that adding those fields is not enough, they should be linked to some table in the database that should hold those fields and also a reference to the campaign.

Cosmin
 
Hello,
You have some examples on how this is used in the Recaptcha extension: apps/common/extensions/recaptcha/RecaptchaExt.php:119
But keep in mind, that adding those fields is not enough, they should be linked to some table in the database that should hold those fields and also a reference to the campaign.

Cosmin
i'm creating a campaign meta table, on activate extension. and then i'm retrieving and adding those data in my meta db along with my campaign id when form's save button is clicked, for the table, i;ve created a model file in my extensions common folder which looks like this :
<?php defined('MW_PATH') || exit('No direct script access allowed');
class MetaCampaignOption extends ActiveRecord
{
/**
* @return string the associated database table name
*/
public function tableName()
{
return '{{meta_campaign_option}}';
}
/**
* @return array validation rules for model attributes.
*/
public function rules()
{
return [
//rules
];
}
},
but when saving it gives error :

Error 500!​

Cannot instantiate abstract class CActiveRecord,​

sorry for the poor explanation, can you please figure out where am i going wrong.
thank you for the help.
 
Hello,
You have some examples on how this is used in the Recaptcha extension: apps/common/extensions/recaptcha/RecaptchaExt.php:119
But keep in mind, that adding those fields is not enough, they should be linked to some table in the database that should hold those fields and also a reference to the campaign.

Cosmin
Hi,
Thank you for the reference, the captcha extension has the things i need.
Mayank
 
Hello,
Your custom extension in the run() method should take care of registering your models. Take a look at the run method of the Recaptcha extension.

Cosmin
 
Back
Top