Commit d37de855 authored by Rafael Chaves Freitas's avatar Rafael Chaves Freitas

modifies post meta keys of facebook api modules to avoid conflict with other plugins

parent e7fc202d
......@@ -3,10 +3,10 @@
namespace guaraci;
function need_share_update( $post_id ) {
if ( !metadata_exists( 'post', $post_id, 'shares' ) ) {
if ( !metadata_exists( 'post', $post_id, 'fb_shares' ) ) {
// the first time its called create the metadata for the next turn
update_post_meta( $post_id, 'shares', 0 );
update_post_meta( $post_id, 'updated_timestamp', time() );
update_post_meta( $post_id, 'fb_shares', 0 );
update_post_meta( $post_id, 'fb_shares_updated_at', time() );
return false;
} elseif ( update_share_business_rule( $post_id ) ) {
......@@ -26,7 +26,7 @@ function update_share_business_rule( $post_id ) {
// a cada 24h - os demais posts
$rank_position = get_post_ranking_position( $post_id )?: 501; // if is not in rank, place into a regular group
$last_time_updated = get_post_meta( $post_id, 'updated_timestamp', true );
$last_time_updated = get_post_meta( $post_id, 'fb_shares_updated_at', true );
$date_obj = \DateTime::createFromFormat('U', $last_time_updated);
$time_interval = $date_obj->diff(new \DateTime('NOW'));
......@@ -49,10 +49,10 @@ function update_share_business_rule( $post_id ) {
}
function set_post_shares( $post_id, $shares ) {
update_post_meta( $post_id, 'shares', $shares );
update_post_meta( $post_id, 'updated_timestamp', time() );
update_post_meta( $post_id, 'fb_shares', $shares );
update_post_meta( $post_id, 'fb_shares_updated_at', time() );
}
function get_post_shares( $post_id ) {
return get_post_meta( $post_id, 'shares', true);
return get_post_meta( $post_id, 'fb_shares', true);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment