Plugin Directory

Changeset 3328198


Ignore:
Timestamp:
07/15/2025 11:53:35 AM (9 months ago)
Author:
engagebay
Message:

Added feature for paid courses to sync as deals

Location:
engagebay-add-on-for-learndash
Files:
29 added
8 edited

Legend:

Unmodified
Added
Removed
  • engagebay-add-on-for-learndash/trunk/assets/css/admin-style.css

    r3324935 r3328198  
    179179    display: flex;
    180180    align-items: baseline;
     181    margin-bottom: 8px;
    181182}
    182183
     
    219220}
    220221
    221 .width-20 {
    222     width: 20%;
    223 }
     222.width-30 {
     223    width: 30%;
     224}
  • engagebay-add-on-for-learndash/trunk/engagebay-learndash.php

    r3324935 r3328198  
    1212 * Plugin URI:        https://www.engagebay.com/integrations/learndash-integration
    1313 * Description:       Sync course enrollments with EngageBay to automate emails, track learner progress, and boost engagement through smart workflows
    14  * Version:           1.0
     14 * Version:           1.1
    1515 * Requires at least: 5.2
    1616 * Requires PHP:      7.4
  • engagebay-add-on-for-learndash/trunk/includes/admin/class-engagebay-payment-gateway.php

    r3324935 r3328198  
    3333        $course    = get_post( $course_id );
    3434
    35         $pricing_info = json_decode($object['metadata']['pricing_info'], true);
     35        $pricing_info = json_decode( $object['metadata']['pricing_info'], true );
    3636
    37         $data      = [
     37        $data = [
    3838            'course'         => [
    3939                'id'    => $course_id,
     
    4747        ];
    4848
    49         file_put_contents("payment.json",json_encode($event, JSON_PRETTY_PRINT));
     49        $course_details = [
     50            'user_id'      => $object['metadata']['user_id'],
     51            'course_id'    => $course_id,
     52            'course_title' => $course->post_title,
     53            'url'          => get_permalink( $course->ID ),
     54            'price'        => get_post_meta( $course->ID, '_ld_price', true )
     55        ];
    5056
    5157        EngageBay_LearnDash_Api::trigger_event( EngageBay_LearnDash_Preferences_Section::COURSE_PURCHASED, $data );
     58        EngageBay_LearnDash_Api::trigger_event( EngageBay_LearnDash_Preferences_Section::NEW_ENROLMENT, $course_details, $course->post_title );
    5259    }
    5360}
  • engagebay-add-on-for-learndash/trunk/includes/api/class-engagebay-learndash-api.php

    r3324935 r3328198  
    1717
    1818    private const BASE_API_URL = 'https://app.engagebay.com/dev/api/panel';
    19 //  private const BASE_API_URL = 'https://app-dot-alpha3-dot-accountbox-154605.appspot.com/dev/api/panel';
    2019
    2120    public function validate_rest_api_key( $rest_api_key ) {
     
    6867        ];
    6968
    70         $current_user = wp_get_current_user();
    71 
    7269        if ( $event === EngageBay_LearnDash_Preferences_Section::USER_CREATED ) {
    7370            $actions      = [ 'create_contact' ];
    74             $current_user = get_user( $payload['user_id'] );
    7571        } else if ( $event === EngageBay_LearnDash_Preferences_Section::USER_UPDATED ) {
    7672            $actions      = [ 'update_contact' ];
    77             $current_user = get_user( $payload['user_id'] );
    7873        } else if ( $event === EngageBay_LearnDash_Preferences_Section::COURSE_COMPLETED
    7974                    || $event === EngageBay_LearnDash_Preferences_Section::LESSON_COMPLETED
     
    8277                    || $event === EngageBay_LearnDash_Preferences_Section::COURSE_PURCHASED ) {
    8378            $actions = [ ...$actions, 'update_deal' ];
    84             if (isset($payload['user_id'])) {
    85                 $current_user = get_user($payload['user_id']);
    86             }
    8779        }
    8880
     
    9284
    9385        $additionalInfo = self::prepare_additional_info( $event, $actions, $payload, $name );
     86
     87        $current_user = wp_get_current_user();
     88        if (isset($payload['user_id']) && get_user($payload['user_id'])) {
     89            $current_user = get_user($payload['user_id']);
     90        }
    9491
    9592        $payload = array_merge(
     
    114111        );
    115112
    116         file_put_contents( "payload.json", json_encode( $payload, JSON_PRETTY_PRINT ), FILE_APPEND );
    117 
    118113        $response = wp_remote_post( $url, [
    119114            'headers' => $headers,
     
    121116        ] );
    122117
    123         $response_code = wp_remote_retrieve_response_code( $response );
     118//      $response_code = wp_remote_retrieve_response_code( $response );
    124119        $result        = wp_remote_retrieve_body( $response );
    125         if ( $response_code !== 200 ) {
    126             file_put_contents( "error.json", $result, FILE_APPEND );
    127         }
    128 
    129         file_put_contents( "response.json", json_encode( [
    130             'url'         => $url,
    131             'payload'     => $payload,
    132             'headers'     => $headers,
    133             'status_code' => $response_code,
    134             'result'      => $result
    135         ], JSON_PRETTY_PRINT ), FILE_APPEND );
     120//      if ( $response_code !== 200 ) {
     121//          file_put_contents( "error.json", $result, FILE_APPEND );
     122//      }
     123//
     124//      file_put_contents( "response.json", json_encode( [
     125//          'url'         => $url,
     126//          'payload'     => $payload,
     127//          'headers'     => $headers,
     128//          'status_code' => $response_code,
     129//          'result'      => $result
     130//      ], JSON_PRETTY_PRINT ), FILE_APPEND );
    136131    }
    137132
     
    214209        $response = wp_remote_request( $url, [ 'headers' => $headers ] );
    215210
    216         $response_code = wp_remote_retrieve_response_code( $response );
     211//      $response_code = wp_remote_retrieve_response_code( $response );
    217212        $result        = wp_remote_retrieve_body( $response );
    218         if ( $response_code !== 200 ) {
    219             file_put_contents( "error_fields.json", $result, FILE_APPEND );
    220         }
     213//      if ( $response_code !== 200 ) {
     214//          file_put_contents( "error_fields.json", $result, FILE_APPEND );
     215//      }
    221216
    222217        return json_decode( $result, true );
  • engagebay-add-on-for-learndash/trunk/includes/class-engagebay-learndash.php

    r3324935 r3328198  
    159159        ), 10, 0 );
    160160
    161 //      add_action('learndash_payment_gateway_event_processed', array(
    162 //          $this->engagebay_learndash_payment_gateway,
    163 //          'payment_processed',
    164 //      ), 10, 3);
     161        add_action('learndash_payment_gateway_event_processed', array(
     162            $this->engagebay_learndash_payment_gateway,
     163            'payment_processed',
     164        ), 10, 3);
    165165    }
    166166}
  • engagebay-add-on-for-learndash/trunk/includes/events/class-engagebay-learndash-course.php

    r3324935 r3328198  
    3434        ];
    3535
    36         EngageBay_LearnDash_Api::trigger_event( EngageBay_LearnDash_Preferences_Section::NEW_ENROLMENT, $course_details, $course->post_title );
     36        $courseFee = get_post_meta($course->ID, '_ld_price_type', true);
     37
     38        if ($courseFee === 'free') {
     39            EngageBay_LearnDash_Api::trigger_event( EngageBay_LearnDash_Preferences_Section::NEW_ENROLMENT, $course_details, $course->post_title );
     40        }
    3741    }
    3842
  • engagebay-add-on-for-learndash/trunk/includes/settings/class-engagebay-learndash-preferences-section.php

    r3324935 r3328198  
    118118                echo '<div class="engagebay-ld-preferences-action-group">';
    119119                foreach ( $group['values'] as $key => $label ) {
    120                     if ( $key == 'update_contact_field' || $key == 'create_tag' || $key == 'create_task' ) {
     120                    if ( $key == 'update_contact_field' || $key == 'create_tag' || $key == 'create_task' || $key == 'create_contact_and_deal' ) {
    121121                        switch ( $group_key ) {
     122                            case self::NEW_ENROLMENT:
    122123                            case self::COURSE_COMPLETED:
    123124                            case self::QUIZ_COMPLETED:
     
    139140                        case self::ESSAY_SUBMITTED:
    140141                            if ($key === 'update_contact_field' || $key === 'update_deal_field') {
    141                                 $label_width = 'width-20';
     142                                $label_width = 'width-30';
    142143                            } else {
    143144                                $label_width = null;
  • engagebay-add-on-for-learndash/trunk/readme.txt

    r3325582 r3328198  
    11=== EngageBay Marketing Automation for LearnDash ===
    22Contributors: engagebay
    3 Tags: engagebay, learndash, crm, automation, marketing
     3Tags: engagebay, learndash, marketing automation, crm integration, email marketing, student engagement, course automation
    44Requires at least: 5.2
    55Tested up to: 6.8.1
    66Requires PHP: 7.4
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    1010Plugin URI: https://engagebay.com/learndash
    1111
    12 Seamlessly connect LearnDash with EngageBay CRM. Automatically sync students, apply tags, and trigger marketing workflows based on course activity.
     12Effortlessly connect LearnDash with EngageBay CRM to supercharge student engagement. Automate email campaigns, segment users by course activity, and trigger workflows with zero manual work.
    1313
    1414== Description ==
    15 Connect your LearnDash LMS courses with EngageBay CRM effortlessly.
    16 Automatically sync students, trigger marketing automations, and boost engagement with zero manual work.
     15
     16**Streamline Your Course Marketing with EngageBay + LearnDash Integration**
     17Connect your LearnDash LMS with EngageBay CRM and automate your entire student lifecycle — from enrollment to course completion.
     18
     19This plugin enables seamless syncing of LearnDash user data with EngageBay, allowing you to:
     20
     21- Auto-enroll contacts into marketing lists
     22- Apply tags based on course progress
     23- Trigger email workflows based on enrollment, completion, or quiz results
     24- Segment learners for advanced targeting
     25- Eliminate manual exports and integrations
     26
     27Ideal for course creators, marketers, and education businesses using LearnDash and EngageBay to grow faster.
     28
     29== Features ==
     30
     31* 🔄 Auto-sync LearnDash students to EngageBay CRM
     32* 🏷️ Apply tags based on enrollment, completion, or quiz scores
     33* 📨 Trigger email campaigns or automations inside EngageBay
     34* 🗂️ Segment users based on course behavior and status
     35* 🚀 100% no-code setup and runs automatically in the background
     36* 🔐 Secure API-based connection to EngageBay
    1737
    1838== Installation ==
    19 1. Navigate to **Plugins → Add New** in your WordPress dashboard.
    20 2. Search for "**EngageBay Add-on for LearnDash**."
    21 3. Click **Install Now** and then **Activate**.
    22 4. Go to **LearnDash LMS → Settings -> EngageBay** to configure your API settings & Preferences.
     39
     401. Go to **Plugins → Add New** in your WordPress dashboard.
     412. Search for "**EngageBay Marketing Automation for LearnDash**"
     423. Click **Install Now** and then **Activate**
     434. Navigate to **LearnDash LMS → Settings → EngageBay** to enter your EngageBay API keys and configure preferences
    2344
    2445== How to Use ==
    25 1. Enter your EngageBay API Public Key and Private Key in the settings page.
    26 2. Choose preferences of your choice to trigger EngageBay actions.
    27 3. Set up actions like tagging, list assignments, or CRM field updates.
    28 4. Build automations inside EngageBay based on synced data.
    29 5. Watch your user engagement grow automatically!
     46
     471. Enter your EngageBay Private API Key on the settings page
     482. Choose your sync preferences (trigger on enrollment, completion, quiz, etc.)
     493. Define tags or CRM updates to send
     504. Create automations inside EngageBay based on those tags or events
     515. Sit back and watch your user engagement grow automatically!
    3052
    3153== Frequently Asked Questions ==
    3254
    3355= Do I need an EngageBay account? =
    34 Yes, you must have an EngageBay CRM account to use this plugin.
     56Yes. A free or paid EngageBay CRM account is required. Sign up at [https://engagebay.com](https://engagebay.com)
    3557
    36 = Does this work only with LearnDash? =
    37 Yes, this plugin is specifically designed for LearnDash LMS.
     58= Does this work with other LMS plugins? =
     59No. This integration is built specifically for LearnDash LMS.
    3860
    39 = Can I automate email campaigns based on course activity? =
    40 Absolutely! You can trigger EngageBay automations when a user enrolls or completes a course.
     61= Can I trigger email campaigns automatically when students complete a course? =
     62Yes! You can use completion-based triggers to launch email workflows or CRM automations.
     63
     64= What student activities can be tracked or synced? =
     65Enrollments, course completions, quiz completions, and more — depending on how you configure the plugin.
     66
     67= Is coding required? =
     68Not at all. Everything is handled via your WordPress admin dashboard with simple settings.
    4169
    4270== Screenshots ==
    43 1. Auto sync learners
    44 2. Progress based email automation
    45 3. Segmentation
    46 4. Campaigns
    47 5. Notes
    48 6. Quiz-Completed
     71
     721. Auto-sync learners to EngageBay CRM
     732. Trigger emails based on progress
     743. Smart segmentation for better targeting
     754. Campaign automation from EngageBay
     765. Add notes to contact profiles
     776. Quiz-completed actions for deeper automation
    4978
    5079== Changelog ==
    51 = 1.0.0 =
    52 * Initial release — connect LearnDash with EngageBay CRM and automate your student journey.
    5380
    54 == Upgrade Notice ==
    55 = 1.0.0 =
    56 First release — install fresh and start automating your LearnDash courses.
     81= 1.1 =
     82* Added feature for paid courses to sync as deals in EngageBay
Note: See TracChangeset for help on using the changeset viewer.