Prev Next

How to Get Courses Purchased with WooCommerce

[et_pb_dmb_code_snippet code=”PD9waHAKCiRhcmdzID0gYXJyYXkoCiAgICAgICdwb3N0X3R5cGUnCT0+ICdjb3Vyc2UnLAogICAgKTsKCiRxdWVyeSA9IG5ldyBXUF9RdWVyeSgkYXJncyk7Cgp3aGlsZSgkcXVlcnktPmhhdmVfcG9zdHMoKSkgewoJJHF1ZXJ5LT50aGVfcG9zdCgpOwoKICAkY291cnNlX2lkID0gZ2V0X3RoZV9JRCgpOwogICRwcm9kdWN0X2lkID0gd3BjX2dldF9jb25uZWN0ZWRfcHJvZHVjdF9pZCggJGNvdXJzZV9pZCApOwogICRjdXJyZW50X3VzZXIgPSB3cF9nZXRfY3VycmVudF91c2VyKCk7CiAgJGxpbmsgPSBnZXRfdGhlX3Blcm1hbGluaygpOwoKCS8vIGNoZWNrIGlmIHRoZSBjb3Vyc2UgaXMgY29ubmVjdGVkIHRvIGEgV29vQ29tbWVyY2UgcHJvZHVjdC4KICBpZiggd3BjX2dldF9jb25uZWN0ZWRfcHJvZHVjdF9pZCggJGNvdXJzZV9pZCApICE9PSBmYWxzZSApIHsKCgkJLy8gY2hlY2sgdGhhdCB0aGUgY3VzdG9tZXIgaGFzIGJvdWdodCB0aGUgY291cnNlLgogICAgJGhhc19ib3VnaHQgPSB3Y19jdXN0b21lcl9ib3VnaHRfcHJvZHVjdCggJGN1cnJlbnRfdXNlci0+dXNlcl9lbWFpbCwgJGN1cnJlbnRfdXNlci0+SUQsICRwcm9kdWN0X2lkICk7CgoJCS8vIGlmIHRoZSBjdXN0b21lciBoYXMgYm91Z2h0IHRoZSBjb3Vyc2UsIHNob3cgaXQuCiAgICBpZiggJGhhc19ib3VnaHQgIT09IGZhbHNlICkgewogICAgICBlY2hvICc8YSBocmVmPSInIC4gJGxpbmsgLiAnIj4nIC4gZ2V0X3RoZV90aXRsZSgpIC4gJzwvYT4nOwogICAgfQoKICB9Cgp9Cgp3cF9yZXNldF9wb3N0ZGF0YSgpOwoKPz4=” language=”php” style=”github” linenums=”on” _builder_version=”4.6.5″]PD9waHAKCiRhcmdzID0gYXJyYXkoCiAgICAgICdwb3N0X3R5cGUnCT0+ICdjb3Vyc2UnLAogICAgKTsKCiRxdWVyeSA9IG5ldyBXUF9RdWVyeSgkYXJncyk7Cgp3aGlsZSgkcXVlcnktPmhhdmVfcG9zdHMoKSkgewoJJHF1ZXJ5LT50aGVfcG9zdCgpOwoKICAkY291cnNlX2lkID0gZ2V0X3RoZV9JRCgpOwogICRwcm9kdWN0X2lkID0gd3BjX2dldF9jb25uZWN0ZWRfcHJvZHVjdF9pZCggJGNvdXJzZV9pZCApOwogICRjdXJyZW50X3VzZXIgPSB3cF9nZXRfY3VycmVudF91c2VyKCk7CiAgJGxpbmsgPSBnZXRfdGhlX3Blcm1hbGluaygpOwoKCS8vIGNoZWNrIGlmIHRoZSBjb3Vyc2UgaXMgY29ubmVjdGVkIHRvIGEgV29vQ29tbWVyY2UgcHJvZHVjdC4KICBpZiggd3BjX2dldF9jb25uZWN0ZWRfcHJvZHVjdF9pZCggJGNvdXJzZV9pZCApICE9PSBmYWxzZSApIHsKCgkJLy8gY2hlY2sgdGhhdCB0aGUgY3VzdG9tZXIgaGFzIGJvdWdodCB0aGUgY291cnNlLgogICAgJGhhc19ib3VnaHQgPSB3Y19jdXN0b21lcl9ib3VnaHRfcHJvZHVjdCggJGN1cnJlbnRfdXNlci0+dXNlcl9lbWFpbCwgJGN1cnJlbnRfdXNlci0+SUQsICRwcm9kdWN0X2lkICk7CgoJCS8vIGlmIHRoZSBjdXN0b21lciBoYXMgYm91Z2h0IHRoZSBjb3Vyc2UsIHNob3cgaXQuCiAgICBpZiggJGhhc19ib3VnaHQgIT09IGZhbHNlICkgewogICAgICBlY2hvICc8YSBocmVmPSInIC4gJGxpbmsgLiAnIj4nIC4gZ2V0X3RoZV90aXRsZSgpIC4gJzwvYT4nOwogICAgfQoKICB9Cgp9Cgp3cF9yZXNldF9wb3N0ZGF0YSgpOwoKPz4=[/et_pb_dmb_code_snippet]