Forums

How to retrieve data from Multi DB Loader using login info

thehitechpanky 24 Feb, 2012
I want to create a mechanism of user approval for jomsocial.

I tried to use Chronoforms for that. I am stuck at a point, please help.

I want to use Multi DB Loader
but I want the data of only those users to be displayed which are of lower user level than the person logged in
For example if an administrator login, only registered and managers are displayed
but if manager login, only registered are displayed.

In short I want to use somehow the login info in the WHERE Statement...
GreyHead 24 Feb, 2012
Hi thehitechpanky,

I'm not sure how JomSocial handles levels - or if it will work in Joomla! 2.5's level structure either. In Joomla! 1.5 you could do
<?php
$user =& JFactory::getUser();
echo " `gid` < '$user->gid' ";
?>

Bob
thehitechpanky 24 Feb, 2012
Thanks Greyhead
Actually Im not that much into coding, so need a lil help understanding that. Can u please elaborate it step by step
Plus Im using joomla 1.7, is the code compatible with that as well?
I used the given code in customcode in multirecord loader, cudn't get desired result
[attachment=0]chrono.png[/attachment]
Please See the link below
http://saini.smilyo.com/index.php?option=com_chronoforms&chronoform=list_data

Login ID - test
Password - 12345

GreyHead 24 Feb, 2012
Hi thehitechpanky,

I don't' think it will work with Joomla! 1.7 because the User Groups structure has changed. I'm not sure that you can assume that larger Group IDs have larger permissions.

If it did work it would go in the Where Box of the DB Record Loader action.

Bob
thehitechpanky 24 Feb, 2012
Is there an alternative?

Like somehow i extract the usertype of user that login
and put in a command something like
WHERE `usertype`=registered
OR `usertype`=manager


Please correct me in codings, I am new to this coding thing and don't know php
GreyHead 24 Feb, 2012
Hi thehitechpanky,

Possibly but you'll need to understand how to access the groups and work out the group structure :-( Not something that I know much about.

Bob
thehitechpanky 24 Feb, 2012
I don't think we'll need to know about that.
The usertype is stored in a database field 'usertype'
[attachment=0]usertype.png[/attachment]
Just need to get the value of the user who login
and use some code for this result

If usertype=manager, show results with usertype=registered
elseif usertype=administrator, show results with usertype=manager or usertype=registered

thehitechpanky 24 Feb, 2012
I am currently using this code in custom html
I got this from tutorials and tried to customise it
<?php
$user =& JFactory::getUser();
echo " `gid` < '$user->gid' ";
?>
<table>
<tr>
<td>Name</td>
<td>Approved</td>
<td></td>
</tr>
<?php
foreach($form->data['UserDetails'] as $detail):
?>
<tr>
<td><?php echo $detail['name']; ?></td>
<td>No</td>
<td><a href="index.php?option=com_chronoforms&chronoform=user_details&token=<?php echo $detail['id']; ?>">Edit</a></td>
</tr>
<?php
endforeach;
?>
</table>
thehitechpanky 24 Feb, 2012
Thanks for the code, i tried to modify it a lil bit:
I tried a new thing
I assigned username as Manager of a user and used the code
<?php
$user =& JFactory::getUser();
echo " `username` = '$user->usertype' ";
?>


It kind of worked
thehitechpanky 24 Feb, 2012
I thought of advancing it to higher level
Please give me code for that
Now i want to use 2 conditions
1) Usertype=registered

2)
Table=community_field_values
field_id=6
value=

value of the same field for user_id of login user


[attachment=0]userdata.png[/attachment]
This topic is locked and no more replies can be posted.