Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-03-17 16:30:35

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 228
Website

kuo_com_db: save com_connect messages to database

This is an experimental plugin that saves contents from any com_connect form to a database table. Admin can view those messages in Textpattern’s Extensions tab. The plugin could be useful if important stuff is sent using contact form — and if the form has a bad habit of not actually delivering messages.

This plugin can also be used as a launch pad for other plugin projects, like guestbooks, discussion forums, e-commerce… ;-)

Version 0.2:

Messages can now be removed per type: 1) delete messages marked as spam, 2) delete messages marked as important, 3) delete all messages.

Last edited by kuopassa (2019-03-23 11:43:07)

Offline

#2 2019-03-18 02:21:40

hidalgo
Member
From: Australia
Registered: 2008-02-05
Posts: 77
Website

Re: kuo_com_db: save com_connect messages to database

Great idea! I think the ability to delete a message would be handy too.

Offline

#3 2019-03-18 17:05:04

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 228
Website

Re: kuo_com_db: save com_connect messages to database

Thanks, hidalgo. That feature might come later. :-)

Offline

#4 2019-03-19 09:54:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,270
Website GitHub

Re: kuo_com_db: save com_connect messages to database

Nice! This is a great showcase for the power of the com_connect platform, thanks for writing it.

A couple of things. Firstly, if used with ext_file_attach to attach files to emails, you see:

Warning "htmlentities() expects parameter 1 to be string, array given"
in /path/to/public/textpattern/lib/txplib_misc.php(1870) : eval()'d code at line 679.

adminErrorHandler()
textpattern/lib/txplib_misc.php(1870) : eval()'d code:679 htmlentities()
textpattern/lib/txplib_misc.php(1870) : eval()'d code:615 kuo_com_make_list()
textpattern/lib/txplib_misc.php(1870) : eval()'d code:377 kuo_com_tbody()
textpattern/lib/txplib_misc.php:1989 kuo_com_extensions()
textpattern/index.php:272 callback_event()

The value of that particular field is an array of headers and mime types and base64’d content so I suggest either handling it to extract the salient points like file name and size or something, or just ignoring anything not a string. Not sure if this will also fail on multi-select fields or checkbox sets, but maybe they’re concatenated into a single string for delivery (can’t remember).

Secondly, if your archive date format is set to “hours/days ago” then the values for ‘created’ and ‘modified’ show the values since for recent emails. Not sure there’s a way round that, but I thought I’d mention it.

Thirdly, I’m curious why you chose to re-implement a lot of the core table handling functionality. You could probably cut the plugin size in half if you use the standard table rendering methods (see any of the table-ish panels in /include) and you’d also benefit from the automatic search, sort, pagination and column filtering built into core.

I appreciate that the table layout isn’t standard so maybe core doesn’t deliver some particular piece of functionality to build the table you want. If that’s the case, and it’s not possible to lay the table out in a slightly different way or core is not flexible enough, please let us know and we’ll look into ways of improving the table generation engine so it saves you code.

Thanks again for writing this, it’s fab!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2019-03-19 14:28:50

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 228
Website

Re: kuo_com_db: save com_connect messages to database

Thanks for writing good feedback, Bloke! I’ll try to improve the plugin when I have some time to think and write. :-]

Offline

#6 2019-03-23 11:45:03

kuopassa
Plugin Author
From: Porvoo, Finland
Registered: 2008-12-03
Posts: 228
Website

Re: kuo_com_db: save com_connect messages to database

This was now updated to version 0.2. The plugin tries to unset the data that comes from ext_file_attach, and hidalgo’s idea of deleting messages is also implemented.

Offline

#7 2022-03-16 08:58:41

hildebruns
Member
Registered: 2009-03-10
Posts: 35

Re: kuo_com_db: save com_connect messages to database

Hello,
I use the plugin. It works as expected for an initial user. But when I create a new user in Textpattern, he gets this error when calling the plugin “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 130072600 bytes) in …/textpattern /plugins/kuo_com_db/kuo_com_db.php on line 572”. I tested it on two different hosts.

Offline

#8 2022-04-05 07:57:14

hildebruns
Member
Registered: 2009-03-10
Posts: 35

Re: kuo_com_db: save com_connect messages to database

Now I could localize the problem. For the plugin there is a database table for the users. This table will not be updated. Only the first user is in it. I entered the new users with the ID in this table by hand. This allows a new user to access the plugin.

Offline

Board footer

Powered by FluxBB