===========
A simple question for a PHP/MySQL expert!
I am using a third party newsletter module/plugin for Site Registration, The plugin integrates the User registration to the Joomla! User registration table as well. Thus some of the User information such as the UserID, email etc will be stored in the Joomla! User table, and the rest of the information such as their address, lastname, firstname, phone number etc will be stored in the table that belong to the Mail plugin.
Can someone help me retrieve the additional information saved in the third party tables for the UserID of the Visitor who is logged in to site?
I have tried the following code. Everything upto the echo command for the Language works, because I am getting that information from the Joomla! Users table.
Code: Select all
$db = JFactory::getDbo();
$user = JFactory::getUser();
$language = $user->getParam('language', 'the default');
echo "<p>Your name is {$user->name}, your email is {$user->email}, and your username is {$user->username}, and your userID is {$user->id}</p>";
echo "<p>Your language is set to {$language}.</p>";
- 1. retrieve the submission id from the "#__thirdpartysubmissions" table for the logged in user
2. then retrieve that User's information (lastname, firstname, phonenumber) from the "#__thirdparty_submission_values" table based on the submission id from step 1.
Code: Select all
$db = JFactory::getDbo();
$db->setQuery("SELECT `column_name` FROM `#__table_name` WHERE `column_name`='value' LIMIT 1");
return $db->loadResult();
By the way, do I always need the #__ infront of the table name, when I am using them in a query string?
Thank you.