Skip to content

Instantly share code, notes, and snippets.

@ragoand
ragoand / play-pause-on-focus-change.html
Created March 13, 2023 10:18
Play/Pause a Vimeo Video on window focus change
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
jQuery(document).ready(function() {
let hasFocus = true;
<akomaNtoso xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0" xsi:schemaLocation="http://docs.oasis-open.org/legaldocml/ns/akn/3.0 akomantoso30.xsd">
<act name="act">
<meta/>
<body eId="body_1">
<p eId="p_1">‌</p>
</body>
</act>
</akomaNtoso>
@ragoand
ragoand / custom-columns.php
Created July 28, 2022 08:26
Add cutom columns to a WP List Table
// Add the custom columns to the book post type:
add_filter( 'manage_book_posts_columns', 'set_custom_edit_book_columns' );
function set_custom_edit_book_columns($columns) {
unset( $columns['author'] );
$columns['book_author'] = __( 'Author', 'textdomain' );
$columns['publisher'] = __( 'Publisher', 'textdomain' );
return $columns;
}
// add filter
add_filter( 'stm_lms_lesson_content', 'stm_lms_override_lesson_content', 10, 3 );
// override lesson content (scorm example)
function stm_lms_override_lesson_content( $template, $post_id, $item_id ) {
$lesson_type = get_post_meta( $item_id, 'type', true );
if ( $lesson_type === 'scorm' ) {
$this->enqueue_scorm_scripts();
$scorm_url = false;
$scorm_meta = false;
<?php
To review the saving process: masterstudy-lms-learning-management-system/lms/classes/user.php, function save_user_info
1) Aggiungere tramite filtro i valori che lo script cerca e il loro relativo valore
add_filter( 'stm_lms_current_user_data', 'current_user_data' );
function current_user_data($current_user_data) {
$current_user_data['billing_vat_number'] = get_user_meta(get_current_user_id(), 'billing_vat_number');
$current_user_data['billing_tax_code'] = get_user_meta(get_current_user_id(), 'billing_tax_code');
return $current_user_data;
<?php
function stm_lms_scorm_allowed_files_ext($allowed_ext) {
array_push($allowed_ext, 'cur');
array_push($allowed_ext, 'DS_Store');
return $allowed_ext;
}
add_filter('stm_lms_scorm_allowed_files_ext', 'stm_lms_scorm_allowed_files_ext');
@ragoand
ragoand / mainwp-add-child-info
Created January 19, 2022 10:36
Add MainWP Child info and save
/**
* Code for MAINWP DASH
* Save information to the table {table_prefix}_mainwp_wp_options once the site is successfully synced
* @param $pWebsite
* @param $information
*
* @return void
*/
function mainwp_save_information( $pWebsite, $information ){