Skip to content

Instantly share code, notes, and snippets.

Avatar

luk exside

View GitHub Profile
@exside
exside / modx.log.php
Last active Dec 14, 2015 — forked from ideesimple/gist:752778
MODx log
View modx.log.php
$modx->log(modX::LOG_LEVEL_ERROR, "{ } log");
View gist:5072393
<?php
/* ActivateNotify Plugin
by Breezer
http://forums.modx.com/index.php?topic=53213.0%3Bwap2
8/15/2010 7:12 pm est
*/
if ($modx->event->name == 'OnUserActivate') {
// array of emails to send the notification
View MODX.alwaysEnableResourceSave.plugin.php
<?php
if ($modx->event->name == 'OnManagerPageInit') {
$script = <<<SCRIPT
<script type="text/javascript">
Ext.ComponentMgr.onAvailable('modx-panel-resource', function(){
Ext.getCmp('modx-panel-resource').on('ready', function(){
window.setTimeout(function(){Ext.getCmp('modx-panel-resource').markDirty()}, 250);
})
})
</script>
View snippet.php
<?php
$mailto = (isset($mailto)) ? $mailto : '@@ DEFAULT EMAIL HERE @@';
$warningMail = '@@ EMAIL TO SEND WARNING TO IN CASE OF A SMALL BACKUP FILE @@';
include MODX_CORE_PATH.'/config/'.MODX_CONFIG_KEY.'.inc.php';
$host = $database_server; // database host
$dbuser = $database_user; // database user name
$dbpswd = $database_password; // database password
$mysqldb = $dbase; // name of database
View import_users.php
<?php
require_once '/absolute_path/config.core.php';
require_once MODX_CORE_PATH.'model/modx.class.php';
$modx = new modX();
$modx->initialize('web');
$modx->getService('error','error.modError');
//To get Base Path
$basePath = $modx->config['base_path'];
// Prepare the data
View prehook.profile.php
<?php
if (!$modx->user->hasSessionContext($modx->context->get('key')) return '';
$userArray = $modx->user->toArray();
$profile = $modx->user->getOne('Profile');
if ($profile) {
$userArray = array_merge($profile->toArray(),$userArray);
$extended = $profile->get('extended');
if (!empty($extended) && is_array($extended)) {
View FormIt2AddUser.php
<?php
$debug = $modx->getOption('debug', $scriptProperties, false);
if ($debug) {
$modx->setLogLevel(modX::LOG_LEVEL_DEBUG);
}
//new user object
$user = $modx->newObject('modUser');
//get all form fields
$formFields = $hook->getValues();
View gist:5073204
<?php
$docArray = $modx->getCollection('modResource');
foreach($docArray as $doc) {
$doc->joinGroup('GroupName');
}
View modx-snippets.php
Snippet: [[SnippetName]]
Chunk: [[$ChunkName]]
System Setting: [[++SettingName]]
TV: [[*fieldName/TvName]]
Link tag: [[~PageId? &paramName=`value`]]
Placeholder: [[+PlaceholderName]]
<?php
View rssGrabber.snippet.php
<?php
if ($debug) {
$modx->setLogLevel(modx::LOG_LEVEL_DEBUG);
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tstart = $mtime;
}
You can’t perform that action at this time.