Skip to content

Instantly share code, notes, and snippets.

View xyulex's full-sized avatar

Raúl Martínez xyulex

View GitHub Profile
@xyulex
xyulex / Moodle: Alternative login URL
Last active March 7, 2024 11:39
Moodle: Alternative login URL
1. Configurar parámetro: alternateloginurl con la URL alternativa
2. Crear un fichero (html/php) que contenga el siguiente código:
<form method="post" action="http://yoursite.com/login/index.php">
<fieldset>
<label for="username">Username:</label><input type="text" name="username" id="username" />
<label for="password">Password:</label><input type="password" name="password" id="password" />
</fieldset>
<fieldset>
<input type="submit" value="Login" />
@xyulex
xyulex / scorm_create.sh
Last active June 21, 2023 04:28
MOODLE SCRIPT: Crear SCORMS con imsmaanifest.xml, añadiendo el xml a la carpeta html y comprimiendo carpetas en zips
#!/bin/bash
for i in *;
do
if [ -d "$i" ]; then
cd "$i";
for j in *;
do
if [ -d "$j" ]; then
@xyulex
xyulex / moodle_forums.txt
Created January 9, 2019 14:38
MOODLE: Not sending forum emails
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 / PHP: Add text to transparent PNG image
Last active July 21, 2018 15:30
PHP: Add text to transparent PNG image
<?php
$originalImage = "group_icon.png";
if(file_exists($originalImage)) {
$im = imagecreatefrompng($originalImage);
imagesavealpha($im, true); // important to keep the png's transparency
if(!$im) {
die("im is null");
}
$black = imagecolorallocate($im, 0, 0, 0);
$width = 36; // the width of the image
@xyulex
xyulex / add_id.php
Created February 28, 2018 13:04
MOODLE: Add column in user list
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 February 26, 2018 13:32
MOODLE: WP SSO
<?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 / wp.sh
Last active February 13, 2018 10:20
WP-CLI WordPress project start
#!/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 / MOODLE: Obtener origen cadenas
Created February 1, 2018 15:48
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 / saveimagefrommform.php
Created November 27, 2017 11:15
MOODLE: Save image from mform
$name = $mform->get_new_filename('prizeimage');
$mform->save_stored_file('prizeimage',
context_system::instance()->id,
'fpa',
'prizeimage',
$USER->id,
'/',
$name,
true);
@xyulex
xyulex / MOODLE: Importar SCORMS
Last active July 14, 2017 09:54
MOODLE: Importar SCORMS
<?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,
// but WITHOUT ANY WARRANTY; without even the implied warranty of