Hide list plugin button based on logged in user

jo-ka

Member
Hello.
I have this list, where with the caneditrow plugin, I was able to limit the logged in user to edit his own records (dollar bill icon is the edit button).

Now, I've created a list plugin, which will take an action on the list rows, but I also need to display only the new plugin button, to the same user, this is, the envelope icon must be displayed only to the user on the row.

How can I achieve this?

Thanks in advance.

upload_2021-5-10_10-17-17.png
 
The php list plugin doesn't have a condition.
So you must skip your action in the code (anyway, for security reasons).
If you don't want to show the checkbox you can hide it with custom css.
To hide/remove the button on certain rows I think you'll need list JS.
Or do it with a custom template.

Edit: or with custom CSS addressing the position of your button (hide if 1st child)
 
Last edited:
For hiding the button where there's no edit access, something like this should do:

a.php-1 ~ :not(a.fabrik_edit) {
display:none;
}

where php-1 is your php button "a" element class and .fabrik_edit your edit button "a" element class
 
For hiding the button where there's no edit access, something like this should do:

a.php-1 ~ :not(a.fabrik_edit) {
display:none;
}

where php-1 is your php button "a" element class and .fabrik_edit your edit button "a" element class

OK, let me check If I can use this suggestion...
 
Using update_col, how to use this Check Can Edit option? Is this a way to achieve what I'm looking for?

upload_2021-5-10_12-34-35.png
 
For hiding the button where there's no edit access, something like this should do:

a.php-1 ~ :not(a.fabrik_edit) {
display:none;
}

where php-1 is your php button "a" element class and .fabrik_edit your edit button "a" element class

Can't get this working.
Can I ask you please to post a real example, so I can try with my details? I'm very weak on CSS...
 
Ok, made a quick test and ":not" doesn't seem to work with siblings. But this works (for me):

.php-1 {
display:none;
}
.fabrik_edit ~ .php-1 {
display:inline-block;
}

P.S. ".fabrik-edit" has to be before ".php-1". And make sure the class is php-1, not php-2 etc.
 
Ok, made a quick test and ":not" doesn't seem to work with siblings. But this works (for me):

.php-1 {
display:none;
}
.fabrik_edit ~ .php-1 {
display:inline-block;
}

P.S. ".fabrik-edit" has to be before ".php-1". And make sure the class is php-1, not php-2 etc.

Yes, perfect, this seems to work. Thanks @juuser.
upload_2021-5-10_14-51-46.png
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top