lsascha / registeraddress

newsletter registration extension to tt_address made in Extbase + Fluid for Typo3. with double-opt in, user editing and unsubscribing
GNU General Public License v2.0
7 stars 18 forks source link

unsubscribe for FE_users #55

Closed zvenson69 closed 5 years ago

zvenson69 commented 5 years ago

Hi! All my newsletter recipients are FE_Users. When i try to make unsubscribe for these possible it's not working. Can i make the unsubscribe plugin work with fe_users or only with tt_address data? Please let me know! Thanks!

lsascha commented 5 years ago

Its possible, but not without a small extension to tell it to use fe_users and to add some probably missing fields etc.

Haven't tried it myself yet, but i think all you have to be aware of is the following:


First you need to map the table and fields to the fe_users table. You can see the mapping to the tt_address table in the ext_typoscript_setup.txt file.

I don't have the fe_users table fields in front of me, but you will probably have to extend the fe_users table with some fields. It will definetly be missing the registeraddresshash field. So put all missing fields into your own extensions ext_tables.sql file.

Of course the update script to fill missing hashes to already existing users will not work too, so you might want to put the class.ext_update.php into your own extension and change the used table name and field names accordingly if you need to have the update script.

also note that the Hook will also not work as it is currently hardcoded to the tt_address table. Maybe it can be made more general. Would have to look into that. But its simple and you can also put it into your own extension. See the Classes/Hook/DataHandlerHook.php file. That will just add a hash if you create a user using the TYPO3 Backend.

zvenson69 commented 5 years ago

Hey Isascha, wow - thank you very much for this! I hope i will be able to do this myself - but even with your nice insights i'm not sure if i can do this - will keep you updated here! thanks again

lsascha commented 5 years ago

Hi. I have build a small extension for that. You can find it here: https://github.com/lsascha/feusers_for_registeraddress

I am not sure why the Hook does not work yet though. But the update script works.

Only issue could be that when you create a fe_user using the provided plugin, it is of course created without username, password and group. So the fe_user is basicly not really valid. So it could be that you also need to extend it so a correct username and password etc. can be saved.

But i hope its still helpful.

lsascha commented 5 years ago

Oh. And you might need to add the Typoscript inside the Configuration/TypoScript/setup.txt yourself to the page template typoscript to make sure the new mapping is loaded after the mapping of the registeraddress extension.

zvenson69 commented 5 years ago

This is incredible! will try to get this to work! thank you very much - you already made my day!

lsascha commented 5 years ago

I will close this for now. Feel free to comment again if you have any question

zvenson69 commented 5 years ago

Hi Sascha - can't get it to work. When i try to add the fe_users for registeraddress to the static template it's not added or even saved. when i press savee it returns "sys template". This happens until the extension is deinstalled. Then i can add static templates again. I tried to add the content of setup.txt ty my page template but it still isn't working - no addresses are found:

The entered e-mail address was not found.

What can i do to get this to work? Thanks! Sven

lsascha commented 5 years ago

Thats odd. Do you use TYPO3 in Composer mode? And have you installed the Extension using composer?

I was actually only able to use the fe_user table when copy-pasting the setup.txt content directly into the Pages TypoScript. I was able to add it as static template, but i guess the order of loading was still wrong.

zvenson69 commented 5 years ago

Hi - no composer is not installed. Maybe im just installing your extension wrong? i downloaded the zip - unzipped - uploaded to typo3conf/ext and installed it. Can you provide an uploadable zip that i can install? Would be so great to get this to work. Thanks a ton for your help!

lsascha commented 5 years ago

That unzipping and uploading should work in non-composer installations. Can you try and rename the Extension directory to "feusersforregisteraddress" in your typo3conf/ext directory? Yours is probably called differently.

zvenson69 commented 5 years ago

i removed the "_" from the directories name. Now i could add the extension but still The entered e-mail address was not found I added constants but it's just not finding my email addresses. I also checked database and it seems that all fields are there... What can check for debugging?

lsascha commented 5 years ago

I think it still uses the tt_address table. So you need to add the fe_user table mapping TypoScript for to your page. And maybe clear the cache afterwards.

zvenson69 commented 5 years ago

I added this to my page template without success:

config.tx_extbase{ persistence{ classes{ AFM\Registeraddress\Domain\Model\Address > AFM\Registeraddress\Domain\Model\Address { mapping { tableName = fe_users recordType = Tx_Extbase_Domain_Model_FrontendUser columns { name.mapOnProperty = name gender.mapOnProperty = gender first_name.mapOnProperty = firstName middle_name.mapOnProperty = middleName last_name.mapOnProperty = lastName email.mapOnProperty = email registeraddresshash.mapOnProperty = registeraddresshash disable.mapOnProperty = hidden module_sys_dmail_html.mapOnProperty = moduleSysDmailHtml eigene_anrede.mapOnProperty = eigeneAnrede tx_directmailsubscription_localgender.mapOnProperty = txDirectmailsubscriptionLocalgender } } } } } }

Another thing: the column registeraddresshash is empty in my fe_users table. Do i need to generate these hashes first?

lsascha commented 5 years ago

Sorry. I can't reproduce your problem on my test installation. Have you added the static template of the registeraddress extension? And is your unsubscribe form on a subpage of the page with the static template attached and the table mapping?

And yes, your entries should have hashes generated or else unsubscribing will not work. But it should not be the cause of your mentioned problem.

You can generate these with the Update Script in the Admin Tools / Extensions Backend Module.

zvenson69 commented 5 years ago

yes - all is setup correctly i guess - unfortunately there is no update script in my extensions manager for the feusersforregisteraddress extension - could i sent you a backend access and you can have a look? I'm willing to pay for this...

lsascha commented 5 years ago

You can send me an E-Mail to lsascha@gmail.com and i can have a look if you want.

lsascha commented 5 years ago

Just as a note. i fixed some stuff now with the object and table mappings in the repository. So it should work now. I will close this ticket now. If there is any issue, don't hesitate to ask or reopen.