Skip to content

Extend filter-hook "table_add_row_action_array" by parameter "keyword" #2743

@ueickmann

Description

@ueickmann

I use the plugin AuthMgrPlus for giving different editing-rights to different users.

As I want users of type "contributor" to be able only to edit their own URLs I nevertheless want them to see all existing URLs in the YOURLs-instance. Though this is possible by giving them the right "ViewAll" via user-config this also leads to having the buttons for "Edit" and "Delete" visible and clickable for them, also for URLs which are not their own.
Now from a UI-perspective, I think it would be better to hide (or deactivate) functionality which is not available to a user, rather than letting him click on it and then display an error (which currently doesn't work properly either).

While I tried to figure out, how it could be achieved to hide these buttons for a user URL-wise, I came across the filter-hook "table_add_row_action_array" in the functions-html.php (on line 566 in version 1.7.9).
But then I realized that for the use of this hook in a plugin the context of the keyword is missing. Without that, a filter-function could not decide wether a user should be able to edit/delete a keyword or not.

So this is the reason for my request to introduce a second parameter "keyword" to the hook, like I did now manually:
$actions = yourls_apply_filter( 'table_add_row_action_array', $actions, $keyword );
So a plugin (maybe authmgrplus) could handle this properly.

Many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions