Access Custom Tags / Fields

Jamie Whittingham

Active Member
Hi @twisted1919

I'm playing around with an Ext .... when a subscriber is being subscribed to a list, I'd like to run a few checks and tasks. One of these tasks is adding some data into a custom tag / field but im not sure how to do this.

Could you please point me in the right direction.

Thanks
 
Unfortunately there's no direct way to do this atm.
What i can do at most, is to add new action that you can hook into, something like:
Code:
// available prefixes for each app you want this to run into: frontend_, backend_, api_, console_,
Yii::app()->hooks->addAction('frontend_model_list_subscriber_aftersave', function(ListSubscriber $subscriber){
    // do whatever with $subscriber here.
});
 
So if my limited understanding of Yii ...... is correct

$subscriber
would be an array of all data relating to the subscriber?
If this is the case then it would / should / could contain the custom data field values? and I would be abe to update themand then save the $subscriber array back into the DB?

Is this correct?

Thanks
 
$subscriber would be an instance of ListSubscriber, so you can then do:
Code:
$subscriber->loadAllCustomFieldsWithValues();
to get back an array where the keys are the custom fields names and the values are the custom field values.

If you look inside apps/common/models/ListSubscriber.php you'll see more info about the subscriber custom fields.
 
$subscriber would be an instance of ListSubscriber, so you can then do:
Code:
$subscriber->loadAllCustomFieldsWithValues();
to get back an array where the keys are the custom fields names and the values are the custom field values.

If you look inside apps/common/models/ListSubscriber.php you'll see more info about the subscriber custom fields.
and after these fields and their values are changed, how is that written back to the $subscriber (and hence the dbf)?
 
Back
Top