I used the embedded feature to tie together a blog with my forum. While testing I deleted all those posts. Now that I’m trying to re-create the integration I realised that deleting posts just don’t actually delete them, it just hides them. So, now the integration is broken because users don’t have access to them.
How can I:
Really delete the topics so that the embedding can re-create them?
OR find a list of all the “deleted” posts so that I can undelete them?
@Trash: Thanks, but this setting doesn’t apply to topics, only to posts. In any case, I don’t think it even really deletes them from the database, which is what I’m asking for.
This site setting is unrelated – it only applies to posts deleted by the author, which will stick around as (deleted by author, will be removed in 24 hours unless flagged) for the specified time.
Profiles with deleted topics once showed a red “notification” to staff members, but it seems to be gone. Maybe this was dropped when the Activity page was restructured (by @sam if I recall correctly).
You can definitely use the Data Explorer to find deleted topics, though.
And here’s how:
Run this query:
SELECT *
FROM topics
WHERE deleted_at is not NULL
AND archetype = 'regular'
Look through the list to find the topic, and memorize the ID.
Then, visit /t/<id> in your Discourse install to view the topic. From there, you can easily restore the topic.
@DeanMarkTaylor: thanks for pointing out this helpful, though well-hidden, feature. But it only lists posts, not topics.
The solutions that @fefrei and @cpradio suggested work fine, though the latter is simpler to use.
Unfortunately I can’t undelete topics at all. I have two admin accounts, the one that was used during embedding to create the topics in the first place ( adminbot) and my personal account (alex). I tried undeleting the topics with both accounts and neither works. The topics remain deleted.
This is risky, and I’d advise you wait until a Discourse Team member can provide better feedback, but something like this should work from the Rails console, so long as you know the topic ids you want to delete.
I’m having trouble following as there at least 2 if not 3 issues being discussed.
In regards to Topics, in the context of deleting / undeleting topics Discourse considers the OP as the Topic. That is, the topic is the first post.
In other words, if the first post is deleted (the trash can icon), the topic is deleted. Regardless of how many replies it might have.
Conversely, if the first post has been deleted, the “counter-clockwise circular arrow” icon can be used to undelete the OP, thus in effect undeleting the topic.
As far as “really” deleting a topic, as in removing all trace of it from the database. I don’t know, but I would strongly suggest this not be attempted.
There is a lot of cross-indexing of tables and unless there is some type of DELETE CASCADE that I haven’t seen yet things could break in the most horrible way imaginable.
@Mittineague: I’ve done a sloppy job of describing what the issue is. Let me try again. I’m usually better on the 2nd try.
I want to start embedding topics on a live site. Unfortunately, I already set up embedding in the past. While I was testing things, I deleted the topics that were thus created.
Problems:
I am not able to undelete the embedded topics even with the account that created them. I undeleted two of them, but the rest refuse to be undeleted. No idea why.
I am not able to totally remove the embedded topics from the database.
Either would work (and I would prefer the second), but neither does. So I’m stuck. Ideas?
That is bizarre, as that should be generating something in the Admin > Logs > Error Logs (which is actually located at /logs). As that 500 Internal Server Error is an error on the backend.
@eviltrout Can you please elaborate a little bit? Other forum users have suggested I’ve stumbled into a bug.
Yes and it’s fine.
I work for a higher education consortium. The private Discourse is a forum for the members of that consortium (a few hundred users at present). The comments are for our public blog but on our site they’re only visible to members. I also plan to use the embedding system for other content as well. The idea is to allow members to quickly open a discussion on a blog post, an event, or other piece of content. That’s why, ideally, I wouldn’t want to create entries for all the new content.
I’m not sure if you’ve hit a bug or not, but I suspect it is related to the TopicEmbed table. Since you can’t recover the topics, I suspect you remove all the entries in the topic_embeds table via the database console, then let embedding recreate the topics.
Just to be clear, you are aware that you can’t post via embedding right? It’s only for displaying. It’s usually meant to attract people to the forum content.
I feel daft for asking, but I’m not able to find any documentation on how to do this. Any pointers?
Yep. I realise that. That’s why I’m more interested in a gateway button like “Discuss in our forum”, that take the user to a new topic, populated with content from the site, or to an existing topic, if it’s already been created. (Because our Discourse is private anyway and only logged in users would be able to see the posts on the site.)