Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#331 2020-05-16 15:30:34

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 228
Website

Re: smd_query: Talk to the database directly via SQL

Here we go… my bad! Didn´t realise that there was a later version. I was on 0.30.
But anyway – as you said – I am happy to have switched it to the more elegant version.
Thanks again!

Offline

#332 2020-11-10 14:18:11

Pemischl
Member
From: Vienna, Austria
Registered: 2012-01-14
Posts: 22
Website

Re: smd_query: Talk to the database directly via SQL

Would it be possible to delete comments older than a certain amount from an article. i tried this code in an article-form, but it didn’t work out:

<txp:if_comments>
<txp:smd_query query="DELETE FROM 'txp_discuss' WHERE parentid = '<txp:article_id/>' AND DATEDIFF( NOW( ) ,  posted ) >=30">
</txp:smd_query>
</txp:if_comments>

Offline

#333 2020-11-12 11:58:36

etc
Developer
Registered: 2010-11-11
Posts: 5,664
Website GitHub

Re: smd_query: Talk to the database directly via SQL

Pemischl wrote #326710:

Would it be possible to delete comments older than a certain amount from an article. i tried this code in an article-form, but it didn’t work out:

The query itself should work, provided the site is granted sufficient db permissions (stale cache?). But I wouldn’t recommend it, since if_comments pulls its data from articles comments_count field that will not be updated via this code.

Offline

#334 2021-07-19 15:00:09

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: smd_query: Talk to the database directly via SQL

Hi Stef

Got a warning about count for empty results, sent you a commit on GitHub.

Cheers.

PS: Another warning on php 7 about $pageout = “” it should be $pageout = array(); (in the textpattern modify plugin it s on line 143)

Last edited by Dragondz (2021-07-19 16:08:05)

Offline

#335 2022-10-03 17:12:27

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,559
Website GitHub Twitter

Re: smd_query: Talk to the database directly via SQL

Hi Stef

I got a problem with 0.6 version, i think it s not handling smd_query imbrication well, i will stau with 0.5.

Cheers.

Offline

Board footer

Powered by FluxBB