# Hide \`eye\` icon from Listings row based on user role

This is only a visual change, and not a server side prevention of being able to open the "View" modal. So keep this in mind when using this.

Put below PHP code in your child theme `functions.php`

```php
add_action('wp_footer', function(){
    if(is_admin()) return;
    $user = wp_get_current_user();
    $role = (is_user_logged_in() && !empty($user->roles)) ? $user->roles[0] : 'guest';
    ?>
    <script>
        (function(){
	    const role = '<?php echo esc_js($role); ?>';
	    document.addEventListener('DOMContentLoaded', function () {
	    if(role!=='administrator') {
	        document.querySelectorAll('.super-entries .super-entry .super-actions-menu > .super-view').forEach(el => el.remove());
            }
        });
    })();
    </script>
    <?php
});
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.super-forms.com/developers/code-examples/hide-eye-icon-from-listings-row-based-on-user-role.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
