Commit cf4ae317 authored by Joakim Schramm's avatar Joakim Schramm

#255030 added token hooks to provide the blog title, contributed by orbface9

parent 0c698310
......@@ -129,3 +129,32 @@ function bloginfo_save_bloginfo(&$edit, &$user, $category) {
}
}
}
/**
* 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