Skip to content

Instantly share code, notes, and snippets.

@pifantastic
Created April 20, 2011 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pifantastic/932870 to your computer and use it in GitHub Desktop.
Save pifantastic/932870 to your computer and use it in GitHub Desktop.
<?php
/**
* Implementation of hook_block().
*/
function ec_channel_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
return array(
'products_and_events' => array(
'info' => t('Products & events'),
),
'ec_channel_featured_comments' => array(
'info' => t('Channels featured comments'),
)
);
break;
case 'view':
$block = array();
if ($delta == 'products_and_events') {
// Make sure this block shows on all pages BUT the homepage. Also,
// the block is supposed to appear on /user only when the user is logged in.
// If the user is logged out, then /user is basically the login page and we don't want
// this block on that page.
$node = menu_get_object();
<<<<<<< TREE
if (arg(0) != 'user' && arg(0) != 'search' && (empty($node) || $node->type != 'homepage')) {
=======
// Straight merge
if ((arg(0) == 'user' && user_is_logged_in()) && arg(0) != 'search' || (empty($node) || $node->type != 'homepage')) {
// What Aaron thinks it should be
if ((arg(0) == 'user' && user_is_logged_in()) && arg(0) != 'search' && (empty($node) || $node->type != 'homepage')) 'homepage')) {
>>>>>>> MERGE-SOURCE
$block['subject'] = t('Products & events');
// The content of this block is replaced by a template file. The file
// is in the theme folder and is called block-ec_channel-products_and_events.tpl.php
$block['content'] = t('Products & events');
}
}
elseif ($delta == 'ec_channel_featured_comments') {
$block['content'] = _ec_channel_get_featured_comments();
}
return $block;
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment