2

I'm using the module "Facebook Autopost" to post Drupal content on Facebook. When a new node is created, a link to this node is posted on a Facebook page. Facebook's scraper picks up the link and tries to scrape this.

This is configured in a rule. Currently, it looks like this:
http://imgur.com/rtIiYLL

When a new node is created, the rule is executed. The link gets posted on the Facebook page, but the scraper seems to get a 404. It appears the rule is executed too fast, BEFORE the actual node is created.

Is there a way to delay the execution of the actions so the node is actually created already?

  • Hey "Bekende Vlaming nr 202 ...", do you really want to wait for 5 mins? How about some other type of work around, to only wait "until you are sure the node got created" (and only then execute the Rule you have in place already? – Pierre.Vriens Mar 3 '16 at 10:01
  • Ah, nog Belgen hier? :) Well, I've managed to use the rules sheduler like No Sssweat explained, but it seems it doesn't solve the issue I have. Facebook still can't scrape the url because it gets a link to the node id, not the clean url with the alias, which causes a redirect. I'm using the node:url token to get the url, but even after 5 minutes, I can't seem to get the alias... – Bv202 Mar 3 '16 at 10:07
  • That's an interesting discovery you added. But to be honest, I think you should make that a separated (new) question. That would avoid this question becomes a cameleon question (= solution to the problem, changes the problem). Because as you confirmed also, the suggested answer did answer the original question. In your new question you could point to this one (and mark this one as accepted also?) as a followup question. PS 1 (for those who are not good in Dutch): "nog Belgen hier" = "More Belgians here". PS 2: "my" home is where my "Stella" is ... – Pierre.Vriens Mar 3 '16 at 10:19
  • I've reread your prior comment a few times ... It's funny that Drupal seems to make Fakebook (oeps ... Facebook) confused. So therefor I'd recommend you to really consider another approach to address that "confusion". – Pierre.Vriens Mar 3 '16 at 10:38
  • 1
    Cool, I've been born there ;) I've created a new question for this issue: drupal.stackexchange.com/questions/193399/…, thanks for the help! – Bv202 Mar 3 '16 at 10:38
2

Is there a way to delay the execution of the actions so the node is actually created already?

Yes, you need to enable the Rules Shecheduler module (comes with rules).

Then Create a Rule Component that will do your action.

Then create a rule with action of schedule component. (set it to 5 mins)

For example, see Rules Conditions being evaluated after schedule time elapsed?

Attention:

Be aware that the actual trigger will only happen the next time your Cron job runs. So if you say "after 5 mins", and the next Cron job runs in say about an hour, then it'll only be after about an hour. If that's not acceptable (as was the case in this question), then you'd have to run your cron job like every 5, 10 or 15 minutes.

So I suggest using Ultimate Cron, that way you can target, so that only your rule cron job runs every 5 or x mins, instead of running every single cron job.

In other words, it allows you to run different catagories/module cron jobs at different times. While you could run less crucial jobs, like Update Manager, only once a day (every 24 hours).

enter image description here

  • I can shedule cron jobs to run every few minutes, so I think I'll be fine. Thanks for the explanation! – Bv202 Mar 3 '16 at 10:10
  • @NoSssweat OK, I believe you about that Ultimate Cron, even though it increases the risk of "modulitis" (= way too much modules) of the site. Maybe you want to add a few more details about that module (how it improves things as compared to relying on regular cron)? PS: hope my minor edit of your answer is OK, if not feel free to further adapt. – Pierre.Vriens Mar 3 '16 at 10:27
  • Aha, a picture is word more then 1000 words ... now I get it ... merci! – Pierre.Vriens Mar 3 '16 at 10:40
  • 1
    @Pierre.Vriens yes, you could run less crucial jobs like Update Manager every 24 hours. – No Sssweat Mar 3 '16 at 10:42
  • I endorse this answer ... again ... may I? If not, why not? – Pierre.Vriens Mar 24 '17 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.