HOw to filter the data by on the user login session..

WAN_GHOST 28 Mar, 2012
Here in the view data form....i would like to display the data information based on the login session user....The problem of my view form, it display all the data from database tables without any filtering by user login session?

May someone help me how to solve this problem...my head became very headache..😟 😶 😟
GreyHead 28 Mar, 2012
Hi WAN_GHOST ,

Which version of ChronoConnectivity are you using?

You can filter your results using the WHERE box, to filter by user you'll probably need the User ID which you can get with
<?php
$user =& JFactory::getUser();
$user_id = $user->id;
?>


Bob
WAN_GHOST 29 Mar, 2012
I'm not sure about the version..maybe ChronoConnectivity V2 RC3..i write many 'where statement' but it all fail to specifix the data user login...i will try the the code u give one... :wink:
WAN_GHOST 29 Mar, 2012
Hurm i already use that code GreyHead but it keep display same things...

Actually i want display some policy information when the user login into our websites. I already create a tables name 'data' that have some information of the policy. What the exactly primary keys i should create to link the data filter as user login. Right know i create 'id' as the primary keys for that 'data' tables.

Because right now, the data is display all the user policy information without filter by the user login eventhough i already use your 'where' statement.
GreyHead 29 Mar, 2012
Hi WAN_GHOST ,

The primary keys aren't very important here. You need to write a valid MySQL 'where' clause that filters the data in the way that you need it. You can use the User id as a filter provided that you have user ids in a column in your table.

Bob
Invidia 22 Apr, 2012
I made this work with following code:

If you want to filter by username, change COLUMN NAME to the name of your column.

<?php
$user =& JFactory::getUser();
echo "`COLUMN NAME` = '{$user->username}'";
?>


If you want to filter by user id, change COLUMN NAME to the name of your column.

<?php
$user =& JFactory::getUser();
echo "`COLUMN NAME` = '{$user->id}'";
?>


You also can use name instead of username and id.
lovemeplease 27 Apr, 2012
Hi,

I also wish to filter out those who login can just view their own data, I tried the all the following codes in the WHERE clause still din't get it work, any other suggestions ??
Max_admin 27 Apr, 2012
Please show us your code.
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lovemeplease 29 Apr, 2012
Hi admin,

I'm not really sure what to put in the WHERE but I used the example codes above:
<?php
$user =& JFactory::getUser();
echo "username = '{$user->username}'";
?>


I did not use user_id, since my table have the username column which is the same with the Joomla! login 'username', do I have to link with the session or something else in the WHERE box?

**If I want to join another table, which the columns are similar with the previous table into the connection, what should I do in the join option ?
(because of some personal issues that the tables are done separated.)
This topic is locked and no more replies can be posted.