Facebook_Helpers::automator_integration_facebook_capture_token_fetch_user_pages()

Fetches the user pages from Automator api to user’s website using his token.


Return Return

(void) Sends json formatted data to client.


Source Source

File: src/integrations/facebook/helpers/facebook-helpers.php

	public function automator_integration_facebook_capture_token_fetch_user_pages() {

		if ( wp_verify_nonce( filter_input( INPUT_GET, 'nonce', FILTER_DEFAULT ), self::OPTION_KEY ) ) {

			$existing_page_settings = get_option( '_uncannyowl_facebook_pages_settings' );

			if ( false !== $existing_page_settings ) {

				wp_send_json(
					array(
						'status'  => 200,
						'message' => __( 'Successful', 'automator-pro' ),
						'pages'   => $existing_page_settings,
					)
				);

			} else {
				$pages = $this->fetch_pages_from_api();
				wp_send_json( $pages );
			}
		}

	}