I followed the instructions on http://drupal.org/node/685320 to develop a module to publish nodes to the facebook stream and everything works just fine publishing content to the logged in users wall. I read the documentation for the stream.publish method from fb and added a target_id so that I could post to a particular Page. The problem I have though is that it also says in the documentation that if you use a Pages id as the uid instead of using the target_id, it will publish on the pages wall as the page and not the original user. That is what I am trying to do. I just want to publish to a page's wall as the page, not as a user that can admin that page. Unfortunately, it isn't working. When I specify the uid within the fb_stream_publish_dialog options, it never posts as the page or on the page wall. Just acts normal and posts on the logged in users wall.

Is this a bug or something that is not possible or I dont have setup correctly? Thanks.

Comments

Dave Cohen’s picture

I haven't done exactly what you're describing, so I can't tell you exactly how it's done, and I'd like to know myself.

The documentation says to enable the "'enable_profile_selector' option with FB.login" - whatever that means. The FB.login doc does not make it clear. Did you do that? (http://developers.facebook.com/docs/reference/rest/stream.publish)

Also the fb_stream_publish_dialog uses FB.ui(...) javascript, and that might not be the same as calling stream.publish directly. You could try calling it via $_fb->api(...), or since in my experience that function often fails, fb_call_method(...).

johnlutz’s picture

Thanks for the quick response. I saw that exact note on the facebook docs about the enable_profile_selector but couldn't find anything else about it on the linked page. I was hoping you had some clue there.

Well, strike that. While I was looking at that fb_stream_publish_dialog function to see where you were talking about to change the call I saw the list of parameters you can send to it. One of them is called actor_id. I just put in the page id for that and it worked like a charm.

Hope this helps someone else. Love this module the very little I have seen so far.

Dave Cohen’s picture

Status: Active » Fixed

Cool, nice work. Sounds like you're one step ahead of the facebook documentation. Welcome to the wonderful world of facebook app development.

BTW, I do hope that fb_stream.module grows to make this sort of thing as easy as possible. Just haven't had time myself to build it out.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Marko B’s picture

I dont see here actor_id as param. http://developers.facebook.com/docs/reference/rest/stream.publish
But i tried it now and it works, both for app and page.

dela.deyoungster’s picture

Status: Closed (fixed) » Needs review

Hi, I recently tried to use the 'actor_id' param but it didn't work. As noted by @deepM, it is not indicated as an allowed param for the stream.publish method. So I just want to know whether it's still working for you guys?

Thanks.

geefin’s picture

Same as @dela.deyoungster...

I've tried every combination I can think. At present, I can post to the page's wall, but it posts as the logged in/connected user - not the page (admin) itself. This is when utilising the 'target_id' param.

If I add 'actor_id' with the page id as the value, nothing changes, same result.

If I remove 'target_id' and just have the 'actor_id' (as suggested in the documentation) then it reverts back to posting as the user, on the user's wall.

So as yet, no joy with posting to a page as the page. I can't find any way of activating the requested 'enable_profile_selector' (and it's not mentioned in any of the Facebook for Drupal code).

Could anyone who has succeeded with this shed some light on it for us?

Cheers.

geefin’s picture

Okay, I now have this working, I made sure the permissions were set for :-

Access my basic information
Manage my Pages
Post to my Wall
Access my data any time

I had to remove and reinstall the App on my Facebook for this.

I then added uid as my pageid (so 'MYPAGEID' is actually something like '1283747271737') :-

$success_data = fb_call_method($fb, 'stream.publish', array(
       	   'target_id' => 'MYPAGEID',
       	   'uid' => 'MYPAGEID',
           'session_key' => $fb_session['session_key'],
           'message' => $user_message,
           'attachment' => $attachment,
           'action_links' => json_encode($actions),

It is now posting to my page as the page admin. I believe 'actor_id' has been superseded by 'uid'.

geefin’s picture

I have made a quick 'how-to' of the steps I followed including posting the module I have modified/created for this :-

http://www.caribbeannewmedia.com/blog/how-to-post-from-your-drupal-site-...

The module allows you to select which content types to post to, a default message, override for each post with a message and to enter (in the config page) the user_id and target_id.