joomla user id in condition list of ccv5

How to dynamically filter a CF v5 form list based on the Joomla user ID.

Overview

The issue occurred because the user attempted to retrieve the Joomla user ID incorrectly and tested from the backend where no user is logged in.
Ensure you are logged in as a frontend user and use the correct Joomla API method to fetch the user ID for dynamic filtering in the condition list.

Answered
teldrive teldrive 19 Mar, 2014
I apreciate i someone can help
i need insert a condition in ccv5 form that show only records of table that allow to one user
I did it statically with
<?php
 return array(
   "nif" =>"12",
  "nombre" =>"88"
 );
 ?>

But my purpose is do it dinamically with user id of joomla, but I don't know how can i get it from enviroment of joomla
regards
teldrive teldrive 19 Mar, 2014
Hi Bob , thanks by reply, i am untrained in CCv5,

but I have tried with this in order to debug it

<?php
$user = & JFactory::getUser();
$login=$user->username;

print "-> $login  es el username   ";
print "-> $user   es el array    ";

 /*return array('nif' =>$user->name);*/

 return array('nif' =>"seden");
 ?>

the results are:
no value for $login
$user value = JUser

and list works because "seden· is constant, so can you help me, what am I missing?
teldrive teldrive 20 Mar, 2014
Sorry Bob is working😀
is working, my failure was that I have to register as user to get it works, because from backend there is not registered users
Max_admin Max_admin 22 Mar, 2014
Answer
Hi Teldrive,

You need to use this to get the user's id:
$user->get("id")


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.