• Resolved jbonlinea

    (@jbonlinea)


    Hi,

    Thank’s for this great plug-in, simple yet efficient !

    One feature would be absolutly awesome, beeing able to show/hide according to logged-in user capabilities.

    In terms of implementation, once we have selected “capabilities” from the drop down menu, a simple text field where we could type in the list of capabilities separated with coma would be perfect !

    Chers

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author meceware

    (@meceware)

    Hi there,

    Thank you for the suggestion. I created an issue for this and will evaluate for this option. However, for the time being, you could add the capability to different user roles, if there aren’t many.

    Cheers,

    • This reply was modified 3 years, 8 months ago by meceware.
    Thread Starter jbonlinea

    (@jbonlinea)

    Hi

    thank’s for your quick reply !

    Indeed, I could add this capability to a role, that’s actually a good idea, event if in my use case, I would then need to create threes roles, which is not so nice neither.

    I was more considering using a php condition, with current_user_can() that’s also very flexible but maybe less future proof (changes that may break the function output)

    Cheers

    Plugin Author meceware

    (@meceware)

    Hi,

    If you are familiar with PHP, you can add your own functions and use it via the plugin.

    https://www.meceware.com/docs/block-permissions-for-gutenberg/#php-function

    For example, first function would check for 2 capabilities, named CheckForCapability2, return true or false depending on current_user_can() function, then enter the function name there.

    Thread Starter jbonlinea

    (@jbonlinea)

    Yeah that is my backup plan ??

    Your plug-in just need true or false, for instance

    function CheckForCapability2 () {
        if (current_user_can('myCustomCap1') || current_user_can(myCustomCap2)){
           retunr true;
        }else {
           retunr false;
       }
    }

    And then type “CheckForCapability2” in the block php setting

    Would that work, or is there any other needs ?

    Thank’s

    Plugin Author meceware

    (@meceware)

    Yep, this should work just fine.

    Thread Starter jbonlinea

    (@jbonlinea)

    Ok excellent

    Thank’s again for the plug-in and the quick support ??

    Thread Starter jbonlinea

    (@jbonlinea)

    forget about it’s working

    • This reply was modified 3 years, 8 months ago by jbonlinea.
    • This reply was modified 3 years, 8 months ago by jbonlinea.
    Plugin Author meceware

    (@meceware)

    Awesome ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Capabilities based permission’ is closed to new replies.