Hi all,
I made 2 rules to publish facebook publication of type "PHOTO".
Rule A, check if the facebook_publication_reference is EMPTY, then run "Publish to Facebook page"
Rule B, check if the facebook_publication_reference is NOT EMPTY, then run "Update In Facebook"
-Rule A run perfectly fine.
-Rule B will generate
Insufficient permissions to publish on page with id 0. Please check your configuration.
and when I check my facebook Page, a PHOTO post has been removed
So, I remove the "Update In facebook" action in Rule B and replace it with "Delete from Facebook" then follow by "Publish to Facebook page" to temporarily do what I guess is the same..
So is this a bug or something?
Here I attach my exported current rule, kindly help if anyone notice my rule doesnt fit "Update In facebook".
{ "rules_edit_product_on_facebook_page_if_fbpublication_exist" : {
"LABEL" : "Edit product on facebook page if fbpublication exist",
"PLUGIN" : "reaction rule",
"TAGS" : [ "commerce product", "facebook" ],
"REQUIRES" : [ "rules", "fb_autopost_entity" ],
"ON" : [ "node_update" ],
"IF" : [
{ "entity_is_of_bundle" : {
"entity" : [ "node" ],
"type" : "node",
"bundle" : { "value" : { "furniture" : "furniture", "mattress" : "mattress" } }
}
},
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_product" } },
{ "entity_has_field" : { "entity" : [ "node" ], "field" : "field_facebook_publication" } },
{ "NOT data_is_empty" : { "data" : [ "node:field-facebook-publication" ] } }
],
"DO" : [
{ "entity_fetch" : {
"USING" : {
"type" : "facebook_publication",
"id" : [ "node:field-facebook-publication:fbpid" ]
},
"PROVIDE" : { "entity_fetched" : { "facebook_publication_fetched" : "Fetched facebook publication" } }
}
},
{ "entity_create" : {
"USING" : {
"type" : "facebook_publication",
"param_type" : "photo",
"param_user" : [ "site:current-user" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created" ],
"value" : [ "facebook-publication-fetched" ]
}
},
{ "drupal_message" : { "message" : [ "entity-created:fbpid" ] } },
{ "component_rules_get_product_info" : {
"USING" : { "commerce_product" : [ "node:field-product:0" ] },
"PROVIDE" : { "image" : { "image" : "image" }, "price" : { "price" : "price" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-source:file" ],
"value" : [ "image" ]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-message" ],
"value" : "[node:title]\r\n@-------------------------------------------------@\r\nNow selling for [site:commerce-currency] [price:value] only!\r\n\r\n[node:summary]... \r\nVisit [node:url] for more info!"
}
},
{ "delete_from_facebook" : { "publication_id" : [ "facebook-publication-fetched" ] } },
{ "publish_to_facebook" : {
"USING" : { "publication" : [ "entity-created" ], "pages" : "228074727253202" },
"PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:facebook-id" ],
"value" : [ "facebook-publication-id" ]
}
},
{ "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } },
{ "data_set" : {
"data" : [ "node:field-facebook-publication" ],
"value" : [ "entity-created" ]
}
},
{ "entity_save" : { "data" : [ "node" ], "immediate" : 1 } }
]
}
}
Thanks & best regards,
Max.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | fb_autopost-page_with_id_0_on_UpdateInFacebook-2009702-8.patch | 705 bytes | steveoriol |
Comments
Comment #1
marcus178 commentedI have a very similar problem. I have 2 rules, after saving new content publish to facebook, and after updating content update on facebook. With the later enable I get the same error when creating new content.
Comment #2
e0ipsoid 0means that the page to publish to has not been correctly selected.Comment #3
e0ipsoI marked #2062449: Insufficient permissions to publish on page with id . (id null ???) as a duplicate of this one.
Comment #4
dinotav commentedI dont have any rules, only my post_node.module
Comment #5
e0ipso@dinotav, please see the updated instructions.
Comment #6
FAAREIA commentedThanks for the updated instructions.
Just for the record:
- Instructions miss $facebook_page_id.
- Added node url alias and some untested language detection to create full node url alias.
Hope it helps some one
PD: I didn't use url() because i don't know how to pass language variable, plus i read about an issue with prefix and domain values in mutilingual sites. url() finally calls drupal_lookup_path
Comment #7
itshaseebanwar commentedLearn how to fix issue "Insufficient permissions to publish on page with id" by visiting the below link:
http://www.thesstech.com/drupal-how-fix-Insufficient-permissions-publish...
Comment #8
steveoriolHello, I found why the "0" come in. It is cause by the use of the "array_merge" php function in the function "available_facebook_destinations" inside the file "fb_autopost_entity.rules.inc".
You just have to replace it by a "+" and it works ;-)
Here is the patch:
Comment #9
e0ipso@steveoriol that is great. Let's see if someone can RTBC it soon and we can then merge it.