Published read / unread API

Hey,

I’m trying to use the published section to publish interesting articles with the API and share the published link with my friends. In the start everything was working nicely but at some point the articles I published through the API were always set to “read” automatically. Can anyone point me in the direction where I can edit this myself in the database, I’ve tried setting the “unread” property with this query:
update ttrss_user_entries set unread=1 where ref_id=(select id from ttrss_entries where link=’"+artURL+"’ limit 1 )
The problem is that the link is not an identifier and that I’m not sure if this is the correct table or way to tackle this.

Kind Regards

that’s how it works, if you share something you likely read it yourself already so it doesn’t make much sense to set it unread

i’m not sure why is this a problem for you if your overall goal is sharing stuff with your friends because

  1. the article will still appear in the generated feed
  2. other people don’t share your unread or read statuses for articles, obviously

btw this looks like an sql injection ready to happen

if you really want to see the article as unread for whatever reason you can change false to true in classes/article.php:152 (there’s i think two more places where INSERT … unread false is used, should be easy to figure out) i guess

Hey, thanks for the reply and help.
I’ll go search in the class you mentioned. I wasn’t complete in explaining what I was trying to do. I’d like to have them as unread for a specific user I use to access API. At the end of each day I would then get the unread counter of the published feed and send that out to my people by a mailscript. Then my goal was to set everything in published as read. So each day only the new articles in published get counted and sent out. But I still have to figure out how to do that.

this seems very convoluted, also you’re going to see those articles in special feeds and mark them as read accidentally by scrolling past them if you actually use tt-rss yourself.

i would suggest you skip all this bullshit and just let them to subscribe to the feed. alternatively, process the feed by an external script, count new articles and send mails accordingly, without relying on modifying tt-rss database.

that said you can easily set shared article unread, it’s going to look like this:

update ttrss_user_entries set unread = true where ref_id in 
   (select id from ttrss_entries where link = '<your shared link>') and feed_id is null and owner_uid = <your user id>

feed_is is null means article was shared externally

enjoy

if you have multiple articles with exactly same link for specific user just take the latest one by the timestamp

Hey, thanks again.
I modified the flag in article.php and rssutils.php and it worked fine. I can use you latest reply to put em on read after I send out the mails. Thank you!