Skip to content

Commit 2211657

Browse files
committed
Limit use of "Send Notifications Delay" to existing users, preparing for its future removal in favour of notification events.
1 parent c2b668b commit 2211657

File tree

1 file changed

+76
-64
lines changed

1 file changed

+76
-64
lines changed

views/html-admin-feed-settings.php

Lines changed: 76 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -279,70 +279,6 @@ function _pronamic_pay_gravityforms_dropdown_input( $form, $args ) {
279279
</td>
280280
</tr>
281281

282-
<?php
283-
284-
$notifications = [];
285-
286-
if ( isset( $form_meta['notifications'] ) && is_array( $form_meta['notifications'] ) ) {
287-
$notifications = $form_meta['notifications'];
288-
}
289-
290-
$notifications = \array_filter(
291-
$notifications,
292-
function ( $notification ) {
293-
return 'form_submission' === $notification['event'];
294-
}
295-
);
296-
297-
if ( count( $notifications ) > 0 ) :
298-
?>
299-
300-
<tr>
301-
<th scope="row">
302-
<?php esc_html_e( 'Send Notifications Delay', 'pronamic_ideal' ); ?>
303-
304-
<span class="dashicons dashicons-editor-help pronamic-pay-tip" title="<?php esc_attr_e( 'Notifications for which sending will be delayed until the payment has been received.', 'pronamic_ideal' ); ?>"></span>
305-
</th>
306-
<td>
307-
<p>
308-
<?php esc_html_e( 'Delay sending notifications until payment has been received.', 'pronamic_ideal' ); ?>
309-
</p>
310-
311-
<ul id="gf_ideal_delay_notifications">
312-
313-
<?php foreach ( $notifications as $notification ) : ?>
314-
315-
<li>
316-
<?php
317-
318-
$id = $notification['id'];
319-
320-
printf(
321-
'<input id="%s" type="checkbox" value="%s" name="_pronamic_pay_gf_delay_notification_ids[]" %s />',
322-
esc_attr( 'pronamic-pay-gf-notification-' . $id ),
323-
esc_attr( $id ),
324-
checked( in_array( $id, $pay_feed->delay_notification_ids, true ), true, false )
325-
);
326-
327-
printf( ' ' );
328-
329-
printf(
330-
'<label class="inline" for="%s">%s</label>',
331-
esc_attr( 'pronamic-pay-gf-notification-' . $id ),
332-
esc_html( $notification['name'] )
333-
);
334-
335-
?>
336-
</li>
337-
338-
<?php endforeach; ?>
339-
340-
</ul>
341-
</td>
342-
</tr>
343-
344-
<?php endif; ?>
345-
346282
<tr>
347283
<th scope="row">
348284
<?php esc_html_e( 'Delay actions', 'pronamic_ideal' ); ?>
@@ -396,6 +332,82 @@ function ( $action ) {
396332
</ul>
397333
</td>
398334
</tr>
335+
336+
<?php
337+
338+
$notifications = [];
339+
340+
if ( isset( $form_meta['notifications'] ) && is_array( $form_meta['notifications'] ) ) {
341+
$notifications = $form_meta['notifications'];
342+
}
343+
344+
$notifications = \array_filter(
345+
$notifications,
346+
function ( $notification ) {
347+
return 'form_submission' === $notification['event'];
348+
}
349+
);
350+
351+
if ( count( $notifications ) > 0 ) :
352+
?>
353+
354+
<tr>
355+
<th scope="row">
356+
<?php esc_html_e( 'Send Notifications Delay', 'pronamic_ideal' ); ?>
357+
358+
<span class="dashicons dashicons-editor-help pronamic-pay-tip" title="<?php esc_attr_e( 'Notifications for which sending will be delayed until the payment has been received.', 'pronamic_ideal' ); ?>"></span>
359+
</th>
360+
<td>
361+
<?php if ( $feed->has_delayed_notifications() ) : ?>
362+
363+
<p>
364+
<?php esc_html_e( 'Delay sending notifications until payment has been received.', 'pronamic_ideal' ); ?>
365+
</p>
366+
367+
<ul id="gf_ideal_delay_notifications">
368+
369+
<?php foreach ( $notifications as $notification ) : ?>
370+
371+
<li>
372+
<?php
373+
374+
$id = $notification['id'];
375+
376+
printf(
377+
'<input id="%s" type="checkbox" value="%s" name="_pronamic_pay_gf_delay_notification_ids[]" %s />',
378+
esc_attr( 'pronamic-pay-gf-notification-' . $id ),
379+
esc_attr( $id ),
380+
checked( in_array( $id, $pay_feed->delay_notification_ids, true ), true, false )
381+
);
382+
383+
printf( ' ' );
384+
385+
printf(
386+
'<label class="inline" for="%s">%s</label>',
387+
esc_attr( 'pronamic-pay-gf-notification-' . $id ),
388+
esc_html( $notification['name'] )
389+
);
390+
391+
?>
392+
</li>
393+
394+
<?php endforeach; ?>
395+
396+
</ul>
397+
398+
<?php endif; ?>
399+
400+
<?php if ( ! $feed->has_delayed_notifications() ) : ?>
401+
402+
<p>
403+
<?php esc_html_e( 'To send notifications after a succesful payment, choose an event in the notification settings.', 'pronamic_ideal' ); ?>
404+
</p>
405+
406+
<?php endif; ?>
407+
</td>
408+
</tr>
409+
410+
<?php endif; ?>
399411
</table>
400412
</div>
401413

0 commit comments

Comments
 (0)