awsmug / fanpage-import Goto Github PK
View Code? Open in Web Editor NEWImport the Facebook Fanpage stream to WordPress with "Awesome Fanpage import"
Import the Facebook Fanpage stream to WordPress with "Awesome Fanpage import"
Hey, thanks for creating this useful plugin.
Just to let you know there's a typo in photo.php (https://github.com/awsmug/Fanpage-import/blob/master/templates/photo.php)
On line 5, it should be $link_target
Adding an option to select the custom post type where you want to add the content (For own custom post types).
Moving activation-, deactivation-, and uninstall Hooks outside of class.
The Shortcode Code have to be reworked. View is not nice.
Need to change to the PHP SDK an adding oAuth.
Actually the plugin makes a new wp post with excerpt and description but it doesn't put a keyword so the seo is really low.
It would be nice to let the user set a default keyword or set it from the title.
At the moment there is outdated 2.1. Should change to actual 2.7.
Hi there.
I was checking your plugin and it works great, but verifying the code I could not understand why it doesn't work for more than 200 hundred posts.
Is it a limit from FB or something?
Thank you very much!
Using Namespaces instead of horrible long classnames.
Just a request to import links as...wait for it...links.
I'm using some hacky jquery to accomplish this now but the other major Twitter and Instagram importer plugins do this automatically.
Adding filters for every facebook value which is grabbed, before adding values to DB entry.
It would be nice to have an explanation in the docs, how one can customize the titles for the posts (when/while importing them) in the functions.php of your (child) theme - or an option to customize the titles in the plugin settings.
I'd prefere to have post titles like "Short news 02/07/2017" for example, instead of a shortened version of the posts text content... currently I changed it directly in the import-stream.php file, but this will be overwritten with plugin updates.
I suggest to add a custom field on the Status Message CPT with the Facebook Post's link.
Maybe this is a good point to start, I added new functions on the FacebookFanpageImportAdmin class for creating a new Meta Box dedicated to all imported post's infos (now only the related facebook post URL).
File: ./components/admin/component.php
<?php
/**
* Facebook Fanpage Import Showdata Component.
* This class initializes the component.
*
* @author mahype, awesome.ug <[email protected]>
* @package Facebook Fanpage Import
* @version 1.0.0-beta.7
* @since 1.0.0
* @license GPL 2
* Copyright 2016 Awesome UG ([email protected])
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class FacebookFanpageImportAdmin {
var $name;
/**
* Initializes the Component.
*
* @since 1.0.0
*/
function __construct() {
$this->name = get_class( $this );
$this->includes();
if ( 'status' == get_option( 'fbfpi_insert_post_type' ) ) {
add_action( 'init', array( $this, 'custom_post_types' ), 11 );
add_action( 'add_meta_boxes', array( $this, 'custom_meta_box' ) );
add_action( 'save_post', array( $this, 'custom_meta_box_save' ) );
}
}
/**
* Including needed Files.
*
* @since 1.0.0
*/
private function includes() {
require_once( dirname( __FILE__ ) . '/settings.php' );
}
/**
* Creates Custom Post Types
*
* @since 1.0.0
*/
public function custom_post_types() {
$args_post_type = array(
'labels' => array(
'name' => __( 'Status Messages', 'fbfpi-locale' ),
'singular_name' => __( 'Status Message', 'fbfpi-locale' )
),
'public' => true,
'has_archive' => true,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
'rewrite' => array(
'slug' => 'status-message',
'with_front' => true
)
);
register_post_type( 'status-message', $args_post_type );
}
/**
* Add Meta Box for Facebook Post infos
*/
public function custom_meta_box() {
add_meta_box( 'facebook-post-info-meta-box', __( 'Facebook Post Infos', 'fbfpi-locale' ), array( $this, 'meta_box_output'), 'status-message', 'side', 'high' );
}
/**
* Output the Meta box on backoffice
*/
public function meta_box_output( $post ) {
// create a nonce field
wp_nonce_field( 'my_fbfpi_meta_box_nonce', 'fbfpi_meta_box_nonce' ); ?>
<p>
<label for="fbfpi_facebook_post_url"><?php _e( 'Post URL', 'fbfpi-locale' ); ?>:</label>
<input type="text" name="fbfpi_facebook_post_url" id="fbfpi_facebook_post_url" value="<?php echo $this->get_custom_field( 'fbfpi_facebook_post_url' ); ?>" />
</p>
<?php
}
/**
* Save the Meta box value
*/
public function custom_meta_box_save( $post_id ) {
// Stop the script when doing autosave
if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
// Verify the nonce. If insn't there, stop the script
if( !isset( $_POST['fbfpi_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['fbfpi_meta_box_nonce'], 'my_fbfpi_meta_box_nonce' ) ) return;
// Stop the script if the user does not have edit permissions
if( !current_user_can( 'edit_post', get_the_id() ) ) return;
// Save the textfield
if( isset( $_POST['fbfpi_facebook_post_url'] ) )
update_post_meta( $post_id, 'fbfpi_facebook_post_url', esc_attr( $_POST['fbfpi_facebook_post_url'] ) );
}
/**
* Return the custom field selected
*/
private function get_custom_field( $value ) {
global $post;
$custom_field = get_post_meta( $post->ID, $value, true );
if ( !empty( $custom_field ) )
return is_array( $custom_field ) ? stripslashes_deep( $custom_field ) : stripslashes( wp_kses_decode_entities( $custom_field ) );
return false;
}
}
$FacebookFanpageImportAdmin = new FacebookFanpageImportAdmin();
Hello,
First thanks for nice plugin.
I have a one problem this plugin import only one image more then one time.
Only Image not other data.
check attachment images. it is load more then 10 same image daily. i need to delete manulrey other wise one day my server will full.
Need help from your side ASAP.
Plugin works great. I've hit my head too many times trying to figure out why it couldn't pull the following post:
https://www.facebook.com/ffwrd.ca/posts/499796160179064
The plugin doesn't pull posts without a message/title. Not a bug per say but maybe this will help others facing the same issue.
I'm on beta 2
Adding own wordpress.org header image
The isn't importet correctly.
Following url is stored inside the custom field:
https://www.facebook.com/yvonnewillicks7012//posts/926028784172964
There is a "/" to much between the fanpagepage slug and the "post" url base.
You also should only link to
facebook.com/%post_id%
otherwise the link will be broken when the fanpage url changes.
https://wordpress.org/support/topic/wrong-entry_url?replies=1
Fanpage-import/components/admin/component.php
Lines 56 to 77 in c9909be
Just adding this to $args_post_type
adds a nice FB icon in the admin menu:
'menu_icon' => 'dashicons-facebook'
Would send PR if welcome.
Removing Skip framework, because it's overloading CSS and JS. Not needed for these sum of options.
At the moment the CURL functions are used. Have to be changed to the WP HTTP API.
Currently (1.0.0. beta 7) there is a template file photo.php
Thanks to that file you can create your own template file in you theme or even child theme to overwrite the default html output.
But the name photo.php is very generic and possibly already used, e.g. by parent theme template files.
I suggest to change the filename an add a shortname for the plugin so it's clear what this template file belongs to in a customized child theme.
E.g. ffpi_photo.php or something like that
Making multiple Fanpages possible.
For a better readability of classnames and analog to functions the classnames will get underscores between words.
This plugin will no longe usable unless you adapt to new Facebook Developer Guidelines.
Facebook has deprecated the GraphAPI node "publish_pages" and "manage_pages" and replaced them with 6 new access nodes.
To be able to use the most important access nodes, especially "pages_read_enagement", you need to register your business account in Facebook and you will have to add your Facebook app to your business manager and thus need to verify your "business" by providing official documents and signing new contracts with Facebook.
This makes the use of this plugin at least impossible for private Fanpages or smaller non profit organisations (in my opinion).
Switching to composer autoloader.
When importing older facebook posts manually all the images are saved in the current month folder.
I'd suggest to change the fetch_picture function and add the post date.
So all imported images are saved in the correct year/month folder structure...
Full error:
FanPage {
["error"]=>
object(stdClass)#6219 (5) {
["message"]=>
string(38) "(#4) Application request limit reached"
["type"]=>
string(14) "OAuthException"
["is_transient"]=>
bool(true)
["code"]=>
int(4)
["fbtrace_id"]=>
string(11) "CarFGcD42Ls"
}
}
Searching the error i found this question on stackoverflow, and seems that The Facebook API limit isn't really documented, but apparently it's something like: 600 calls per 600 seconds, per token & per IP.
So I've tried to disable the plugin for some days but this do not solve the issue, i think that could be helpful if you (@mahype ) check your app from the facebook developer dashboard.
KR
Currently (1.0.0 beta 7) there is only a template file for the post type photo.
It would be nice to have template files for the other post types as well (link, video, event...)
That way it would be easily possible to overwrite the default html output with customized templates in the (child) themes... and these changes won't be overwritten when there is a plugin update available.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.