Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

stupid me: lost changes from r98 in r839. add tokens for og node type…

… name

git-svn-id: file:///home/frans/tmp/svn-to-git/nabuur-svn/trunk@840 735dea64-16db-426a-a501-683fc2a7293f
  • Loading branch information...
commit 51b18900d76f614dc33368c18e3761b873b71460 1 parent e2962c8
frans authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 sites/all/modules/og/og.module
View
15 sites/all/modules/og/og.module
@@ -2905,7 +2905,9 @@ function og_token_list($type = 'all') {
if ($type == 'node' || $type == 'all') {
$tokens['node']['ogname'] = t("Title of top group");
$tokens['node']['ogname-raw'] = t("Unfiltered title of top group. WARNING - raw user input.");
- $tokens['node']['og-id'] = t("ID of top group");
+ $tokens['node']['og-id'] = t("ID of top group");
+ $tokens['node']['og-type'] = t("Node type of the top group");
+ $tokens['node']['og-type-name'] = t("Node type (user-friendly version) of the top group");
return $tokens;
}
}
@@ -2919,10 +2921,13 @@ function og_token_values($type, $object = NULL) {
if (is_array($object->og_groups)) {
$gids = array_filter($object->og_groups);
foreach ($gids as $gid) {
- $title = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $gid));
- $values['ogname'] = check_plain($title);
- $values['ogname-raw'] = $title;
+ $query = db_query("SELECT n.title as title, n.type as type, t.name as name FROM {node} n INNER JOIN {node_type} t on n.type = t.type WHERE nid = %d", $gid);
+ $group = db_fetch_object($query);
+ $values['ogname'] = check_plain($group->title);
+ $values['ogname-raw'] = $group->title;
$values['og-id'] = $gid;
+ $values['og-type'] = $group->type;
+ $values['og-type-name'] = check_plain($group->name);
break;
}
return $values;
@@ -2934,6 +2939,8 @@ function og_token_values($type, $object = NULL) {
$values['ogname'] = '';
$values['ogname-raw'] = '';
$values['og-id'] = '';
+ $values['og-type-name'] = '';
+ $values['og-type'] = '';
return $values;
}
Please sign in to comment.
Something went wrong with that request. Please try again.