Dinamic condition based on user->id from Joomla

More
10 years 4 months ago #1032 by ANTONIO RUEDA
Hello,

Is there any option to include a 'extra condition' related to sql query, based on user->id from Joomla.

I want to show information from a table filtering by the id joomla user

Thanks in advance,

Please Log in to join the conversation.

More
10 years 4 months ago #1033 by Daniel
Hello Antonio,

Yes it has the feature to include dynamic variables in your SQL query including logged-in User ID :)

Hope I could precisely reply to your question.

Thanks
Daniel

Please Log in to join the conversation.

More
10 years 4 months ago #1034 by ANTONIO RUEDA
Hello Danish,

Could you send me an example.

Is this condition right?

User = <?php return JFactory::getUser()->id; ?>

Thanks

Please Log in to join the conversation.

More
10 years 4 months ago #1035 by Daniel
Hello Antonio,

Here is the example:
userid = {loggedinuserid}

There is an option in back end to write your custom query, you can include the above condition in that query.

userid is column name, you need to change it as per the column name in your database table.
{loggedinuserid} is the keyword which will be replaced automatically with logged in User ID.

Thanks
Daniel

Please Log in to join the conversation.

More
10 years 4 months ago #1036 by ANTONIO RUEDA
Hello Danish,

I need additional information. I have created a graphic using the sentence
SELECT Mes, Dato1, DatoGrupo FROM Int_Prueba;
and I get a graphic

When I tried to add the where condtion
SELECT Mes, Dato1, DatoGrupo FROM Int_Prueba WHERE AGENTE='{loggedinuserid}'
I have some error messages
1. Horizontal Value get a empty value and a error message: 'Invalid field: Horizontal Value()'
2. I put the same data serie that the first sentence without where clause, and in this case i can save the graphic, but when I do preview I get the error message: 'Data Column/s for axis#0 cannot be of type string

Please, do you have any documentation with examples about using parameters in sql sentence.

On the anohter hand, do you have any list of joomla parameters that we can use in sql sentence.

Thanks in advance,

Please Log in to join the conversation.

  • Zaheer Abbas
  • Visitor
  • Visitor
10 years 4 months ago #1037 by Zaheer Abbas
Replied by Zaheer Abbas on topic Dinamic condition based on user->id from Joomla
Hi ANTONIO RUEDA,

Thanks for contact us.Can you please send us your back end login credentials via Contact Us form. We'll look into the issue.

thanks
zaheer

Please Log in to join the conversation.

Cron Job Starts