Disable the edit option after 60 days

sales2010

Well-Known Member
Hello,

I need to disable the edit option after 60 days. I have tried the plugin "caneditrow" in list, but i can't make it work:

Code:
$nowdate = strtotime("{aplicatii_churn_icp_detalii___LAST_UPDATE}");
$thendate = strtotime("today");
$datediff = ($thendate - $nowdate);
$diff = round($datediff / 86400);
if ($diff > 60) { 
return false;
}else {
return true;
}

the value for "diff" in this case is 162 days. I don't know what should happen next, the icon for Edit will be hidden?

Thank you
 
Thank you, jfquestiaux, but still doesn't work..well..i don't know what it should happen within the list view, i'm still able to see the edit icon and to edit the information...
 
The edit icon should vanish if the plugin is returning "false".
You can include e.g.
var_dum($diff);exit;
for debugging-
 
I changed from float to string, same problem, the Edit icon still appear:

Code:
$nowdate = strtotime("{aplicatii_churn_icp_detalii___LAST_UPDATE_raw}");
$thendate = strtotime("today");
$datediff = ($thendate - $nowdate);
$diff = round($datediff / 86400);
$diff = number_format($diff,0);
if ($diff >60) {
return false;
}else {
return true;
}
 
Use single quotes for placeholders inside function
$nowdate = strtotime('{aplicatii_churn_icp_detalii___LAST_UPDATE_raw}');
or do
$date = "{aplicatii_churn_icp_detalii___LAST_UPDATE_raw}";
$nowdate = strtotime($date);
 
I don't know what i'm doing wrong here, still can't hide the icon. I used var_dump to display the results for each line:

Code:
$nowdate = strtotime('{aplicatii_churn_icp_detalii___LAST_UPDATE_raw}'); - result: int(1357420415)
$thendate = strtotime("today"); - result: int(1371502800)
$datediff = ($thendate - $nowdate); - result: int(14082385)
$diff = round($datediff / 86400); - result: float(163)
//$diff = number_format($diff,0); -result: string(3) "163"
//$diff = (int)$diff; result: int(163)
if ($diff >60) {
return false;
}else {
return true;
}


also tested with return $diff > 60; ..same result, the icon is still visible
 
If you write just
PHP:
return false;
in the plugin, does it work? If so, there is still something wrong in the code. If not, there is something wrong in the plugin. (I would also tried "return true;" just to be sure).
 
Can you try with an other list to see if it may be some list settings? (just return false; )
I've tried to replicate, but it is working on my site (playing with plugin access, list edit access, or use field....).
What is your exact fabrik version?
 
:( same problem with another list..I use the github version for fabrik (don't know the version, i think i made the last update two weeks ago). I updated the plugin now, but the edit icon is still showing. I will update the files, maybe that will solve the problem.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top