function subscriptions_blog_ui_page_blog in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions_blog_ui.module \subscriptions_blog_ui_page_blog()
- 7 subscriptions_blog_ui.module \subscriptions_blog_ui_page_blog()
- 2.0.x subscriptions_blog_ui/subscriptions_blog_ui.module \subscriptions_blog_ui_page_blog()
Returns a list of blog subscriptions.
1 string reference to 'subscriptions_blog_ui_page_blog'
- _subscriptions_blog_ui_types in ./
subscriptions_blog_ui.module - Implementation of hook_types(), subhook of hook_subscriptions().
File
- ./
subscriptions_blog_ui.module, line 53 - Provide a Subscriptions UI for the blog content type subscriptions
Code
function subscriptions_blog_ui_page_blog($account, $form) {
$blogs = array();
// get the blogs
$sql = db_rewrite_sql("\n SELECT u.uid, u.name\n FROM {node} n\n INNER JOIN {users} u ON n.uid = u.uid\n WHERE n.type = 'blog' AND n.status = 1\n GROUP BY u.uid, u.name\n ORDER BY u.name");
$result = db_query($sql);
while ($usr = db_fetch_array($result)) {
$blogs[$usr['uid']] = array(
'uid' => $usr['uid'],
'name' => $usr['name'],
'has_blog' => TRUE,
);
}
// possibly additional blog subscription entries (no blog nodes)
if (isset($account)) {
$result = db_query("\n SELECT s.author_uid, u.name\n FROM {subscriptions} s\n INNER JOIN {users} u ON s.author_uid = u.uid\n WHERE s.module = 'node' AND s.field = 'type' AND s.value = 'blog' AND s.recipient_uid = %d\n ORDER BY u.name", $account->uid);
while ($usr = db_fetch_array($result)) {
$blogs[$usr['author_uid']]['uid'] = $usr['author_uid'];
$blogs[$usr['author_uid']]['name'] = $usr['name'];
}
}
if (!empty($blogs)) {
return drupal_get_form('subscriptions_blog_ui_blog_form', $blogs, $account, $form);
}
else {
return t('There are no active blogs.');
}
}