Skip to content

Instantly share code, notes, and snippets.

View 1stevengrant's full-sized avatar
🏠
Working from home

Steven Grant 1stevengrant

🏠
Working from home
View GitHub Profile
#!/bin/bash
# File: exp_permissions.sh
# Description: Sets permssions on a ExpressionEngine 2 install
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
{day1_workshop_selection}
{if "{embed:workshopTime}" == "{day1_workshop_selection_time}"}
{!-- so this sql is looking to see who has registered for day 1 workshops and gives us a variable of {workshop_count} --}
{exp:query sql="SELECT count(cd.entry_id) AS workshop_count
FROM exp_channel_data cd INNER JOIN exp_channel_titles ct ON cd.entry_id=ct.entry_id WHERE cd.channel_id = '8' AND cd.field_id_126 LIKE '%{embed:workshopTime}%%{day1_workshop_selection_title}%' AND cd.field_id_131 = '{structure:page:uri}' AND ct.status = 'open'"}
<select name="item_options[r_day_1_11_selection]" id="day1_11_selection" multiple="multiple" size="20">
{exp:query sql="SELECT DISTINCT col_id_43 AS workshop_time FROM exp_matrix_data WHERE {embed:row}"}
<optgroup label="{workshop_time}">
{embed="templates/template_1_embed_11_2_day1" workshopTime="{workshop_time}"}
</optgroup>
{/exp:query}
</select>
<?php
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=registrants.csv");
header("Pragma: no-cache");
header("Expires: 0");
?>
{exp:query sql="select * from exp_channel_data cd INNER JOIN exp_channel_titles ct ON cd.entry_id=ct.entry_id WHERE cd.channel_id = '8' AND cd.field_id_138 LIKE '%{segment_3}'"}
Count, Status, Date, Event Name, Title, First Name, Surname, Position, Job Title, Organisation, Company, Address 1, Address 2, Town, Postcode, County, Country, Telephone, Extension, Fax, Email, Website, Gender, Committee Member, Stay Event Duration, Stay Details, Attending Breakfast, Attending Lunch, Special Requirements, Special Access Requirements, Special Dietary Requirements, Other Invites, Travel Assistance Needed, Other Info, Contact Required, Evaluation Participation, Further Communication, Company Profile, Goods & Services, Market Visit Locations, Mission Objectives, Market Representation, Workshop Selection - Day 1, Workshop Selection
@1stevengrant
1stevengrant / config.php
Created October 28, 2012 17:21
Fixes the daylight savings issue with EE
var $dateTime = new DateTime();
$dateTime->setTimezone(new DateTimeZone('America/New_york'));
$dateTime->setTimestamp(time());
$isDst = (bool)$dateTime->format('I') ? "y" : "n";
$conf['daylight_savings'] = $isDst;
@1stevengrant
1stevengrant / .htaccess
Created November 19, 2012 02:17
This htaccess file redirects users who don't have the designated IP address to another url. I needed this because the we didn't want the clients new url to be accessed by anyone else in production until the official go live. You can allow access for multi
RewriteEngine on
# If your IP address matches any of these - then dont re-write
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteRule ^(.*)$ http://www.anothersite.com/ [R=302,L]
# do not rewrite links to the assets and theme files
RewriteCond $1 !^(assets|themes|images)
@1stevengrant
1stevengrant / virtualhost.sh
Created December 28, 2012 01:39
creates a virtual host in Ubuntu
#!/bin/bash
### Checking for user
if [ "$(whoami)" != 'root' ]; then
echo "You have no permission to run $0 as non-root user. Use sudo !!!"
exit 1;
fi
### Configure email and vhost dir
email='steven@ghijk.co.uk' # email address of administrator
{exp:low_variables:single
var='lv_html_head'
preparse:body_id='home'
preparse:page_title='Home'
}
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Simple, single configuration file to override almost all paths and server settings. As used by @airways
// and @litzinger.
// Only check in the default as dist.config.php, set your version control system to ignore config.php so that
// local users and each instance (staging, production) can have their own settings.
// These config files are mainly meant to be used on a shared development server used by all developers,
// although it works almost as well for local development as well.
@1stevengrant
1stevengrant / gist:5057090
Created February 28, 2013 14:24
jQuery validation on a form that has multiple tabs (a long form effectively) and spitting out the error messaging on the last tab before it's submitted
$("#application-submit").click(function() {
$("#application-form").validate({
focusInvalid: false,
ignore: "",
rules: {
student_lastname: "required",
student_firstname: "required",
student_nationality: "required",
student_gender: "required",
student_dob: "required",