> For the complete documentation index, see [llms.txt](https://docs.fieldmotion.com/fieldmotion-api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.fieldmotion.com/fieldmotion-api-docs/userfilter/_setpublic.md).

# \_setPublic

Sets a User Filter to Private or Public, affecting whether all users can access it or not.

### Parameters

#### id

The ID of the User Filter.

#### val

An integer which sets the Public status of the User Filter:\
0 => Private\
1 => Public

### Examples

These examples use a created User Filter which has 105 as it's ID, and change it's name (represented by 'val') to "Test Filter" and "Tested Filter", respectively.

```
FM_api('UserFilter_setPublic',[
  'id'=>'30025',
  'val'=>'0'
  ]
);
```

### Results

#### On Success

This result will be given if running the function changes the User Filter's Public status:

```
{"ok":1}
```

This result will be given instead if the User Filter is already set to the Public status requested:

```
{"ok":1,"warning":"No change needed"}
```

#### On Failure

If the "id" parameter is less than 1 or does not have a given value:

```
{"error":"missing or invalid parameter: id"}
```

If the "id" parameter is given a value but it does not match the ID of an existing User Filter:

```
{"error":"filter with that ID does not exist"}
```

If the "val" parameter is not set or has a value higher than 1:

```
{"error":"missing or invalid parameter: val"}
```
