I have done hide edit with certain query conditions … it is already running but when the user accesses the edit page with the url it can still be done.
where should I add logic … when I add logic to page_load edit page , with a query where echo “not for access” only runs then the edit page can still be accessed. is there any sample code to solve this problem? thx
This can be resolved so easily by using “Row_Selected” server event, for example, only admin can access the Edit page:
if (CurrentPageID()==“edit” && !IsAdmin()) { // adjust the criteria based on your needs
$this->setFailureMessage(“Sorry folk, you do not have permission to access the Edit page.”); // display the message
$this->terminate(“home.php”); // redirect users to home.php
}
thanks. how to make certain menus. for example I have a promo menu … so only the promo menu cannot be edited apart from the admin …
how to get the menu? thanks
newbiephp wrote:
so only the promo menu cannot be edited apart from the admin …
how to get the menu?
Please explain it in more detail. A real example would be very helpful, so others are able to help you straightforward.
$myField = ExecuteScalar(“SELECT status FROM katalog WHERE status != ‘open’”);
if (CurrentPageID()==“edit” && $myField) { // adjust the criteria based on your needs
$this->setFailureMessage(“Maaf Tidak Bisa Mengedit Row Ini.”); // display the message
$this->terminate(“kataloglist.php”); // redirect users to home.php
}
this code…
and
my goal is that status other than open can be edited. thanks
Change this code:
if (CurrentPageID()==“edit” && $myField) { // adjust the criteria based on your needs
to:
if (CurrentPageID()==“edit” && !empty($myField)) { // adjust the criteria based on your needs
sorry the code still does not work as desired…thanks
Then you need to get the value by using $rs[“the_field_name”] (change “the_field_name” to your actual field name) to do comparison process in that “Row_Selected” server event.
oke thanks