Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Need help with getting Contact ID...
Need help with getting Contact ID value for current article author
Need help with getting Contact ID value for current article author
Does any one know how to check the DB to return (echo) value for contact ID linked to author of the article being displayed? Hope this makes sense. I have MetaMod Pro. Thanks in advance for any assistance.
Re: Need help with getting Contact ID value for current article author
To get the author/modifier id:
$author_id = $content_genius->info("article_created_by");
or
$author_id = $content_genius->info("article_modified_by");
The contact id is going to be different to this I guess. But do you need the contact id or is the user id enough? It's probably just a quick database lookup to convert between the two things.
Re: Need help with getting Contact ID value for current article author
It's the contact ID I am looking for. User profile generally doesn't contain much info. But a user can be connected to a contact which is much more versatile including having a profile image and variety of other info. I'd like to take advantage of that if I can figure out how to get a contact ID linked to the current article's author. Hope this makes sense.
Re: Need help with getting Contact ID value for current article author
$author_id = (int)$content_genius->info("article_created_by");
if ($author_id > 0) {
$query = "select id from #_" . "_contact_details where user_id = $author_id";
$db->setQuery($query);
$contact_id = $db->loadResult();
}
Or if you want to get all the other info from the contact record:
$author_id = (int)$content_genius->info("article_created_by");
if ($author_id > 0) {
$query = "select * from #_" . "_contact_details where user_id = $author_id";
$db->setQuery($query);
$row = $db->loadAssoc();
if ($row != null) {
echo $row['name'] . '<br />';
echo $row['address'] . '<br />';
echo $row['suburb'] . '<br />';
echo $row['state'] . '<br />';
echo $row['country'] . '<br />';
echo $row['postcode'] . '<br />';
echo $row['telephone'] . '<br />';
echo $row['mobile'] . '<br />';
}
}
- Index
- » MetaMod Pro
- » MetaMod Pro General Support
- » Need help with getting Contact ID...
Board Info
- Board Stats:
- Total Topics:
- 1689
- Total Polls:
- 6
- Total Posts:
- 5943
- Posts this week:
- 2
- User Info:
- Total Users:
- 7642
- Newest User:
- mary26
- Members Online:
- 0
- Guests Online:
- 119
- Online:
- There are no members online
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked