Plugin Directory

Changeset 2998124


Ignore:
Timestamp:
11/18/2023 03:24:36 PM (16 months ago)
Author:
bogdanfix
Message:

release 1.3.0 (WooCommerce HPOS, LearnDash Course Enrollment)

Location:
wp-sendfox/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-sendfox/trunk/lang/sf4wp.pot

    r2832500 r2998124  
    33msgstr ""
    44"Project-Id-Version: SendFox for Wordpress\n"
    5 "POT-Creation-Date: 2022-09-15 21:55+0600\n"
     5"POT-Creation-Date: 2023-11-17 17:49+0600\n"
    66"PO-Revision-Date: 2020-03-03 17:39+0600\n"
    77"Last-Translator: \n"
     
    152152msgstr ""
    153153
    154 #: wp-sendfox-admin.php:100 wp-sendfox-admin.php:288
     154#: wp-sendfox-admin.php:100 wp-sendfox-admin.php:295
    155155msgid "Integrations"
    156156msgstr ""
     
    176176msgstr ""
    177177
    178 #: wp-sendfox-admin.php:157 wp-sendfox.php:381
     178#: wp-sendfox-admin.php:157 wp-sendfox.php:389
    179179msgid "Error: Response Status"
    180180msgstr ""
     
    273273msgstr ""
    274274
    275 #: wp-sendfox-admin.php:289
     275#: wp-sendfox-admin.php:283
     276msgid "LearnDash Course Enrollment"
     277msgstr ""
     278
     279#: wp-sendfox-admin.php:284
     280msgid "Subscribes people, when they enroll into your LearnDash courses"
     281msgstr ""
     282
     283#: wp-sendfox-admin.php:296
    276284msgid "back to all integrations"
    277285msgstr ""
    278286
    279 #: wp-sendfox-admin.php:298
     287#: wp-sendfox-admin.php:305
    280288msgid ""
    281289"The table below shows all available integrations. Click on the name of an "
     
    283291msgstr ""
    284292
    285 #: wp-sendfox-admin.php:306
     293#: wp-sendfox-admin.php:313
    286294msgid "integration settings"
    287295msgstr ""
    288296
    289 #: wp-sendfox-admin.php:323
     297#: wp-sendfox-admin.php:330
    290298msgid "Name"
    291299msgstr ""
    292300
    293 #: wp-sendfox-admin.php:324
     301#: wp-sendfox-admin.php:331
    294302msgid "Description"
    295303msgstr ""
    296304
    297 #: wp-sendfox-admin.php:325
     305#: wp-sendfox-admin.php:332
    298306msgid "Status"
    299307msgstr ""
    300308
    301 #: wp-sendfox-admin.php:334
     309#: wp-sendfox-admin.php:341
    302310msgid "Configure this integration"
    303311msgstr ""
    304312
    305 #: wp-sendfox-admin.php:374 wp-sendfox-admin.php:598 wp-sendfox-admin.php:635
     313#: wp-sendfox-admin.php:381 wp-sendfox-admin.php:603 wp-sendfox-admin.php:690
     314#: wp-sendfox-admin.php:727
    306315msgid "Enable?"
    307316msgstr ""
    308317
    309 #: wp-sendfox-admin.php:384 wp-sendfox-admin.php:402 wp-sendfox-admin.php:422
    310 #: wp-sendfox-admin.php:504 wp-sendfox-admin.php:524 wp-sendfox-admin.php:608
    311 #: wp-sendfox-admin.php:645
     318#: wp-sendfox-admin.php:391 wp-sendfox-admin.php:409 wp-sendfox-admin.php:429
     319#: wp-sendfox-admin.php:511 wp-sendfox-admin.php:531 wp-sendfox-admin.php:613
     320#: wp-sendfox-admin.php:700 wp-sendfox-admin.php:737
    312321msgid "yes"
    313322msgstr ""
    314323
    315 #: wp-sendfox-admin.php:386
     324#: wp-sendfox-admin.php:393
    316325#, php-format
    317326msgid ""
     
    319328msgstr ""
    320329
    321 #: wp-sendfox-admin.php:392
     330#: wp-sendfox-admin.php:399
    322331msgid "Implicit?"
    323332msgstr ""
    324333
    325 #: wp-sendfox-admin.php:404
     334#: wp-sendfox-admin.php:411
    326335msgid ""
    327336"Select \"yes\" if you want to subscribe people without asking them "
     
    329338msgstr ""
    330339
    331 #: wp-sendfox-admin.php:406
     340#: wp-sendfox-admin.php:413
    332341msgid "Does not bypass the double opt-in on Free & Lifetime plans."
    333342msgstr ""
    334343
    335 #: wp-sendfox-admin.php:412
     344#: wp-sendfox-admin.php:419
    336345msgid "Pre-checked?"
    337346msgstr ""
    338347
    339 #: wp-sendfox-admin.php:424
     348#: wp-sendfox-admin.php:431
    340349msgid "Select \"yes\" if the checkbox should be pre-checked."
    341350msgstr ""
    342351
    343 #: wp-sendfox-admin.php:430
     352#: wp-sendfox-admin.php:437 wp-sendfox-admin.php:621
    344353msgid "SendFox list"
    345354msgstr ""
    346355
    347 #: wp-sendfox-admin.php:442 wp-sendfox-admin.php:698
     356#: wp-sendfox-admin.php:449 wp-sendfox-admin.php:633 wp-sendfox-admin.php:790
    348357msgid "are you connected to SendFox?"
    349358msgstr ""
    350359
    351 #: wp-sendfox-admin.php:453
     360#: wp-sendfox-admin.php:460 wp-sendfox-admin.php:644
    352361msgid "select the list..."
    353362msgstr ""
    354363
    355 #: wp-sendfox-admin.php:476
     364#: wp-sendfox-admin.php:483
    356365msgid "Checkbox label text"
    357366msgstr ""
    358367
    359 #: wp-sendfox-admin.php:488
     368#: wp-sendfox-admin.php:495
    360369msgid ""
    361370"HTML tags like <code>&lt;strong&gt&lt;em&gt&lt;a&gt</code> are allowed in "
     
    363372msgstr ""
    364373
    365 #: wp-sendfox-admin.php:494
     374#: wp-sendfox-admin.php:501
    366375msgid "Load default CSS?"
    367376msgstr ""
    368377
    369 #: wp-sendfox-admin.php:506
     378#: wp-sendfox-admin.php:513
    370379msgid "Select \"yes\" if the checkbox looks sloppy."
    371380msgstr ""
    372381
    373 #: wp-sendfox-admin.php:514
     382#: wp-sendfox-admin.php:521
    374383msgid "Manual comment approval check?"
    375384msgstr ""
    376385
    377 #: wp-sendfox-admin.php:526
     386#: wp-sendfox-admin.php:533
    378387msgid ""
    379388"Submit email to SendFox after comment was approved manually. Otherwise, "
     
    381390msgstr ""
    382391
    383 #: wp-sendfox-admin.php:536
     392#: wp-sendfox-admin.php:543
    384393msgid "Position on checkout"
    385394msgstr ""
    386395
    387 #: wp-sendfox-admin.php:541
     396#: wp-sendfox-admin.php:548
    388397msgid "select the position..."
    389398msgstr ""
    390399
    391 #: wp-sendfox-admin.php:550
     400#: wp-sendfox-admin.php:557
    392401msgid "After billing details"
    393402msgstr ""
    394403
    395 #: wp-sendfox-admin.php:551
     404#: wp-sendfox-admin.php:558
    396405msgid "After shipping details"
    397406msgstr ""
    398407
    399 #: wp-sendfox-admin.php:552
     408#: wp-sendfox-admin.php:559
    400409msgid "After customer details"
    401410msgstr ""
    402411
    403 #: wp-sendfox-admin.php:553
     412#: wp-sendfox-admin.php:560
    404413msgid "Before submit button"
    405414msgstr ""
    406415
    407 #: wp-sendfox-admin.php:554
     416#: wp-sendfox-admin.php:561
    408417msgid "After order notes"
    409418msgstr ""
    410419
    411 #: wp-sendfox-admin.php:593
     420#: wp-sendfox-admin.php:615
     421#, php-format
     422msgid ""
     423"Enable the %s integration? All new enrollees to any course will be "
     424"subscribed to your list."
     425msgstr ""
     426
     427#: wp-sendfox-admin.php:685
    412428msgid ""
    413429"Important: Please, make sure only one Divi Theme or Divi Builder is "
     
    415431msgstr ""
    416432
    417 #: wp-sendfox-admin.php:610
     433#: wp-sendfox-admin.php:702
    418434#, php-format
    419435msgid ""
     
    422438msgstr ""
    423439
    424 #: wp-sendfox-admin.php:646
     440#: wp-sendfox-admin.php:738
    425441#, php-format
    426442msgid ""
     
    429445msgstr ""
    430446
    431 #: wp-sendfox-admin.php:670
     447#: wp-sendfox-admin.php:762
    432448msgid "Export your contacts"
    433449msgstr ""
    434450
    435 #: wp-sendfox-admin.php:674
     451#: wp-sendfox-admin.php:766
    436452msgid ""
    437453"Here you can export either all your Wordpress user emails or all your "
     
    439455msgstr ""
    440456
    441 #: wp-sendfox-admin.php:676
     457#: wp-sendfox-admin.php:768
    442458msgid "If email already exists in your list(s), it will be ignored."
    443459msgstr ""
    444460
    445 #: wp-sendfox-admin.php:680
     461#: wp-sendfox-admin.php:772
    446462msgid ""
    447463"To start pick the destination and source below and click \"Start export\":"
    448464msgstr ""
    449465
    450 #: wp-sendfox-admin.php:685
     466#: wp-sendfox-admin.php:777
    451467msgid "Pick the List (export destination):"
    452468msgstr ""
    453469
    454 #: wp-sendfox-admin.php:718
     470#: wp-sendfox-admin.php:810
    455471msgid "Pick Export mode (export source):"
    456472msgstr ""
    457473
    458 #: wp-sendfox-admin.php:722
     474#: wp-sendfox-admin.php:814
    459475msgid "Export Wordpress user emails"
    460476msgstr ""
    461477
    462 #: wp-sendfox-admin.php:723
     478#: wp-sendfox-admin.php:815
    463479msgid "Export WooCommerce customer emails"
    464480msgstr ""
    465481
    466 #: wp-sendfox-admin.php:728
     482#: wp-sendfox-admin.php:820
    467483msgid "Do not close or reload the page during export."
    468484msgstr ""
    469485
    470 #: wp-sendfox-admin.php:740
     486#: wp-sendfox-admin.php:832
    471487msgid "Start export"
    472488msgstr ""
    473489
    474 #: wp-sendfox-admin.php:744
     490#: wp-sendfox-admin.php:836
    475491msgid "Contacts exported successfully:"
    476492msgstr ""
    477493
    478 #: wp-sendfox-admin.php:745
     494#: wp-sendfox-admin.php:837
    479495msgid "Contacts not exported:"
    480496msgstr ""
    481497
    482 #: wp-sendfox-admin.php:989
     498#: wp-sendfox-admin.php:1081
    483499msgid "Logged data"
    484500msgstr ""
    485501
    486 #: wp-sendfox-admin.php:993
     502#: wp-sendfox-admin.php:1085
    487503msgid ""
    488504"Here you can find the detailed description of all the SendFox API requests "
     
    490506msgstr ""
    491507
    492 #: wp-sendfox-admin.php:1004
     508#: wp-sendfox-admin.php:1096
    493509msgid "Log was cleared successfully."
    494510msgstr ""
    495511
    496 #: wp-sendfox-admin.php:1012
     512#: wp-sendfox-admin.php:1104
    497513msgid "Oops, log is empty..."
    498514msgstr ""
    499515
    500 #: wp-sendfox-admin.php:1026
     516#: wp-sendfox-admin.php:1118
    501517msgid "Clear log"
    502518msgstr ""
    503519
    504 #: wp-sendfox.php:126
     520#: wp-sendfox.php:134
    505521msgid "Oops, you can't access this page."
    506522msgstr ""
    507523
    508 #: wp-sendfox.php:283
     524#: wp-sendfox.php:291
    509525msgid "API Key is not set."
    510526msgstr ""
    511527
    512 #: wp-sendfox.php:341
     528#: wp-sendfox.php:349
    513529msgid "JSON Parse"
    514530msgstr ""
  • wp-sendfox/trunk/readme.txt

    r2834234 r2998124  
    44Tags: sendfox, integration, woocommerce, wordpress, wp, export, emails, users, api
    55Requires at least: 4.6
    6 Tested up to: 6.1
     6Tested up to: 6.4
    77Requires PHP: 5.2.4
    8 Stable tag: 1.2.0
     8Stable tag: 1.3.0
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5656== Changelog ==
    5757
     58= 1.3.0 =
     59* integration: LearnDash Course Enrollment (Big thanks to Rodolfo Martinez!);
     60* feature: added WooCommerce HPOS support;
     61
    5862= 1.2.0 =
    5963* feature: (Gutenberg Opt-in Block) added form border styling options, button border styling options, form width (fixed or 100%), added separate sections for Form and Button options in Gutenberg Sidebar, added transparency selector for Form Background colorpicker;
  • wp-sendfox/trunk/wp-sendfox-admin.php

    r2772043 r2998124  
    277277                    'description' => __( 'Adds new customizable Email Optin block to Gutenberg. Pick a list and let everybody subscribe from any page.', 'sf4wp' ),
    278278                ),
     279
     280                // LearnDash integration
     281
     282                'learndash-course' => array(
     283                    'title' => __( 'LearnDash Course Enrollment', 'sf4wp' ),
     284                    'description' => __( 'Subscribes people, when they enroll into your LearnDash courses', 'sf4wp' ),
     285                ),
    279286            );
    280287
     
    583590<?php
    584591                elseif(
     592                    'learndash-course' === $integration
     593                ):
     594
     595                    if( empty( $options[ $integration ] ) )
     596                    {
     597                        $options[ $integration ] = array();
     598                    }
     599?>
     600                <table class="form-table"><tbody>
     601
     602                    <tr>
     603                        <th><?php _e( 'Enable?', 'sf4wp' ); ?></th>
     604                        <td>
     605                           
     606                            <input
     607                                type="checkbox"
     608                                name="gb_sf4wp_options[<?php echo $integration; ?>][enabled]"
     609                                value="1"
     610                                <?php
     611                                echo ( !empty( $options[ $integration ]['enabled'] ) ?
     612                                    checked( $options[ $integration ]['enabled'], '1', FALSE ) : '' );
     613                                ?> /> <?php _e( 'yes', 'sf4wp' ); ?>
     614
     615                            <p class="hint"><?php echo sprintf( __( 'Enable the %s integration? All new enrollees to any course will be subscribed to your list.', 'sf4wp' ), $all_integrations[ $integration ]['title'] ); ?></p>
     616
     617                        </td>
     618                    </tr>
     619
     620                    <tr>
     621                        <th><?php _e( 'SendFox list', 'sf4wp' ); ?></th>
     622                        <td>
     623                            <?php
     624
     625                                $lists = gb_sf4wp_get_lists();
     626
     627                                if(
     628                                    $lists['status'] === 'error' ||
     629                                    empty( $lists['result'] ) ||
     630                                    empty( $lists['result']['data'] )
     631                                )
     632                                {
     633                                    echo 'No lists found, <a href="' . admin_url( 'admin.php?page=' . GB_SF4WP_ID . '&tab=connect' ) . '">' . __( 'are you connected to SendFox?', 'sf4wp' ) . '</a>';
     634                                }
     635                                else
     636                                {
     637                                    echo '<select name="gb_sf4wp_options[' . $integration . '][list]" class="widefat">';
     638
     639                                    if( empty( $options[ $integration ]['list'] ) )
     640                                    {
     641                                        $options[ $integration ]['list'] = '';
     642                                    }
     643
     644                                    echo '<option value="">' . __( 'select the list...', 'sf4wp' ) . '</option>';
     645
     646                                    foreach( $lists['result']['data'] as $l )
     647                                    {
     648                                        if( $options[ $integration ]['list'] == $l['id'] )
     649                                        {
     650                                            echo '<option value="' . $l['id'] . '" selected="selected">' . $l['name'] . '</option>';
     651                                        }
     652                                        else
     653                                        {
     654                                            echo '<option value="' . $l['id'] . '">' . $l['name'] . '</option>';
     655                                        }
     656                                    }
     657
     658                                    echo '</select>';
     659                                }
     660
     661                            ?>
     662
     663                        </td>
     664                    </tr>
     665
     666                </tbody></table>
     667
     668                <?php // to help pre_update_option function process single checkbox properly ?>
     669                <input type="hidden" name="gb_sf4wp_options[<?php echo $integration; ?>][dummy]" value="1" />
     670
     671                <div>
     672                    <?php submit_button(); ?>
     673                </div>
     674
     675<?php
     676                elseif(
    585677                    'divi' === $integration
    586678                ):
  • wp-sendfox/trunk/wp-sendfox.php

    r2834235 r2998124  
    66Author: BogdanFix
    77Author URI: https://bogdanfix.com/
    8 Version: 1.2.0
     8Version: 1.3.0
    99Text Domain: sf4wp
    1010Domain Path: /lang
     
    1616
    1717define( 'GB_SF4WP_NAME', 'SendFox for WordPress' );
    18 define( 'GB_SF4WP_VER', '1.2.0' );
     18define( 'GB_SF4WP_VER', '1.3.0' );
    1919define( 'GB_SF4WP_ID', 'wp-sendfox' );
    2020
     
    7979        }
    8080    }
     81
     82    // declare WooCommerce HPOS support
     83
     84    add_action( 'before_woocommerce_init', function() {
     85        if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
     86            \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
     87        }
     88    } );
    8189}
    8290add_action( 'init', 'gb_sf4wp_init' );
     
    848856
    849857/**
     858 * LearnDash Course Enrollment: handle enrollment
     859 *
     860 * @since 1.3.0
     861 */
     862
     863function gb_sf4wp_learndash_course_enroll( $user_id, $course_id, $course_access_list, $remove )
     864{
     865    if( ! $remove )
     866    {
     867        $user = get_user_by( 'id', $user_id );
     868
     869        if( !empty( $user ) && !empty( $user->user_email ) )
     870        {
     871            $options = get_option( 'gb_sf4wp_options' );
     872
     873            if(
     874                !empty( $options['learndash-course'] ) &&
     875                !empty( $options['learndash-course']['enabled'] ) &&
     876                !empty( $options['learndash-course']['list'] )
     877            )
     878            {
     879                $contact = array(
     880                    'email' => $user->user_email,
     881                    'lists' => array(
     882                        intval( $options['learndash-course']['list'] )
     883                    ),
     884                );
     885
     886                if( !empty( $user->user_nicename ) )
     887                {
     888                    $contact['first_name'] = $user->user_nicename;
     889                }
     890
     891                $contact = apply_filters( 'sf4wp_before_add_contact', $contact, 'learndash-course', $user );
     892
     893                $result = gb_sf4wp_add_contact( $contact );
     894            }
     895        }
     896    }
     897}
     898add_action( 'learndash_update_course_access', 'gb_sf4wp_learndash_course_enroll', 10, 4 );
     899
     900/**
    850901 * Process synchronization
    851902 *
     
    891942                global $wpdb;
    892943
    893                 $users = $wpdb->get_var(
    894 
    895                     "SELECT COUNT(DISTINCT meta_value)
    896                     FROM {$wpdb->postmeta}
    897                     WHERE meta_key = '_billing_email' AND meta_value <> '' ;"
    898 
    899                 );
     944                if( Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() )
     945                {
     946                    $orders = wc_get_orders(
     947                        array(
     948                            'field_query' => array(
     949                                array(
     950                                    'field' => 'billing_email',
     951                                    'value' => '',
     952                                    'comparison' => '!='
     953                                ),
     954                            ),
     955                            'limit' => -1,
     956                            'return' => 'ids',
     957                        )
     958                    );
     959
     960                    $users = count( $orders );
     961                }
     962                else
     963                {
     964                    $users = $wpdb->get_var(
     965
     966                        "SELECT COUNT(DISTINCT meta_value)
     967                        FROM {$wpdb->postmeta}
     968                        WHERE meta_key = '_billing_email' AND meta_value <> '' ;"
     969
     970                    );
     971                }
    900972
    901973                if( !empty( $users ) )
     
    10051077                $limit = intval( GB_SF4WP_USERS_PER_STEP );
    10061078
    1007                 $customers = $wpdb->get_results(
    1008 
    1009                     "SELECT DISTINCT meta_value as billing_email
    1010                     FROM {$wpdb->postmeta}
    1011                     WHERE meta_key = '_billing_email' AND meta_value <> ''
    1012                     LIMIT {$offset}, {$limit};"
    1013                 );
     1079                if( Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() )
     1080                {
     1081                    $orders = wc_get_orders(
     1082                        array(
     1083                            'field_query' => array(
     1084                                array(
     1085                                    'field' => 'billing_email',
     1086                                    'value' => '',
     1087                                    'comparison' => '!='
     1088                                ),
     1089                            ),
     1090                            'limit' => $limit,
     1091                            'offset' => $offset
     1092                        )
     1093                    );
     1094
     1095                    $customers = array();
     1096
     1097                    if( !empty( $orders ) )
     1098                    {
     1099                        $c = new stdClass();
     1100
     1101                        foreach( $orders as $o )
     1102                        {
     1103                            $c = new stdClass();
     1104                            $c->billing_email = $o->get_billing_email();
     1105
     1106                            $customers[] = $c;
     1107                        }
     1108                    }
     1109                }
     1110                else
     1111                {
     1112                    $customers = $wpdb->get_results(
     1113
     1114                        "SELECT DISTINCT meta_value as billing_email
     1115                        FROM {$wpdb->postmeta}
     1116                        WHERE meta_key = '_billing_email' AND meta_value <> ''
     1117                        LIMIT {$offset}, {$limit};"
     1118                    );
     1119                }
    10141120
    10151121                if( !empty( $customers ) )
Note: See TracChangeset for help on using the changeset viewer.