Welcome to the MetaMod and Chameleon Support Forums.

Before posting, please check out the FAQs.

helpme

 

Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.

 

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.

mirphi
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

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.

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

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.

mirphi
Beginner Modder
ranks
useravatar
Offline
9 Posts
Administrator has disabled public posting

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 />';
  }
}

Stephen Brandon
MetaMod / Chameleon developer
If you use MetaMod or Chameleon, please post a rating and a review at the Joomla! Extensions Directory: Chameleon | MetaMod

metamodguy
useravatar
Offline
3328 Posts
User info in posts
Administrator has disabled public posting

Board Info

Board Stats:
 
Total Topics:
1679
Total Polls:
6
Total Posts:
5933
Posts this week:
3
User Info:
 
Total Users:
4386
Newest User:
verlywl7
Members Online:
1
Guests Online:
523

Online: 
verlywl7

Forum Legend:

 Topic
 New
 Locked
 Sticky
 Active
 New/Active
 New/Locked
 New Sticky
 Locked/Active
 Active/Sticky
 Sticky/Locked
 Sticky/Active/Locked