Commit bc2d4f83 authored by Joakim Schramm's avatar Joakim Schramm

#255030 added token hooks to provide blog title, thanks to orbface9 for contribution.

parent ee1fd0e5
......@@ -228,3 +228,32 @@ function bloginfo_feed_user($account) {
node_feed($items, $channel);
}
/**
* Token Hooks
* contributed by orbface9 at d.o
*/
function bloginfo_token_values($type, $object = NULL, $options = array()) {
if ($type == 'user') {
$user = $object;
$results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $user->uid);
$bloginfo = db_fetch_object($results);
$tokens['blog-title'] = t($bloginfo->title);
}
else if ($type == 'node') {
$node = $object;
$results = db_query("SELECT title, description, format FROM {bloginfo} WHERE uid = %d", $node->uid);
$bloginfo = db_fetch_object($results);
$tokens['blog-title'] = t($bloginfo->title);
}
return $tokens;
}
function bloginfo_token_list($type = 'all') {
if ($type == 'user' || $type == 'all') {
$tokens['user']['blog-title'] = 'Blog Title from bloginfo module.';
}
if ($type == 'node' || $type == 'all') {
$tokens['node']['blog-title'] = 'Blog Title from bloginfo module.';
}
return $tokens;
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment