| @@ -71,22 +71,23 @@ | ||
| 71 | 71 | ]; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | - * @todo Something | |
| 75 | + * Keep this source's notifications out of the popup loop in | |
| 76 | + * FrontEnd::get_notifications_ids(). They render inline at the hooks | |
| 77 | + * chosen in `inline_location`, never as a floating popup. | |
| 76 | 78 | * |
| 77 | - * @param [type] $exclude | |
| 78 | - * @param [type] $settings | |
| 79 | - * @return void | |
| 79 | + * `inline_location` is not read here on purpose: it can be saved as '' | |
| 80 | + * (MCP or Quick Builder create without the field), and passing that to | |
| 81 | + * array_diff() is a TypeError on PHP 8 that white-screens every page. | |
| 82 | + * | |
| 83 | + * @param bool $exclude Whether an earlier callback already excluded it. | |
| 84 | + * @param array $settings Notification settings. | |
| 85 | + * @return bool | |
| 80 | 86 | */ |
| 81 | 87 | public function show_on_exclude( $exclude, $settings ) { |
| 82 | - if ( 'inline' === $settings['type'] && $settings['source'] === $this->id ) { | |
| 83 | - $edd_location = $settings['inline_location']; | |
| 84 | - $hooks = [ 'tutor_course/loop/after_title' ]; | |
| 85 | - $diff = array_diff( $hooks, $edd_location ); | |
| 86 | - if ( count( $diff ) <= count( $hooks ) ) { | |
| 87 | - return true; | |
| 88 | - } | |
| 88 | + if ( isset( $settings['type'], $settings['source'] ) && 'inline' === $settings['type'] && $this->id === $settings['source'] ) { | |
| 89 | + return true; | |
| 89 | 90 | } |
| 90 | 91 | return $exclude; |
| 91 | 92 | } |
| 92 | 93 | |