DrupalBin
Submit Code
About
Recent Posts
message i get when running openssl s_client -connect 150.203.86.21:443
Fix for Code
Code
add_to_cart_by_sku_contents()
Fix for page.tpl.php
Page.tpl
foreach is beeing disregarded dispite variable is array. Please help. Outside Drupal it works as standalone.php file
foreach is beeing disregarded dispite variable is array inside drupal. Please help. Outside Drupal it works as standalone.php
Fix for filefield implementation in an admin page. "An HTTP error 0 occurred. /drupal/?q=filefield/ahah///"
PHP Code custom.module
more
User login
Log in using OpenID:
What is OpenID?
Username:
*
Password:
*
Log in using OpenID
Cancel OpenID login
Create new account
Request new password
Tags
CCK
drupal
fapi
jquery
menu
module
php
simpletest
taxonomy
test
theme
views
more tags
Home
Fix for Triggerblock module which may be nice to create?
View
Fix
January 20, 2008 - 9:12pm — Anonymous
<?php
/**
Triggerblock allows you to trigger when the triggerblock is shown.
It also adds a new action which will publish old posts that are both sticky and promoted.
The sticky bit will be set to 0;
This allows you to get a node published after the authoring date only by
setting it promoted, unpublished and sticky.
*/
function
triggerblock_perm
(
)
{
return
array
(
'access'
)
;
}
function
triggerblock_block
(
$op
=
'list'
,
$delta
=0
)
{
if
(
$op
==
'list'
)
{
$block
[
0
]
[
'info'
]
=
t
(
'Allows you to trigger when the block is shown'
)
;
return
$block
;
}
else
if
(
$op
==
'view'
)
{
module_invoke_all
(
'triggerblock'
,
$op
)
;
return
array
(
'subject'
=
>
''
,
'content'
=
>
'<!-- trigger block -->'
)
;
}
}
/**
* Implementation of hook_hook_info().
*/
function
triggerblock_hook_info
(
)
{
return
array
(
'triggerblock'
=
>
array
(
'triggerblock'
=
>
array
(
'view'
=
>
array
(
'runs when'
=
>
t
(
'The triggerblock is viewed.'
)
,
)
,
)
,
)
,
)
;
}
/**
* Implementation of hook_action_info().
*/
function
triggerblock_action_info
(
)
{
return
array
(
'triggerblock_publish_old_promoted_sticky_unpublised_clean_action'
=
>
array
(
'description'
=
>
t
(
'Publish any node that is sticky, promoted and unpublished and unstick it.'
)
,
'type'
=
>
'system'
,
'configurable'
=
>
FALSE
,
'hooks'
=
>
array
(
'any'
=
>
TRUE
,
)
,
)
,
)
;
}
/**
* Implementation of a Drupal action.
* Blocks the current user.
*/
function
triggerblock_publish_old_promoted_sticky_unpublised_clean_action
(
&
$object
,
$context
=
array
(
)
)
{
db_query
(
'UPDATE {node} SET sticky=0, status=1 WHERE sticky = 1 AND status = 0 AND promote = 1 AND created <= UNIX_TIMESTAMP()'
)
;
}
hack
module
proposal
Submit Fix
Summary:
Tags:
Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Show summary in full view
<?php /** Triggerblock allows you to trigger when the triggerblock is shown. It also adds a new action which will publish old posts that are both sticky and promoted. The sticky bit will be set to 0; This allows you to get a node published after the authoring date only by setting it promoted, unpublished and sticky. */ function triggerblock_perm() { return array('access'); } function triggerblock_block($op='list', $delta=0) { if ($op == 'list') { $block[0]['info'] = t('Allows you to trigger when the block is shown'); return $block; } else if ($op == 'view') { module_invoke_all('triggerblock', $op); return array('subject' => '', 'content' => '<!-- trigger block -->'); } } /** * Implementation of hook_hook_info(). */ function triggerblock_hook_info() { return array( 'triggerblock' => array( 'triggerblock' => array( 'view' => array( 'runs when' => t('The triggerblock is viewed.'), ), ), ), ); } /** * Implementation of hook_action_info(). */ function triggerblock_action_info() { return array( 'triggerblock_publish_old_promoted_sticky_unpublised_clean_action' => array( 'description' => t('Publish any node that is sticky, promoted and unpublished and unstick it.'), 'type' => 'system', 'configurable' => FALSE, 'hooks' => array( 'any' => TRUE, ), ), ); } /** * Implementation of a Drupal action. * Blocks the current user. */ function triggerblock_publish_old_promoted_sticky_unpublised_clean_action(&$object, $context = array()) { db_query('UPDATE {node} SET sticky=0, status=1 WHERE sticky = 1 AND status = 0 AND promote = 1 AND created <= UNIX_TIMESTAMP()'); }
Syntax highlighting mode:
ActionScript
ColdFusion
Diff
Drupal 5
Drupal 6
HTML
INI
Javascript
MySQL
PHP
Python
robots.txt
SQL
Text
Select the syntax highlighting mode to use.
See Also:
Order
Title:
URL:
-1
0
1
Title:
URL:
-1
0
1
Any links you'd like to have associated with the post (Drupal.org issue, Wikipedia article, etc).
File attachments
Changes made to the attachments are not permanent until you save this post. The first "listed" file will be included in RSS feeds.
Attach new file:
The maximum upload size is
1 MB
. Only files with the following extensions may be uploaded:
jpg jpeg gif png txt doc xls pdf ppt pps odt ods odp phps
.