Gabriel Torres

Hide topics that are too old

Recommended Posts

You create a custom action for hiding old topics. Give it an argument of a forum topic. Then create a rule that uses that custom action as a trigger. Check that the topic is in the forum of your choice and that its start date is older than your threshold, and if so, hide it.

Then manually schedule that custom action from the custom actions acp. Schedule it first as a one time thing and choose just a single topic to test on. Test both a topic before your threshold and after (and one from another forum also) to make sure you have your conditions set correctly and that only the right topics are being hidden.

Once you are sure your rule is working correctly. Schedule the custom action to bulk process your topics on a recurring basis. 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @Kevin Carwile

Sorry for not getting back to you on this sooner. I was able to create this rule and in fact I think I finally got all the logic behind how Rules work, it took me a while.

I have one question for you, and please correct me if I am wrong. It seems that the custom actions scheduling occurs only for new topics. So, for example, if we want a topic to be automatically hidden after, say, one year, the app will create a scheduled action for one year after the topic was created. So the rule won't be applied to topics created before the rule was created.

Is there a way to create a rule that would run through a cron job (for example), so we could force it to be applied to topics created before the rule?

I hope I am making myself clear enough to understand what I mean!

Many thanks! :)

Share this post


Link to post
Share on other sites

You can create custom actions and then schedule them manually to run as a bulk processor for any given argument in your custom action. So, if you have a custom action with a topic argument, you can schedule it to run in bulk for every topic on your site.

Its just then a matter of putting the correct rules on it to accomplish your task.

  • Thanks 1

Share this post


Link to post
Share on other sites

As I just went through similar rule creation (automatically lock topics after certain amount of time), maybe I can provide some help. 

You will need two rules - one to hide in bulk all already old topics and one that will handle future hiding of all new topics. 

For the bulk rule:

1. Create custom action that has a topic as argument. 

2. Create a rule that is triggered by the custom action and hides all topics that have not been updated after 20.08.2017 (for example). Select whatever conditions you prefer. 

3. Run the custom action right now - it should go through all topics and hide those not updated in the last year. 

4. You remove this rule or disable it, it is useful only for one time. 

 

For the ongoing rule, it seems that you got it covered, but for someone that might be looking for help with it:

1. You create one rule that has event "Topic is updated" and its action is the custom action you created earlier. The key here is to mark the rule to be executed at a future date, 1 year from the last update. 

2. You create a second rule, triggered by the custom action that hides the topics based on the trigger of the first rule. 

Actually, there is an example rule of this type here: https://invisioncommunity.com/files/file/7373-rules-starter-example-rules-pack/

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

One more thing I remembered. There will be some topics that you will probably have to hide manually - those that are updated in the last year (thus the bulk rule does not catch them), but that have been updated before today (thus the new rule doesn't catch them). I.e., the new rule that is going to schedule the hiding of all future topics from now will not apply to topics that are not updated in the last year, because they don't trigger any of the two rules. 

Share this post


Link to post
Share on other sites

@jair Got it. I would need to run the manual rule again, let's say, every week or every month, until all the topics created between the time I ran the manual rule for the first time and the time the automatic rule starts kicking in are hidden/locked (or whatever action we decided to use). Thanks for the pointer.

Share this post


Link to post
Share on other sites
3 hours ago, Gabriel Torres said:

@jair Got it. I would need to run the manual rule again, let's say, every week or every month, until all the topics created between the time I ran the manual rule for the first time and the time the automatic rule starts kicking in are hidden/locked (or whatever action we decided to use). Thanks for the pointer.

Yes, indeed :)

Share this post


Link to post
Share on other sites

@jair @Kevin Carwile

I created a rule to hide all topics older than 4 years in a specific forum, and scheduled it to run manually using a "Topic" Custom Action, however I am facing a couple of issues.

First, let me tell you what I did:

1. Created a new "Topic" custom action.

2. Created a new rule linked to this custom action as follows:

Conditions:

1. Topic is in the target forum

2. NOT - Topic last updated date and current date is within 4 years

3. NOT - Topic is hidden

Action: Hide topic

Source: Event/Global Data, Data to use: (The name of my custom action)

Member responsible: "Equipe Clube do Hardware"

Reson: Manual/Custom text

Here are the unexpected behaviors:

1. The Scheduled Action is getting "unresponsive". I tried to reduce the number of topics per batch from the default 500 to 100. Should I try lowering this even more?

hide-too-old1.thumb.png.baa1eab32d76affc20733b437357af1e.png

2. Several error messages at the logs. My best guess is that these are being triggered by another rule we have, that sends a private message to users when their topics are hidden (more about this later), and there are some old topics where the user was deleted, so there is no member_id for the topic author available. Is there a solution or should I simply ignore these error messages?

hide-too-old2.thumb.png.a1cab74ba83445992a3b6138e7f96323.png

Here is how we have the rule "Send PM when topic is hidden" configured:

Event: Event: Tópico has been hidden

Conditions: None

Action: Send MP - hidden topic

Action to perform: create a new private conversation

Conversation Participation Mode: All recipients will be participants in the same conversation

Join creator in the conversation

Conversation Creator: Event/Global Data - The member who hid the topic comment

Conversation Participants: Event/Global Data - The hidden topic (author)

Conversation subject: manual configuration

Conversation Message Body: manual configuration

Thank you in advance.

 

Edited by Gabriel Torres

Share this post


Link to post
Share on other sites

I'm afraid your issues are a bit too technical for me, but allow me to speculate a bit. 

1. Yes, it is possible that your rule number 1 is too slow, I have noticed rules not running very fast, especially when you have more then one condition (you have 3). And it seems that you indeed have quite a bit of topics to go through, so it is quite possible that you hit some kind of timeout. I would suggest to do it in batches - hide first 10 y old topics, then 9, then 8, etc. Also, I believe unresponsive does not mean dead, I hope it moved eventually if you were patient enough :)

2. I think not only the missing ids of the recipient are creating the issues, but also the missing id of the member who hides the topic. I.e. they are hidden by the other rule, which is not associated with any member. Altough I see the error logs are fairly irregular in time so it does not happen for every topic.  I think it is best to disable this rule while the other one is running, otherwise you can spam a lot of your users with pms for old topics and if they have email notifications for pms (i believe it is default), you will spam their emails, your emails will get blocked by mail providers, your ip can get blacklisted, etc. Not to mention the possible expenses of sending 1m emails. 

Share this post


Link to post
Share on other sites

@jair Thanks for your input. The 1 million topics is the total number of topics present in our community. The custom action actually scans all topics and apply the rules on each topic that triggers the conditions. So, even if we change the time span, the scheduled action will still scan all 1 million topics present in our community... That said, disabling the notification rule might actually be a good idea! Will play with this and let you guys know what happens.

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.