Skip to content

Instantly share code, notes, and snippets.

<?php
echo dirname(__FILE__)."<br>";
$locales = ["af_NA", "af_ZA", "af", "ak_GH", "ak", "sq_AL", "sq", "am_ET", "am", "ar_DZ", "ar_BH", "ar_EG", "ar_IQ", "ar_JO", "ar_KW", "ar_LB", "ar_LY", "ar_MA", "ar_OM", "ar_QA", "ar_SA", "ar_SD", "ar_SY", "ar_TN", "ar_AE", "ar_YE", "ar", "hy_AM", "hy", "as_IN", "as", "asa_TZ", "asa", "az_Cyrl", "az_Cyrl_AZ", "az_Latn", "az_Latn_AZ", "az", "bm_ML", "bm", "eu_ES", "eu", "be_BY", "be", "bem_ZM", "bem", "bez_TZ", "bez", "bn_BD", "bn_IN", "bn", "bs_BA", "bs", "bg_BG", "bg", "my_MM", "my", "ca_ES", "ca", "tzm_Latn", "tzm_Latn_MA", "tzm", "chr_US", "chr", "cgg_UG", "cgg", "zh_Hans", "zh_Hans_CN", "zh_Hans_HK", "zh_Hans_MO", "zh_Hans_SG", "zh_Hant", "zh_Hant_HK", "zh_Hant_MO", "zh_Hant_TW", "zh", "kw_GB", "kw", "hr_HR", "hr", "cs_CZ", "cs", "da_DK", "da", "nl_BE", "nl_NL", "nl", "ebu_KE", "ebu", "en_AS", "en_AU", "en_BE", "en_BZ", "en_BW", "en_CA", "en_GU", "en_HK", "en_IN", "en_IE", "en_JM", "en_MT", "en_MH", "en_MU", "en_NA", "en_NZ", "en_MP", "en_PK", "en_PH", "en_SG", "en_Z
<?php
/*
write all formvalues as well as the complete formit config into modx error log
*/
$modx->log(xPDO::LOG_LEVEL_ERROR, "snippetname values: " . print_r($hook->getValues(), true));
$modx->log(xPDO::LOG_LEVEL_ERROR, "snippetname config: " . print_r($hook->formit->config, true));
return true;
@pepebe
pepebe / gist:2483894
Created April 24, 2012 21:17
MODx: Get all members of a user group in MODx Revolution.
by kairon - http://www.unchi.co.uk/author/admin/
Get all members of a user group in MODx Revolution. This can been done by accessing the database in the following way.
<?php
$usergroup = 4;
$c = $modx->newQuery('modUser');
$c->innerJoin ('modUserProfile','Profile');
$c->innerJoin ('modUserGroupMember','UserGroupMembers');
$c->innerJoin ('modUserGroup','UserGroup','`UserGroupMembers`.`user_group` = `UserGroup`.`id`');
@pepebe
pepebe / plugin.createdOnBy.php
Last active May 2, 2022 12:27
Add createdon and createdby to settings tab
<?php
/**
* Sample plugin to add a "createdby and createdon" field on a resource form
* Background: Issue #12305 "Adding createdon/createdby/publishedby/etc. to settings"
* https://github.com/modxcms/revolution/issues/12305
*
* Original author: rtripaul
* Original source: https://gist.github.com/rtripault/7306c8487a39fd1ce0db5f334c99be57
*
* @var modX $modx
<?php
/**
* seoSuiteRecoverLongtitle v:0.0.1
* Last edited: 2022-05-01
*
* AUTHOR:
* info@pepebe.de
*
* PLUGIN EVENT(S):
* OnDocFormRender
@pepebe
pepebe / managerquicknav.plugin.php
Last active May 1, 2022 12:13
ManagerQuickNav v:0.01i (BETA) ManagerQuickNav adds: - buttons with links to the previous or next resource in the current menuindex - a combobox with links the current parent resource and all siblings. - a button to quickly add a new resource with the same parent
<?php
/**
* ManagerQuickNav v:0.0.1j (BETA)
* Last edited: 2014-04-09 14:26
*
* AUTHOR:
* info@pepebe.de
*
* DESCRIPTION:
* This plugin injects js to add new items to 'modx-action-buttons'
@pepebe
pepebe / 01_readme.md
Last active April 23, 2022 14:54
ConfigurePHP recursively searches all directories below its own position for php files. If a directory with at least one php file is found, a symlink to ./php.ini will be created.

Found this script years ago on the 1und1 forum. It was a nice workaround to make sure that the php.ini file would work inside root and all directories below it.

@pepebe
pepebe / 00-datagrid.md
Last active February 3, 2022 20:56
Data Grid Tutorial by Susann Ottwell

Backup of a an article write by Susan Ottwell in February 2008

The original source seems to be lost but there is still a copy a archive.org

Disclaimer: I didn't check the code for potential problems with current versions of MODX. If you find something that breaks the code, post it in the comments below.

@pepebe
pepebe / 01-introduction.md
Last active February 2, 2022 10:27
Collections Editors Complete List

1 Introduction

Collections is a handy tool to display the child resources of a parent inside a configurable grid. Each column can get its own configurable editor so you can edit a resource right from the grid.

image Example for a datatime editor

Editors can be attached by editing the collections column settings:

image