PluginProbe
Friends / 4.3.2
Friends v4.3.2
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
← All changes | includes/class-admin.php +22 -8 4.3.04.3.2 View file →
@@ -263,12 +263,12 @@
263 263 __( 'Welcome to the Friends Settings! You can configure the Friends plugin here to your liking.', 'friends' ) .
264 264 '</p>' .
265 265 '<p>' .
266 266 sprintf(
267 - // translators: %1$s is a URL, %2$s is the name of a wp-admin screen.
268 - __( 'There are more settings available for each friend or subscription individually. To get there, click on the user on the <a href=%1$s>%2$s</a> screen.', 'friends' ),
269 - '"' . esc_attr( self_admin_url( self::get_users_url() ) ) . '"',
270 - __( 'Friends &amp; Requests', 'friends' )
267 + // translators: %1$s is a URL, %2$s is the name of a page.
268 + __( 'There are more settings available for each friend or subscription individually. To get there, click on the user on the <a href=%1$s>%2$s</a> page.', 'friends' ),
269 + '"' . esc_attr( self::get_users_url() ) . '"',
270 + __( 'Following', 'friends' )
271 271 ) .
272 272 '</p>',
273 273 )
274 274 );
@@ -498,8 +498,15 @@
498 498 }
499 499 }
500 500
501 501 if ( current_user_can( 'manage_options' ) ) {
502 + if ( isset( $_POST['main_user_id'] ) ) {
503 + $main_user_id = absint( $_POST['main_user_id'] );
504 + if ( $main_user_id && user_can( $main_user_id, Friends::REQUIRED_ROLE ) ) {
505 + update_option( 'friends_main_user_id', $main_user_id );
506 + }
507 + }
508 +
502 509 foreach ( array( 'force_enable_post_formats', 'expose_post_format_feeds', 'exclude_compose_format_from_feed' ) as $checkbox ) {
503 510 if ( isset( $_POST[ $checkbox ] ) && boolval( $_POST[ $checkbox ] ) ) {
504 511 update_option( 'friends_' . $checkbox, true );
505 512 } else {
@@ -1297,8 +1304,10 @@
1297 1304 'limit_homepage_post_format' => get_option( 'friends_limit_homepage_post_format', false ),
1298 1305 'expose_post_format_feeds' => get_option( 'friends_expose_post_format_feeds' ),
1299 1306 'compose_post_format' => get_option( 'friends_compose_post_format', 'status' ),
1300 1307 'exclude_compose_format_from_feed' => get_option( 'friends_exclude_compose_format_from_feed' ),
1308 + 'main_user_id' => Friends::get_main_friend_user_id(),
1309 + 'potential_main_users' => User_Query::all_admin_users(),
1301 1310 'disable_auto_tagging' => get_option( 'friends_disable_auto_tagging' ),
1302 1311 'disable_link_previews' => get_option( 'friends_disable_link_previews' ),
1303 1312 'retention_days' => Friends::get_retention_days(),
1304 1313 'retention_number' => Friends::get_retention_number(),
@@ -1703,10 +1712,15 @@
1703 1712 if ( ! Friends::has_required_privileges() ) {
1704 1713 wp_send_json_error( __( 'You do not have permission to do this.', 'friends' ) );
1705 1714 }
1706 1715
1707 - $url = $this->normalize_frontend_subscription_url( wp_unslash( $_POST['url'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1716 + $incoming_url = trim( wp_unslash( $_POST['url'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
1717 + if ( ! class_exists( '\Activitypub\Activitypub' ) && preg_match( '/^@?[A-Za-z0-9_.-]+@(?:[A-Za-z0-9_-]+\.)+[A-Za-z]+$/i', $incoming_url ) ) {
1718 + wp_send_json_error( __( 'The ActivityPub plugin is required to follow Mastodon handles. Please install and activate it first.', 'friends' ) );
1719 + }
1708 1720
1721 + $url = $this->normalize_frontend_subscription_url( $incoming_url );
1722 +
1709 1723 if ( '' === $url ) {
1710 1724 wp_send_json_error( __( 'No URL provided.', 'friends' ) );
1711 1725 }
1712 1726
@@ -2348,9 +2362,9 @@
2348 2362
2349 2363 if ( isset( $_GET['_wp_http_referer'] ) ) {
2350 2364 wp_safe_redirect( wp_get_referer() );
2351 2365 } else {
2352 - wp_safe_redirect( add_query_arg( $arg, $arg_value, self_admin_url( 'admin.php?page=friends-list' ) ) );
2366 + wp_safe_redirect( add_query_arg( $arg, $arg_value, home_url( '/friends/following/' ) ) );
2353 2367 }
2354 2368 exit;
2355 2369 }
2356 2370
@@ -2873,9 +2887,9 @@
2873 2887 return $friend_roles;
2874 2888 }
2875 2889
2876 2890 public static function get_users_url() {
2877 - return 'admin.php?page=friends-list';
2891 + return home_url( '/friends/following/' );
2878 2892 }
2879 2893
2880 2894 /**
2881 2895 * Override the post title for specific post formats.
@@ -2967,9 +2981,9 @@
2967 2981 array(
2968 2982 'id' => 'friends',
2969 2983 'parent' => 'friends-menu',
2970 2984 'title' => esc_html__( 'Settings' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
2971 - 'href' => $my_admin_url . '/wp-admin/admin.php?page=friends-settings',
2985 + 'href' => home_url( '/friends/settings/' ),
2972 2986 )
2973 2987 );
2974 2988 }
2975 2989