| @@ -214,8 +214,10 @@ | ||
| 214 | 214 | echo '<div class="notice notice-error"><p><strong>'; |
| 215 | 215 | echo esc_html__( 'Double Opt-In has detected a problem that will affect your visitors.', 'double-opt-in' ); |
| 216 | 216 | echo '</strong></p><ul style="list-style:disc;margin-left:1.5em">'; |
| 217 | 217 | |
| 218 | + $actions = array(); | |
| 219 | + | |
| 218 | 220 | foreach ( $criticals as $result ) { |
| 219 | 221 | printf( |
| 220 | 222 | '<li><strong>%s</strong><br>%s</li>', |
| 221 | 223 | esc_html( $result->getLabel() ), |
| @@ -220,12 +222,33 @@ | ||
| 220 | 222 | '<li><strong>%s</strong><br>%s</li>', |
| 221 | 223 | esc_html( $result->getLabel() ), |
| 222 | 224 | esc_html( $result->getDescription() ) |
| 223 | 225 | ); |
| 226 | + | |
| 227 | + // Collected rather than printed inline so the buttons end up | |
| 228 | + // in one row under the list instead of interrupting it. | |
| 229 | + if ( $result->getActionUrl() !== '' && $result->getActionLabel() !== '' ) { | |
| 230 | + $actions[ $result->getActionUrl() ] = $result->getActionLabel(); | |
| 231 | + } | |
| 224 | 232 | } |
| 225 | 233 | |
| 234 | + echo '</ul><p>'; | |
| 235 | + | |
| 236 | + // A check that knows how to fix itself says so here. Site Health is | |
| 237 | + // where the full report lives, but a fix that is one click away | |
| 238 | + // should not require finding that screen first — this notice runs | |
| 239 | + // on the dashboard and the plugins list, which is where an operator | |
| 240 | + // already stands when something has just gone wrong. | |
| 241 | + foreach ( $actions as $url => $label ) { | |
| 242 | + printf( | |
| 243 | + '<a class="button button-primary" style="margin-right:.5em" href="%s">%s</a>', | |
| 244 | + esc_url( $url ), | |
| 245 | + esc_html( $label ) | |
| 246 | + ); | |
| 247 | + } | |
| 248 | + | |
| 226 | 249 | printf( |
| 227 | - '</ul><p><a class="button button-primary" href="%s">%s</a></p></div>', | |
| 250 | + '<a class="button" href="%s">%s</a></p></div>', | |
| 228 | 251 | esc_url( admin_url( 'site-health.php' ) ), |
| 229 | 252 | esc_html__( 'Open Site Health', 'double-opt-in' ) |
| 230 | 253 | ); |
| 231 | 254 | } |