• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

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