Skip to content

Instantly share code, notes, and snippets.

Avatar

Raúl Martínez xyulex

View GitHub Profile
@xyulex
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 (https://hubbik.elearnlab.org/admin/tool/task/scheduledtasks.php)
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
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
1)
$CFG->showuseridentity = 'id';
ó
2)
$table->head[] = 'Id';
$row[] = $user->id;
@xyulex
xyulex / local_wpsso.php
Last active Feb 26, 2018
MOODLE: WP SSO
View local_wpsso.php
<?php
/**
* @package local_wpsso
* @copyright 2018 Raúl Martínez <raul@tresipunt.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../config.php');
require_once("$CFG->dirroot/group/lib.php");
@xyulex
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
xyulex / wp.sh
Last active Feb 13, 2018
WP-CLI WordPress project start
View wp.sh
#!/bin/bash
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="admin@admin.xxx" # 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
xyulex / saveimagefrommform.php
Created Nov 27, 2017
MOODLE: Save image from mform
View saveimagefrommform.php
$name = $mform->get_new_filename('prizeimage');
$mform->save_stored_file('prizeimage',
context_system::instance()->id,
'fpa',
'prizeimage',
$USER->id,
'/',
$name,
true);
@xyulex
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
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
<?php
// local/altamarimport/db/events.php
// This file is part of Moodle - http://moodle.org/
//
// 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
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
<?php
$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.