# nats\_list\_campaigns

*Article Topics:* [*Smarty*](https://docs.toomuchmedia.com/getting-started/common-topics/smarty)*,* [*Customization*](https://docs.toomuchmedia.com/getting-started/common-topics/customization)

## Parameters

(*Required parameters in **bold**)*

| Parameter                                                                                                                                 | Description                                                                         | Possible Values                 | Default Value                 | Example                |
| ----------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------- | ----------------------------- | ---------------------- |
| userid                                                                                                                                    | the loginid of the affiliate whose campaigns should be listed.                      | The I.D. user viewing the page. | Any integer greater than zero | userid=123             |
| details                                                                                                                                   | Set to 1 to provide more details about the campaigns in the output. See note below. | 0 or 1 (exclusive)              | 0                             | details=1              |
| show\_hidden                                                                                                                              | Set to 1 to include details about hidden campaigns in the output.                   | 0 or 1 (exclusive)              | 0                             | show\_hidden=1         |
| [assign\_prefix](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-function-parameters/assign_prefix) | Prefix output variables with this word. (Click link for details)                    | Any valid Smarty variable name  | *None.* (No prefix is used)   | assign\_prefix="myvar" |

### Output

Outputs an array called *$campaigns*. The arguments above determine the array's structure.

If *details* is not set or are set to "0", *$campaigns* will have one-dimension with the numeric [campaignid](https://tmmwiki.com/index.php?title=Campaignid\&action=edit\&redlink=1) as the key and the campaign's text description as the value:

```
Array campaigns(
    [59] => "Main campaign used by default.",
    [276] => "My second campaign." 
)
```

If *details* is set to "1", all information about each campaign will be listed in a multi-dimensional array. For example:

```
Array campaigns(
    [59] => Array(
        [campaignid] => 59,
        [loginid] => 45,
        [name] => "Default",
        [description] => "Main campaign used by default.",
        [created_date] => 1209634033,
        [hide] => 0,
        [old_campaignid] => 0 ),
    [276] => Array(
        [campaignid] => 276,
        [loginid] => 45,
        [name] => "Second Campaign",
        [description] => "John Smith Special Campaign",
        [created_date] => 1209664102,
        [hide] => 0,
        [old_campaignid] => 0 ),

)
```

## See Also

* [nats\_list\_sites](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_list_sites) -- lists all sites in a particular program.
* [nats\_list\_tours](https://docs.toomuchmedia.com/nats-admin/skins-and-templates/further-reading/template-functions/nats_list_tours) -- lists all sites in a particular program and [site](https://docs.toomuchmedia.com/additional-resources/common-terms#site).
