Skip to content

Commit

Permalink
Also resolve non-protocol feed URL when adding it through the feeds list
Browse files Browse the repository at this point in the history
  • Loading branch information
akirk committed Jan 18, 2024
1 parent 5e2fde7 commit 8e411af
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion includes/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,11 @@ public function process_admin_edit_friend_feeds() {
$user_feed = $existing_feeds[ $term_id ];
unset( $existing_feeds[ $term_id ] );

$protocol = wp_parse_url( $feed['url'], PHP_URL_SCHEME );
if ( ! $protocol ) {
$feed['url'] = apply_filters( 'friends_rewrite_incoming_url', 'https://' . $feed['url'], $feed['url'] );
}

if ( $user_feed->get_url() !== $feed['url'] ) {
do_action( 'friends_user_feed_deactivated', $user_feed );

Expand All @@ -1435,7 +1440,9 @@ public function process_admin_edit_friend_feeds() {

if ( $feed['active'] ) {
$new_feed = $friend->subscribe( $feed['url'], $feed );
do_action( 'friends_user_feed_activated', $new_feed );
if ( ! is_wp_error( $new_feed ) ) {
do_action( 'friends_user_feed_activated', $new_feed );
}
} else {
$new_feed = $friend->save_feed( $feed['url'], $feed );
}
Expand Down

0 comments on commit 8e411af

Please sign in to comment.