I have a form that several people are able to use. Each person can edit any of the rows on the list.
To prevent multiple people trying to edit the row at the same time, I've used the lockrow plugin and element (which is brilliant by the way).
When Person 1 edits the row, it successfully locks it.
As expected, Person 2 can click on the edit button and it will allow them to access the form; but they cannot submit the form.
I'd like to hide the edit form button from Person 2 when the row is locked by Person 1. To do this, I've used the caneditrow list plugin with the following code in the Advanced php tab:
From my testing, I think everything works as intended apart from the final if statement:
Can anyone see why this doesn't work?
Thanks in advance for your help
To prevent multiple people trying to edit the row at the same time, I've used the lockrow plugin and element (which is brilliant by the way).
When Person 1 edits the row, it successfully locks it.
As expected, Person 2 can click on the edit button and it will allow them to access the form; but they cannot submit the form.
I'd like to hide the edit form button from Person 2 when the row is locked by Person 1. To do this, I've used the caneditrow list plugin with the following code in the Advanced php tab:
PHP:
$lal = {table___lockrow_raw};
$lockid = explode(';',$lal);
$user = JFactory::getUser();
$myid = {$my->id};
$elapsed = time ( ) - $lockid[0];
//THE NEXT LINE SHOWS THE EDIT BOX IF THE ROW IS NOT LOCKED
if ($lal == 0){
return true;
}
else{
//THE NEXT LINE SHOWS THE EDIT BOX IF THE ROW WAS LOCKED BUT THE TIME DURATION OF THE LOCK HAS ELAPSED (30 minute duration)
if($elapsed > 30*60){
return true;
}
else{
//The NEXT LINE SHOWS THE EDIT BOX IF THE USER IS THE PERSON WHO LOCKED THE ROW
if($lockid[1] == $myid){
return true;
}
else{
return false;
}
}
}
From my testing, I think everything works as intended apart from the final if statement:
PHP:
if($lockid[1] == $myid)
Can anyone see why this doesn't work?
Thanks in advance for your help