If the value 0 in the field do not see for visitors

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
saleh
User
Posts: 470

If the value 0 in the field do not see for visitors

Post by saleh »

please help
If the value 0 in the field: Activated do not see for visitors
If the value 1 in the field : Activated he sees for visitors

Activated=0 The table not shows for visitors
Activated=1 The table shows for visitors

Meaning it does not cleanse the table to visitors only on condition that if the value of 1 Activated concert

userlevelid :0
userlevelname: Default

I tried this code and failure:

function UserID_Loaded() {
//echo "UserID Loaded: " . $this->UserIDList() . "<br>";
global $Page;
if ($Page && $Page->TableName == "programs" && CurrentUserLevel() == "0") {
$this->AddUserID(-1);
ew_AddFilter($filter, " Activated <> 0 ");
}

The table is:
CREATE TABLE programs (
Programs_id int(11) NOT NULL,
Programs_name varchar(255) NOT NULL,
initiative int(11) NOT NULL,
goal text,
Brief text,
From_date date DEFAULT NULL,
To_date date DEFAULT NULL,
implementation_period int(11) DEFAULT NULL,
Type_Length int(11) DEFAULT NULL,
Beneficiaries int(11) DEFAULT NULL,
number_beneficiaries int(11) DEFAULT NULL,
Results text NOT NULL,
pictures varchar(100) DEFAULT NULL,
Video longblob,
Identity int(11) DEFAULT NULL,
Activated int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


mobhar
User
Posts: 11660

Post by mobhar »

saleh wrote:
I tried this code and failure:

Always post the error message for discussion.

In addition, you should put this following code in "Recordset_Selecting", and not in "UserID_Loaded' server event:

ew_AddFilter($filter, " Activated <> 0 ");


saleh
User
Posts: 470

Post by saleh »

When introduced to the database and change my value to the one shown to visitors

Does not appear for the director even change the field from 0 to 1

I want a candidate Visitors to display only

If the value is zero, but can see the manager and Starter only

If value 1 see Visitors and Starter and Director

This code worked successfully
Is there a better way?

// Recordset Selecting event
function Recordset_Selecting(&$filter) {
// Enter your code here
if (CurrentUserLevel() <> 3 && CurrentUserLevel() <> -1) {
ew_AddFilter($filter, " Activated <> 0 ");

}}


Post Reply