There is a very good feature in Joomla 3.3 that allows adding notes for each user.

In part of the admin area we can select a user and add a note for him/her.
When a user is logged in in the front end, I'd like them to be able to see this text. I googled and I can not find anything about this.
Is there any way to do this?


Try this code -

if ($user->id) {
    $db =JFactory::getDBO();
    $query = $db->getQuery(true);
    ->where('user_id = '. (int)$user->id)
    $rows = $db->loadObjectList();

I hope it will help you :)


I suppose the only two columns of importance to your users will be subject and body. After requiring your users to be logged in, you can craft your query to exclude notes assigned to other users and unpublished notes. I'll demonstrate how to build your SELECT clause so that displaying a simple html table is a breeze with implode().

$user = JFactory::getUser();
if (!$user->guest) {
    $db =JFactory::getDBO();
    $query = $db->getQuery(true)
        ->select($db->qn(["subject", "body"], ["Topic", "Note"]))
            $db->qn("user_id) . " = " . (int)$user->id,  // target the logged in user
            $db->qn("state") . " = 1"                     // ensure that only published notes are shown
    if ($results = $db->loadAssocList())
        echo "<table>";
            // display Topic and Note as column headings
            echo "<tr><th>" , implode("</th><th>", array_keys($results[0])) , "</th></tr>";
            // display rows of data
            foreach ($results as $row)
                echo "<tr><td>" , implode("</td><td>", $row) , "</td></tr>";
        echo "</table>";
        echo "No Notes";

Output will be like:

|    Topic    |    Note                                          |
|  Feedback1  |  I loved the way you did my laundry.             |
|  Feedback2  |  Perhaps I can interest you in my dry cleaning.  |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.