Hello, I'm trying to use Simple Facebook Post Wall to post content in FB's Wall. I've been checking the code and there's something I don't understand. According to README.txt I have call drupal_get_form this way to get the form printed:

drupal_get_form('simple_fbwall_post_button', $example_payload);

The point is that API Drupal 6 page is telling that drupal_get_form should receive just 1 argument.

http://api.drupal.org/api/drupal/includes--form.inc/function/drupal_get_form/6

And, on the other hand, in the .module file there's no function called simple_fbwall_post_button, but there's one called simple_fbwall_post_button_form. I'm saying that because when I print the form, Drupal gives me an errro message about a callback not defined.

Greetings.

Comments

cibonato’s picture

This is the error message I get when using drupal_get_form according to what is written in README.txt file:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'simple_fbwall_post_button' was given in /var/www/drupal/includes/form.inc on line 376.

I tried replace drupal_get_form('simple_fbwall_post_button', $example_payload); with drupal_get_form('simple_fbwall_post_button_form', $example_payload); and then Drupal started complaining about the number of arguments (I was expecting this kind of issue because simple_fbwall_post_button_form must receive 3 arguments, not only 2).

Greetings.

Anonymous’s picture

Hmmm, we might need to update the documentation.

When I use this module, I tack on an additional ID to the end of the form name. For example, my call looks like this:

print drupal_get_form('simple_fbwall_post_button_form_1', $payload);

We've used HOOK_forms(), so that it is possible to use the Facebook form multiple times on the page. But that may also be why you are unable to call the form with the only the form name.

scothiam’s picture

StatusFileSize
new17.53 KB

Did you get it working cibonato? I'm working on it myself, but I'm also in the process of learning the hooks, not sure which I'm doing wrong ;)

I've successfully got the 'share' button and the pop-up with a text area to show up (see image attached), no image, no captions, etc... Upon submitting I get the "An error occured while posting to your facebook wall. Please refresh the page and try again."

Heres my code, based on the example in the read me and the changes mentioned in #2... a nudge in the right direction would be greatly appreciated, thanks

<?php 

 $fb_post_payload = array(
    'message' => 'Hello World!',  
    'picture' => 'http://example.com/themes/garland/logo.png',
    'actions' => array(
		'name' => 'Visit Example.com',
		'link' => 'http://example.com/',
	),
    'link' => array(
	    'link' => 'http://example.com/',
	    'name' => 'Example Page',
	    'caption' => 'This is the example page',
	    'description' => 'The example page has a lot of stuff on it that is used for examples.',
    ),
  );
    
 function fb_post_nodeapi($node,$op){
 		
	//print drupal_get_form('simple_fbwall_post_button_form_1', fb_post_payload);
			
	$node->content['fb_post_print']= array(
		'#value' => drupal_get_form('simple_fbwall_post_button_form_1', $fb_post_payload),
	    '#weight' => 10,
    );
		
  }
   
scothiam’s picture

Fixed! Just moved the "payload" within the function and it is now working swimmingly... Any feedback, critique, or suggestions would be greatly appreciated. Thanks!!

function fb_post_nodeapi($node,$op){
	 
 	$fb_post_payload = array(
	    'message' => 'Hello World!',  
	    'picture' => 'http://example.com/themes/garland/logo.png',
	    'actions' => array(
			'name' => 'Visit Example.com',
			'link' => 'http://example.com/',
		),
	    'link' => array(
		    'link' => 'http://example.com/',
		    'name' => 'Example Page',
		    'caption' => 'This is the example page',
		    'description' => 'The example page has a lot of stuff on it that is used for examples.',
	    ),
	  ); 		
	//print drupal_get_form('simple_fbwall_post_button_form_1', fb_post_payload);
			
	$node->content['fb_post_print']= array(
		'#value' => drupal_get_form('simple_fbwall_post_button_form_1', $fb_post_payload),
	    '#weight' => 10,
    );
		
  }
scothiam’s picture

Title: Passing arguments through drupal_get_form. » was working...

... and it has stopped working for me...

a few months later, a couple core updates, many other module updates... the facebook developer interface, options, also seem to look different...

The form generates fine, but fails to post anything to facebook.
"An error occured while posting to your facebook wall. Please refresh the page and try again."

I've tried reverting to the most basic 'hello world' script... both beta and dev versions... no luck so far..

any fixes/updates on the horizon?

cheers,

Anonymous’s picture

Wall posting is still working for me... Is there any other info you can dig up about that error message?

scothiam’s picture

thanks for the response, and sorry for the delay, just rolled out a new site. I'll set up a clean site and test again in the next few days. At this point I'm betting there is a conflict with another module or something in my custom theme. I'll add in other elements until I get it to break again ;)

Update: tried on a clean install, no luck. Tried on another host, no luck... won't be able to dig deeper for a week or two...

Anonymous’s picture

I think Facebook may have switched things up on us.

Anonymous’s picture

Lobo235 has found the problem. Facebook has gotten more strict about the structure of the payload. In our case, I think we sent a link as an array, but it needs to be a string. I'll have him chime in with the details.

scothiam’s picture

I've since had success using the facebook social modules + open graph meta tags module to manipulate what is posted to facebook... give it a shot if you are with out a solution. cheers