Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter fahaadsheikh

    (@fahaadsheikh)

    Hello,

    Thankyou very much for your consideration I genuinely appreciate it. Upon copy pasting your exact code I get the “Error will be displayed here” even on successful submissions. Can you please have a look and point me in the right direction on what I could be doing wrong.

    
    <?php
    add_action( 'wp_enqueue_scripts', 'my_llms_tracking_script', 777777 );
    
    function my_llms_tracking_script() {
    
    	ob_start();
    
    	?>
    
    	;( function( $, undefined ) {
    
    		/**
    
    		 * Callback function run before submitting the checkout form for PHP processing
    
    		 * Allows custom addition of stuff prior to checkout
    
    		 * @param    {[type]}    data      optional data passed in when adding the handler
    
    		 * @param    {Function}  callback  callback function
    
    		                                   return true in the callback when successful (form will proceed to the next handler or submit)
    
    		                                   return a string which will be displayed as an error message when failure (halts submission)
    
    		 * @return   void
    
    		 */
    
    		window.my_custom_checkout_handler = function( data, callback ) {
    
    			// data is available when added via add_before_submit_event()
    
    			console.log( data );
    
    			// do stuff here
    
    			fbq('track', 'CompleteRegistration', {
                        		content_name: jQuery( ".tribe-events-single-event-title" ).text(),
                        		content_category: 'Course'
                });
    
    			// on failure return the callback w/ an error message
    
    			return callback( 'This error message will be displayed' );
    
    			// on success return the callback w/ true
    
    			return callback( true );
    
    		};
    
    		// optional object of data passed to the handler
    
    		var my_custom_data = {};
    
    		// add the event
    
    		window.llms.checkout.add_before_submit_event( { data: my_custom_data, handler: window.my_custom_checkout_handler } );
    
    	} )( jQuery );
    
    	<?php
    
    	$script = ob_get_clean();
    
    	wp_add_inline_script( 'llms-form-checkout', $script );
    
    }
    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    Hello,

    I dont want to target completed orders. I just want to target people who actually registered for a course so a pending course registration will also be counted as a conversion.

    A solution I figured out was to bind the CompleteRegistration standard event to the submit button for course registration. I added my code into the following file:

    lifterlms/assets/js/llms-form-checkout.min.js

    Added here:

                l = setInterval(function() {
                    var t = !1,
                        s = !1;
                    if (o >= i) t = !0, s = !0;
                    else if (a === r)
                        if (a === d) t = !0, n.$checkout_form.off("submit", n.submit), fbq('track', 'CompleteRegistration'),n.$checkout_form.trigger("submit");
                        else if (c.length) {
                        t = !0, s = !0;
                        for (var m = e('<ul class="llms-notice llms-error" id="llms-checkout-errors" />'), u = 0; u < c.length; u++) m.append("<li>" + c[u] + "</li>");
                        e(".llms-checkout-wrapper").prepend(m), e("html, body").animate({
                            scrollTop: m.offset().top - 50
                        }, 200)
                    }
                    t && clearInterval(l), s && n.processing("stop"), o++
                }, 100)

    Here fbq(‘track’, ‘CompleteRegistration’), is the code i would like to add once the form is validated and successfully submitted

    Currently this is done on the parent plugin. I was wondering if there was a way that I can do this within my child theme? or create a custom plugin if that’s what required?

    • This reply was modified 7 years, 11 months ago by fahaadsheikh.
    • This reply was modified 7 years, 11 months ago by fahaadsheikh.
    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    Yea if we could just get emails upon registration that would be cool. Thankyou very much

    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    Thankyou very much.

    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    There are a couple of bugs I would also like to address I’ll make a new thread right after this so others could benefit from it too.

    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    I’ve tried disabling the theme and plugins and its the same for me. Yes there is server level caching enabled on this server but there isnt on our staging server. I can privately email you the credentials of our production server if you would like you can check it out there. Here is the system report

    Wordpress
    ——————————————-

    Home Url: https://learn.homework.pk
    Site Url: https://learn.homework.pk
    Version: 4.7.3
    Debug Mode: Yes
    Locale: en_US
    Multisite: No
    Page For Posts: Not Set
    Page On Front: Home (#137)
    Permalink Structure: /%postname%/
    Show On Front: page
    Wp Cron: Yes

    Settings
    ——————————————-

    Version: 3.5.0
    Db Version: 3.5.0
    Course Catalog: Courses (#10427)
    Course Catalog Per Page: 21
    Course Catalog Sorting: menu_order,ASC
    Membership Catalog: Memberships (#10027)
    Membership Catalog Per Page: 10
    Membership Catalog Sorting: menu_order,ASC
    Site Membership: Not Set
    Student Dashboard: My Courses (#9)
    Courses Endpoint: my-courses
    Edit Endpoint: edit-account
    Lost Password Endpoint: lost-password
    Vouchers Endpoint: redeem-voucher
    Autogenerate Username: yes
    Password Strength Meter: no
    Minimum Password Strength: strong
    Terms Required: no
    Terms Page: Not Set
    Checkout Names: required
    Checkout Address: required
    Checkout Phone: required
    Checkout Email Confirmation: yes
    Open Registration: yes
    Registration Names: required
    Registration Address: required
    Registration Phone: required
    Registration Voucher: optional
    Registration Email Confirmation: no
    Account Names: required
    Account Address: required
    Account Phone: required
    Account Email Confirmation: yes
    Checkout Page: Course Checkout (#10599)
    Confirmation Endpoint: confirm-payment
    Force Ssl Checkout: no
    Country: PK
    Currency: PKR
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Decimals: 2
    Trim Zero Decimals: yes
    Recurring Payments: no
    Email From Address: [email protected]
    Email From Name: Homework Learn
    Email Footer Text:
    Email Header Image:
    Cert Bg Width: 800
    Cert Bg Height: 616
    Cert Legacy Compat: no

    Gateways
    ——————————————-

    Manual: Enabled
    Manual Logging: yes
    Manual Order: 0

    Server
    ——————————————-

    Mysql Version: 5.6.35
    Php Curl: Yes
    Php Default Timezone: UTC
    Php Fsockopen: Yes
    Php Max Input Vars: 3000
    Php Max Upload Size: 64 MB
    Php Memory Limit: 256M
    Php Post Max Size: 64M
    Php Soap: Yes
    Php Suhosin: No
    Php Time Limt: 3000
    Php Version: 5.6.16
    Software: Apache
    Wp Memory Limit: 256M

    Theme
    ——————————————-

    Name: Michigan
    Version: 3.1.0
    Themeuri:
    Authoruri:
    Template: michigan
    Child Theme: Yes
    Llms Support: No

    Plugins
    ——————————————-

    BackupBuddy: 7.2.0.1
    Contact Form 7: 4.7
    Contact Form 7 – Dynamic Text Extension: 2.0.2.1
    Contact Form DB: 2.10.26
    Envato WordPress Toolkit: 1.7.3
    Essential Grid: 2.1.0.2
    Flamingo: 1.5
    LifterLMS: 3.5.0
    Post Duplicator: 2.20
    Postman SMTP: 1.7.2
    Slider Revolution: 5.3.1.5
    The Events Calendar: 4.4.4
    Webnus Core: 1.0
    Webnus Time Table: 1.0.0
    WP-PageNavi: 2.91
    WP-PostRatings: 1.84.1
    WPBakery Visual Composer: 5.0.1
    WP Config File Editor: 1.6.5
    WP Maintenance Mode: 2.0.9

    Integrations
    ——————————————-

    BbPress: No
    BuddyPress: No

    Thread Starter fahaadsheikh

    (@fahaadsheikh)

    Hello Chris,

    I’ve tried flushing multiple times but I still get the same error and Thankyou very much

Viewing 7 replies - 1 through 7 (of 7 total)