PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 2.12
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v2.12
5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 3.0.70 3.0.71 3.0.72 All 35 releases
double-opt-in / compatibility / cf7 / WordPress_AdminTables_Columns_CF7.class.php

WordPress_AdminTables_Columns_CF7.class.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 2.12, at compatibility/cf7/WordPress_AdminTables_Columns_CF7.class.php

56 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace forge12\contactform7\CF7DoubleOptIn {
4 if (!defined('ABSPATH')) {
5 exit;
6 }
7
8 /**
9 * Extend the Contact Form 7 Table view
10 * to add custom Columns
11 *
12 * @package forge12\contactform7\CF7OptIn
13 */
14 class WordPress_AdminTables_Columns_CF7
15 {
16 /**
17 * Admin constructor.
18 */
19 public function __construct()
20 {
21 add_action('admin_enqueue_scripts', [$this, 'addAssets']);
22
23 add_filter( 'manage_toplevel_page_wpcf7_columns', array( $this, '_onLoadColumn' ), 999, 1 );
24 add_filter( 'wpcf7_custom_default', array( $this, '_onLoadColumnValue' ), 10, 3 );
25 }
26
27 public function addAssets(){
28 wp_register_style('f12-cf7-doi-cf7', plugin_dir_url(__FILE__).'assets/admin-cf7.css');
29 wp_enqueue_style('f12-cf7-doi-cf7');
30 }
31
32 public function _onLoadColumn( $columns ) {
33 $columns['optins'] = __( 'Opt-Ins', 'affiliater' );
34
35 return $columns;
36 }
37
38 public function _onLoadColumnValue( $html, $item, $column_name ) {
39 switch ( $column_name ) {
40 case 'optins':
41 $this->theOptInsCounter( $item );
42 break;
43 }
44 }
45
46 public function theOptInsCounter($item){
47 $counter = OptIn::get_count($item->id());
48
49 if($counter <= 0){
50 echo esc_attr($counter);
51 }else {
52 echo '<a href="' . admin_url('admin.php') . '?page=f12-cf7-doubleoptin&cf_form_id=' . esc_attr($counter) . '">' . esc_attr($counter) . '</a>';
53 }
54 }
55 }
56 }