FACEBOOK_GROUP_PUBLISH_PHOTO::process_action( $user_id, $action_data, $recipe_id, $args, $parsed )
Proccess our action.
Return Return
(Uncanny_Automatorvoid.)
Source Source
File: src/integrations/facebook-groups/actions/facebook-group-publish-photo.php
public function process_action( $user_id, $action_data, $recipe_id, $args, $parsed ) { $helper = Automator()->helpers->recipe->facebook_groups->options; // The group id. $group_id = isset( $parsed[ $this->get_action_meta() ] ) ? sanitize_text_field( $parsed[ $this->get_action_meta() ] ) : 0; // The caption. $caption = isset( $parsed['FACEBOOK_GROUPS_PUBLISH_MESSAGE'] ) ? sanitize_textarea_field( $parsed['FACEBOOK_GROUPS_PUBLISH_MESSAGE'] ) : ''; // The image url. $image_url = isset( $parsed['FACEBOOK_GROUPS_PUBLISH_PHOTO_IMAGE_URL'] ) ? sanitize_text_field( $parsed['FACEBOOK_GROUPS_PUBLISH_PHOTO_IMAGE_URL'] ) : ''; $body = array( 'action' => 'send_photo', 'access_token' => $helper->get_user_access_token(), 'caption' => $caption, 'group_id' => $group_id, 'url' => $image_url, ); try { $helper->api_request( $body, $action_data ); Automator()->complete->action( $user_id, $action_data, $recipe_id ); } catch ( \Exception $e ) { $action_data['complete_with_errors'] = true; // Log error if there are any error messages. Automator()->complete->action( $user_id, $action_data, $recipe_id, $e->getMessage() ); } }
Expand full source code Collapse full source code View on Github