function ed_classified_link in Classified Ads 6.2
Same name and namespace in other branches
- 5.2 ed_classified.module \ed_classified_link()
- 5 ed_classified.module \ed_classified_link()
- 7.2 ed_classified.module \ed_classified_link()
Implements hook_link().
File
- ./
ed_classified.module, line 294 - Simple text-based classified ads module.
Code
function ed_classified_link($type, $node = NULL, $teaser = FALSE) {
module_load_include('inc', 'ed_classified', 'ed_classified_utils');
$links = array();
global $user;
if ($type == 'node' && _ed_classified_node_is_classified($node)) {
if (user_access('access user profiles') && _ed_classified_variable_get('show_contact_form_link_on_posts', TRUE) && _ed_classified_module_exists('contact')) {
$ad_author = user_load(array(
'uid' => $node->uid,
));
if ($ad_author && $user->uid != $ad_author->uid && $ad_author->uid != 0) {
$links['ed_classified_contact'] = array(
'title' => t('View the advertiser\'s (@advertiser) profile.', array(
'@advertiser' => $ad_author->name,
)),
'href' => 'user/' . $ad_author->uid,
'html' => TRUE,
);
}
}
// Show contact link
if (0 != $user->uid && module_exists('contact')) {
// only if logged in and there's a sitewide contact form
$links['ed_classified_suggest_new_category'] = array(
'title' => t('Suggest a new category'),
'href' => 'contact',
'attributes' => array(
'title' => t('Click here to suggest a new classified ad category'),
),
);
}
}
return $links;
}