implement missing get_follower logic
This commit is contained in:
parent
793214cea2
commit
daf7acb1b0
1 changed files with 13 additions and 3 deletions
|
@ -235,7 +235,13 @@ class Followers {
|
|||
public static function remove_follower( $user_id, $actor ) {
|
||||
wp_cache_delete( sprintf( self::CACHE_KEY_INBOXES, $user_id ), 'activitypub' );
|
||||
|
||||
return wp_remove_object_terms( $user_id, $actor, self::POST_TYPE );
|
||||
$follower = self::get_follower( $user_id, $actor );
|
||||
|
||||
if ( ! $follower ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return delete_post_meta( $follower->get_id(), 'user_id', $user_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,8 +257,12 @@ class Followers {
|
|||
|
||||
$post_id = $wpdb->get_var(
|
||||
$wpdb->prepare(
|
||||
"SELECT ID FROM $wpdb->posts WHERE guid=%s",
|
||||
esc_sql( $actor )
|
||||
"SELECT p.ID FROM $wpdb->posts p INNER JOIN $wpdb->postmeta pm ON p.ID = pm.post_id WHERE p.post_type = %s AND pm.meta_key = 'user_id' AND pm.meta_value = %d AND p.guid = %s",
|
||||
array(
|
||||
esc_sql( self::POST_TYPE ),
|
||||
esc_sql( $user_id ),
|
||||
esc_sql( $actor ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue