Skip to content

Instantly share code, notes, and snippets.

@sproutventure
sproutventure / gist:796249
Created January 26, 2011 04:58
latest deal redirect.
function new_latest_deal_redirect( $redirect = null ) {
$latest_deal_qv = get_query_var( 'todays-deal' );
$latest_deal = ( $latest_deal_qv != '' ) ? $latest_deal_qv : $_GET['todays-deal'] ;
// redirect from homepage if cookie is set or we are using the todays-deal link
if( 1 == $latest_deal || ( is_home() && isset( $_COOKIE[ 'your-selected-location' ] ) ) ) {
$redirect = get_gbs_latest_deal_link();
} elseif ( is_home() && is_user_logged_in() ) { // redirect for logged in users
$redirect = get_gbs_deals_link();
}
if ( $redirect != null ) { // if we have something to redirect to let's do it.
@sproutventure
sproutventure / Example filter for GBS Messages
Created January 4, 2011 21:10
Filter the GBS messages, find a match and change it.
add_filter('additional_messages', 'translate_mail_errors', 1);
function translate_mail_errors($message)
{
$message = str_ireplace( 'Purchase Successful. Now we wait for the deal to end.', 'CHANGE TO WHATEVER', $message );
return $message;
}
<td class="spent-time"><%= @issue.spent_hours > 0 ? (link_to l_hours(@issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}) : "-" %></td>
<img class="size-medium wp-image-2927 alignleft" title="Bloomington-City-Hall" src="http://wjbc.com/files/2010/12/Bloomington-City-Hall1-300x207.jpg" alt="Bloomington City Hall" width="307" height="218" />
<div><strong>A new tavern will be coming to downtown Bloomington. But council leaders say this comes with much needed action, instead of just conversation. <!--more-->The city council approved a liquor license for an establishment called Eleven with a close 5-to-4 vote including the mayor. Alderwoman Karen Schmidt says the way licenses are distributed is inconsistent.</strong></div>
<strong>"I'm very concerned we have this conversation over and over again. We just need to get on the same page," said Schmidt.</strong>
<strong>Tyler Holloway of the Downtown Bar Owners Association says he supports the business plan, but questioned the safety of adding another bar to the area.</strong>
<strong>"I know of 12 bars right now running dollar specials. When you have cheap drinks like that, you have a lot of intoxic
<div class="mceTemp"><dl id="attachment_798" class="wp-caption alignleft" style="width: 310px;"> <dt class="wp-caption-dt"><img class="size-medium wp-image-798" title="elizabeth edwards" src="http://theriver1079.production.townsquaresites.com/files/2010/12/elizabeth-edwards-300x200.jpg" alt="elizabeth edwards" width="300" height="200" /></dt> <dd class="wp-caption-dd">Getty Images</dd> </dl>Her private life was out for the whole world to see, hear, and read about. Through Elizabeth Edwards ordeal, she held on to the ideals that faith, family, and marriage are based upon.
</div>
<blockquote>
<div class="mceTemp">"Today we have lost the comfort of Elizabeth's presence but, she remains the heart of this family, the family said in a statement. "We love her and will never know anyone more inspiring or full of life. On behalf of Elizabeth we want to express our gratitude to the thousands of kindred spirits who moved and inspired her along the way. Your support and prayers touched our entire family."</div>
<div cla
/*********** General ***********/
$this->registerColorChooser( array(
'id' => 'body_color',
'selector' => 'body, .body_color',
'name' => __('Body Text Color'),
'foreground' => true,
'default' => '000000',
'group' => __('General'),
// Remove the old filters
global $gbac;
remove_filter('gbs_message_share_max', array( $gbac, 'gbs_message_share_max_new' ) );
remove_filter('gbs_message_share', array( $gbac, 'gbs_message_share_new' ) );
// Create new filters
add_filter('gbs_message_share_max', 'gbs_message_share_max_custom' );
add_filter('gbs_message_share', 'gbs_message_share_custom' );
// Message when a max is used
@sproutventure
sproutventure / Override GBS subscription
Created November 16, 2010 18:03
remove original action and create a new one.
function group_buying_subscription_new()
{
if( isset( $_POST['set-group-buying-subscription'] ) && !isset( $_POST['email_address'] ) ) {
setcookie( 'your-selected-location', $_POST['deal_location'], time( ) + 24 * 60 * 60 * 30, '/' );
wp_redirect( site_url() );
exit();
}
elseif( isset( $_POST['set-group-buying-subscription'] ) ) {
/*********** General ***********/
$this->registerColorChooser( array(
'id' => 'body_color',
'selector' => 'body, .body_color',
'name' => __('Body Text Color'),
'foreground' => true,
'default' => '000000',
array(
'inner_bg' => array(
'div.BorderOption-One',
'div.Container-Footer'
),
'content_bg' => array(
'#GetPointsRSS',
'#UsePointsRSS',
'.tInformation',
'#CenterCol',