Checking for Capabilities (4 posts)

  1. Bukajec
    Posted 3 years ago #

    I was reading through the documentation and I don't understand this bit:
    "In WordPress, you can use the current_user_can() function to check if the current user has a particular capability. Since you don't know whether a user has this plugin installed, you might want to check first."

    What do you mean with user having the plugin installed? The plugin is installed on the server with the other wordpress files. Could somebody explain this to me?


  2. esmi
    Forum Moderator
    Posted 3 years ago #

    You can use current_user_can() to check whether a given user can access any or all of a plugin's settings in the WP dashboard.

  3. Bukajec
    Posted 3 years ago #

    I get that, but the guide also mentions something like this:

    if ( function_exists( 'members_check_for_cap' ) && members_check_for_cap( 'some_cap' ) ) {
    	/* Do something if any role has the 'some_cap' capability. */
    else {
    	/* Do something for people without the plugin. */

    And I don't understand why should the user have the plugin installed, it doesn't make sense.

  4. Bukajec
    Posted 3 years ago #

    Is it like in case I remove the plugin?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Members
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic