[TYPO3] powermail custom field

luca mingusthecat at gmail.com
Tue Sep 23 18:55:39 CEST 2008


Hi Tapio,
thank you for your prompt reply.

I finally had time to look at that script.

According to your suggestion, I have modified the 
class.tx_powermail_db.php, but it seems we are referring to different 
version of the extension

Here how it look my (after the hacks I have applied...)


/****************************************************************/

             if (isset($this->conf['dbEntry.']) && 
is_array($this->conf['dbEntry.'])) { // Only if any dbEntry is set per 
typoscript

                /******hack****/ 
if($this->conf['dbEntry.']['activation.']['enable.']['value'])
 
$this->conf['dbEntry.']['activation.']['activationKey'] = 
'activationkey';  /******hack****/

                 foreach ($this->conf['dbEntry.'] as $key => $value) { 
// One loop for every table to insert

                     if 
($this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key]['_enable'], 
$this->conf['dbEntry.'][$key]['_enable.']) == 1) { // only if db entry 
is allowed for current table (dbEntry.tt_address._enable.value = 1)

                         // 1. Array for first db entry
                         if (isset($this->conf['dbEntry.'][$key]) && 
is_array($this->conf['dbEntry.'][$key])) { // Only if its an array

                             foreach ($this->conf['dbEntry.'][$key] as 
$kk => $vv) { // One loop for every field to insert in current table
                                 if (substr($kk, 0, 1) != '_' && 
substr($kk, -1) != '.') { // if fieldname is not _enable or _mm and not 
with . at the end

                                     if ($this->fieldExists($kk, 
str_replace('.','',$key))) { // if db table and field exists
                                         $db_values[$kk] = 
$this->cObj->cObjGetSingle($this->conf['dbEntry.'][$key][$kk], 
$this->conf['dbEntry.'][$key][$kk.'.']); // write current TS value to array
                         /******hack****/      }elseif ($kk == 
'activationkey') $db_values[$kk] = rand(10000000000); // generate random 
key  /******hack****/

                                 }
                             }

                         }

/***********************************************/

I cannot make it work....


Any idea?

Thank you



Tapio Markula ha scritto:
> luca kirjoitti:
>> Hi Tapio,
>>


>> probably I have missed lead you.
>>
>> What I need is to generate a random key which will be sent into the 
>> answer message and recorded into the database...without actually show 
>> it in the published form.
> 
> that needs some extra coding - I have looked the plugin and I didn't 
> find suitable hook - so XCLASS
> 
>> prefill {
>>     uid16 = TEXT
>>     uid16.data= date:U
>>     }
>>
>> but I need a unique key and the time stamp is not enough...
>>
>> At this point if I can fill the hidden input with a script generate 
>> key it would be (almost) perfect....
> apparently not supported
>>
>> Any clue?
> 
> look .../lib/class.tx_powermail_db.php
> 
> a quick hack is something like
> 
> 
> if (isset($this->conf['dbEntry.']) && is_array($this->conf['dbEntry.'])) 
> { // Only if any dbEntry is set per typoscript
>                                
>                                 
> if($this->conf['dbEntry.']['tt_address.']['enable.']['value'])
>                     
> $this->conf['dbEntry.']['tt_address.']['uid999999']='randomkey';
> ...
> 
> // 2. Insert static values to same array
>                     if (isset($this->conf['dbEntryDefault.'][$key]) && 
> is_array($this->conf['dbEntryDefault.'][$key])) { // Only if any 
> dbEntryDefault is set per typoscript
> 
> ...
> elseif ($sv == '[tstamp]') $db_values[$sk] = time(); // add current 
> timestamp
> elseif ($sv == '[randomkey]') $db_values[$sk] = rand(10000000000); // 
> generate random key
>                    
>                


More information about the TYPO3-english mailing list