record already exists

ritu 10 Jun, 2008
CF component seems to work well, but because i want all form submissions stored in a database (which CF does), iwe want to have considered whether the user completing the form already exists as a registered user of the site.

How can i implement this?
GreyHead 10 Jun, 2008
Hi ritu,

If the user isn't logged in then you can't tell! If they are then you can use the $user object and check their id - if it is zero they are a guest, othersie they are a registered member.

In Joomla 1.0.x the code is something like:
<?php
global $my;
if ( $my->id == 0 ) {
  // user is a guest
} else {
  // user is a member
}
?>
you can replace the comments with some more useful code - maybe to set the value of a hidden input.

Bob

Bob
This topic is locked and no more replies can be posted.