Popular Content

Showing content with the highest reputation since 11/14/2018 in Articles

  1. 1 point
    This recipe adds a custom data field to forums which can be used to make topics posted in the forum automatically expire after a set number of hours. A custom action is used to schedule the locking of the topic at the given time. This recipe could easily be tweaked to extend the scheduled lock time if the topic author re-posts or under some other condition. auto-expire-topics.xml
  2. 1 point
    It is fairly common to have an action or set of actions that you would like to perform on a piece of content (or member) only after a certain amount of time has elapsed between particular events. For example, you might want to: Close a topic automatically a certain amount of time after it was created. Move a topic to a different forum if it hasn't been posted in for a certain amount of time. Send members a polite follow up email if they haven't logged in for a specified period of time. There is a simple pattern that you can use in all of these cases, which isn't so obvious to those that are new to rules, but is very easy to implement once you understand how it works. Why does this work? It's in the keyphrase. Let's take a look at example #2 above. We want to move the topic if it hasn't been posted in for 3 weeks. So what we do is to create an action to move the topic to the new location, and schedule that action for 3 weeks in the future instead of executing it immediately. This way each time a post is made in the topic, the move gets rescheduled. It's important to use a keyphrase that will be unique to that topic, so we must include a token in the keyphrase such as the topic id. It could look something like this: "Move topic [content:id] to graveyard". Of course, the token that corresponds to the id of what you are trying to move will depend on the event that you are writing your rule for, so make sure to look at the tokens list to see which token corresponds to your content id. But the concept is pretty simple. With every post, we assume that it is going to be the last post that happens... and we schedule the future action for the set amount of time in the future. If another person posts in the topic, we simply schedule the future action again which removes any previously scheduled follow up action with the same keyphrase, and sets in motion the new follow up action. This way the only follow up action that is in motion for the topic is the one which was scheduled after the last time the chosen event occured (in this case, it's when a topic comment is posted). If no qualified event happens within the timeframe between the last action and the follow up action which causes the follow up to be rescheduled, then the follow up action executes and the cycle ends.