Skip to content

Instantly share code, notes, and snippets.


Raúl Martínez xyulex

View GitHub Profile
xyulex / moodle_forums.txt
Created Jan 9, 2019
MOODLE: Not sending forum emails
View moodle_forums.txt
Aleshores vaig a tasques
Captura de Pantalla 2019-01-09 a les 15.03.15.png
i veig que fa un dia que no s'executa la d'enviament del fòrum (
Aleshroes em connecto per SSH
sudo su
/usr/bin/php /var/www/html/moodle/admin/tool/task/cli/schedule_task.php --execute='\mod_forum\task\cron_task'
Retorna error "Cannot obtain task lock"
xyulex / add_id.php
Created Feb 28, 2018
MOODLE: Add column in user list
View add_id.php
Añadir columna 'user id' en /admin/user.php
$CFG->showuseridentity = 'id';
$table->head[] = 'Id';
$row[] = $user->id;
xyulex / local_wpsso.php
Last active Feb 26, 2018
View local_wpsso.php
* @package local_wpsso
* @copyright 2018 Raúl Martínez <>
* @license GNU GPL v3 or later
xyulex / MOODLE: Obtener origen cadenas
Created Feb 1, 2018
MOODLE: Obtener origen cadenas
View MOODLE: Obtener origen cadenas
Marcar check en 'Depurando': mostrar origen de cadenas
Pasarle a una URL ?strings=1 para ver origen
Desactivar en producción
xyulex /
Last active Feb 13, 2018
WP-CLI WordPress project start
mkdir $1
cd $1
wp core download # DescargaR el último WordPress
wp config create --dbname=$1 --dbuser=root --dbpass=root --locale=es_ES --force # Crear wp-config
wp db create # Crea la base de datos
wp core install --url="http://localhost/$1/" --title="$2" --admin_user="admin_$1" --admin_password="martin82" --admin_email="" # Instalar WordPress
wp scaffold child-theme $1-child --parent_theme=twentyseventeen # Crear child-theme
wp theme activate $1-child # Activa el child-theme
wp plugin uninstall hello # Elimina 'Hello Dolly'
xyulex / saveimagefrommform.php
Created Nov 27, 2017
MOODLE: Save image from mform
View saveimagefrommform.php
$name = $mform->get_new_filename('prizeimage');
xyulex / MOODLE: Enrol user as a student
Created Jul 14, 2017
MOODLE: Enrol user as a student
View MOODLE: Enrol user as a student
$plugin_instance = $DB->get_record("enrol", array('courseid' => $courseid, 'enrol'=>'manual'));
$plugin = enrol_get_plugin('manual');
$roleid = $DB->get_field('role', 'id', array('shortname' => 'student'));
$plugin->enrol_user($plugin_instance, $userid, $roleid);
xyulex / MOODLE: Eventos al borrar un curso1
Last active Jul 4, 2017
MOODLE: Eventos al borrar un curso
View MOODLE: Eventos al borrar un curso1
// local/altamarimport/db/events.php
// This file is part of Moodle -
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Moodle is distributed in the hope that it will be useful,
xyulex / MOODLE: Descargar fichero externo y grabarlo en el Moodle
Last active Jun 29, 2017
MOODLE: Descargar fichero externo y grabarlo en el Moodle
View MOODLE: Descargar fichero externo y grabarlo en el Moodle
$record = new StdClass();
$record->course = $courseid;
$record->contextid = $usercontextid;
$record->userid = $USER->id;
$record->component = 'user';
$record->filearea = 'draft';
$record->itemid = $draftitemid;
$record->filename = $scormFilename;
$record->filepath = '/';
View MOODLE: Criterios completion
$quizdata->completion = 2;
$quizdata->completionview = 1; // Requerir ver la actividad (para URL, SCORMS...)
$quizdata->completionexpected = 0;
$quizdata->completionusegrade = 1; // Requerir recibir nota (para Quizzes, Assigns...)
You can’t perform that action at this time.