Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#341 2020-05-16 15:19:49

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

Re: smd_query: Talk to the database directly via SQL

Thanks a lot Stef!

But I have to admit that my very problem was at the end not related to smd_query. I found out that it was in combination with smd_macro that caused the problem. I am using smd_query inside a smd_macro which until the update to 4.8.0 was working like a charm.

After I updated smd_query to 0.6.0 my problem was still there. First I tried to register the tags for smd_macro by putting the code for tag registration just inside the code on the top but no success. Maybe I miss something here? Would be good to know on how tag registration should be done in general to be able to help myself in the future. But I don´t want to go too much off-topic here.

For smd_macro: I know that I should not be using smd_marco anymore because txp forms can do the same and better. So I arranged all my macros in forms now and voila. Everything seems fine now.

Offline

#342 2020-05-16 15:24:29

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 9,844
Website

Re: smd_query: Talk to the database directly via SQL

demoncleaner wrote #323014:

I tried to register the tags for smd_macro by putting the code for tag registration just inside the code on the top but no success.

If you’re using the latest version then it should auto-register your tags. Strange if not.

I arranged all my macros in forms now and voila. Everything seems fine now.

Yay, good. While it works well, smd_macro is a massive hack so the more people that can move to core shortcodes, the better.


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

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

demoncleaner
Plugin Author
From: Germany
Registered: 2008-06-29
Posts: 110
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

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

Pemischl
Member
Registered: 2012-01-14
Posts: 2

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

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

etc
Developer
Registered: 2010-11-11
Posts: 3,989
Website

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

Board footer

Powered by FluxBB