Patrik
Patrik

Reputation: 2247

Typo3: How to insert data into database in a hook with powermail

I need to insert data into a column in the database.

Which hook should I use?

How can I insert the data?

I'm very confused over how powermail works with hooks.

Upvotes: 1

Views: 1721

Answers (2)

maholtz
maholtz

Reputation: 3631

Just as addition: Powermail is able to create or edit tables in the database on its own. You can f.e. create tt_news records via powermail just by define the mapping via TypoScript. Have a closer look into the manual for that.

Upvotes: 0

Fedir RYKHTIK
Fedir RYKHTIK

Reputation: 9974

For example, You could use this hook : PM_SubmitBeforeMarkerHook, it contains $sessionData, with submitted data.

ext_localconf.php

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['powermail']['PM_SubmitBeforeMarkerHook'][$_EXTKEY] = 'EXT:'.$_EXTKEY.'/Ressources/Private/PHP/Hooks/powermail/class.user_PM_SubmitBeforeMarkerHook.php:&user_PM_SubmitBeforeMarkerHook';

class.user_PM_SubmitBeforeMarkerHook.php

<?php

class user_PM_SubmitBeforeMarkerHook {
    public function PM_SubmitBeforeMarkerHook (tx_powermail_submit &$pObj, &$markerArray, &$sessionData) {
         // Save data
    }
}

Upvotes: 1

Related Questions