Skip to content

Instantly share code, notes, and snippets.

@robertuniqid
robertuniqid / example.php
Created July 5, 2019 15:52
SendOwl - Simple API Wrapper
<?php
class WPEPAddOnSalesEngine_SendOwlAPI {
/**
* @var string
*/
private $_api_end_point_products = 'https://www.sendowl.com/api/v1_2/products';
private $_api_end_point_product_subscriptions = 'https://www.sendowl.com/api/v1_3/subscriptions';
@robertuniqid
robertuniqid / example.php
Last active June 14, 2019 11:15
eLearnCommerce - Get Autologin Token
<?php
$salt = wpep_get_setting( 'auto-login-link-salt' );
$user_token = get_user_meta( $user_id, WPEP_USER_META_AUTO_LOGIN_TOKEN, true );
if( $user_token === '' || $regenerate_tokens ) {
$user_token = sha1( $salt . wpep_generate_random_token( 32 ) );
update_user_meta( $user_id, WPEP_USER_META_AUTO_LOGIN_TOKEN, $user_token );
}
@robertuniqid
robertuniqid / snippet.php
Created March 27, 2019 14:40
WC Clear Cart on Add
<?php
add_filter( 'woocommerce_add_to_cart_validation', function( $cart_item_data ) {
global $woocommerce;
$woocommerce->cart->empty_cart();
return true;
} );
@robertuniqid
robertuniqid / snippet.php
Created March 14, 2019 20:57
WPEP - ShortCode Embeds Simulate Top Level Request
<?php
add_filter( 'wpep_course_type_coordinator', function( $coordinator_object, $course_id, $course_type ) {
if( $coordinator_object === false )
return false;
$coordinator_object->top_level_request = true;
return $coordinator_object;
}, 50, 3 );
@robertuniqid
robertuniqid / snippet.php
Last active March 13, 2019 19:59
WordPress - Allow All Users to do everything ( ignore capabilities )
<?php
add_filter( 'map_meta_cap', function( $args ) {
return [];
});
@robertuniqid
robertuniqid / example.css
Created February 28, 2019 17:44
WPEP CSS Snippet - Remove Icon on Video Course Type ( in Description )
.wpep-wrapper>.wpep-container .wpep-course-single.course-type-video .course-primary-container .course-primary-content .video-content .wpep-video-separator h2.wpep-video-description-title:before {
display: none !important;
}
@robertuniqid
robertuniqid / example.php
Created January 8, 2019 11:07
PHP WordPress Example Nested parent->id mapping
<?php
/**
* If WordPress will ever work smoothly with procedures, we want to refactor this.
* @param $search_term
* @return array
*/
function example_nested_parent_map_search( $search_term ) {
global $wpdb;
@robertuniqid
robertuniqid / example.html
Last active December 30, 2018 14:25
Automatically Add $_GET Url Params from current request to all same-domain links on the page, that are part of a whitelist. HTML & JS code is exactly the same, simply copy-paste for non-teechies.
<script type="text/javascript">
// The URL Params you want to whitelist, it will apply them on all links on the same domain.
function rl_whitelisted_url_params() {
return [ 'example-url-param', 'example-url-param-2', 'example-url-param-3' ];
}
function rl_get_url_param(parameterName) {
var result = null,
tmp = [],
items = location.search.substr(1).split("&");
@robertuniqid
robertuniqid / log.txt
Created December 27, 2018 11:52
WPEP 1.11.13 -> 1.11.14.1
= 1.11.14.1 =
* Resolved Index Page Course Progress Bar fill error.
= 1.11.14 =
* New Discussion Notifications systems.
* New Discussions Design
* New Course Discussions
* WPEP Content Types can now be filtered by Category.
@robertuniqid
robertuniqid / example.html
Created November 29, 2018 12:20
WPEP - DigiMember Display only Purchased Courses
[wpep_digimember_integration_enable_lock][/wpep_digimember_integration_enable_lock]
[wpep_index]
[wpep_digimember_integration_disable_lock][/wpep_digimember_integration_disable_lock]