Skip to content

Instantly share code, notes, and snippets.

View boboldehampsink's full-sized avatar

Bob Olde Hampsink boboldehampsink

View GitHub Profile
@boboldehampsink
boboldehampsink / gist:7039352
Created October 18, 2013 10:04
parentOf error
{% if not user %}
{% redirect "profiel" %}
{% endif %}
{% extends "_layout" %}
{% set title = "Gekoppelde familieleden" %}
{% set entry = craft.entries.section('registratie').authorId(currentUser.id).first() %}
{% if entry | length == 0 %}
{% set entry = craft.entries.section('registratie').first() %}
{% endif %}
@boboldehampsink
boboldehampsink / AssetUploadPlugin.php
Last active December 26, 2015 20:49
Enable this plugin to connect <input type="file" name="fields[yourField]" /> as asset to yourField
<?php
namespace Craft;
class AssetUploadPlugin extends BasePlugin
{
function getName()
{
return Craft::t('Upload assets on the front-end');
}
@boboldehampsink
boboldehampsink / SaveProfilePlugin.php
Created November 6, 2013 12:13
Save profile and user data simultaneously
<?php
namespace Craft;
class SaveProfilePlugin extends BasePlugin
{
function getName()
{
return Craft::t('Save profile too when saving user');
}
@boboldehampsink
boboldehampsink / UserPhotoPlugin.php
Created November 6, 2013 13:00
Upload user photos in the front-end. Use <input type="file" name="qqfile" /> to trigger Craft's native upload mechanism.
<?php
namespace Craft;
class UserPhotoPlugin extends BasePlugin
{
function getName()
{
return Craft::t('Upload user photos on the front-end');
}
@boboldehampsink
boboldehampsink / AutoActivatePlugin.php
Created November 7, 2013 10:21
Enable this to automatically activate new registrations in the CP
<?php
namespace Craft;
class AutoActivatePlugin extends BasePlugin
{
function getName()
{
return Craft::t('Auto activate from CP');
}
@boboldehampsink
boboldehampsink / SlugifyPlugin.php
Last active May 16, 2016 12:56
Slugify Twig Extension - Use like this: {{ user.fullName | slugify }}. Uses Craft's core slug technology.
<?php
namespace Craft;
class SlugifyPlugin extends BasePlugin
{
public function getName()
{
return Craft::t('Slugify Twig Extension');
}
<?php
return array(
"Analytics" => "Analytics",
"Plugin installed" => "Plugin geïnstalleerd",
"Couldn't install plugin." => "Kon plugin niet installeren",
"Analytics Settings" => "Analytics instellingen",
"Configure Analytics plugin in order to get started" => "Stel de Analytics plugin in om te beginnen",
"More Data" => "Meer gegevens",
"Less" => "Minder",
@boboldehampsink
boboldehampsink / YourPlugin.php
Created June 8, 2014 10:43
registerImportOperation example
// Register special hook for Markdown processing
function registerImportOperation(&$data, $handle) {
// Get field info
$field = craft()->fields->getFieldByHandle($handle);
// If it's a field ofcourse
if(!is_null($field)) {
// For some fieldtypes the're special rules
@boboldehampsink
boboldehampsink / SampleVariable.php
Last active August 29, 2015 14:13
New Entry model with field layout in Craft
<?php
namespace Craft;
class SampleVariable
{
public function newUserModel()
{
// Create a new empty user model
@boboldehampsink
boboldehampsink / 0_reuse_code.js
Last active August 29, 2015 14:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console