WordPress.org

Ready to get started?Download WordPress

Forums

Need to access my self created plugin to subscriber and administrator (4 posts)

  1. vicky_wordpress
    Member
    Posted 1 year ago #

    Hello Support,

    Can you please let me know this thing.

    I had created a plugin into my local word press site.
    Right now when i logged in into my admin section it shows me. but i also want to show it also for subscriber users too.
    Hope you understand my problem.

  2. redrocksrover2
    Member
    Posted 1 year ago #

    It's not clear what you want to do. Are you saying that you installed the plugin into WordPress and you want the output of that plugin to be visible to visitors of your site? Or are you saying that you developed a plugin that you want users of your site to be able to use and access when they create/alter content themselves?

    If you're simply trying to make the content of an installed plugin visible on your site and it isn't visible, any number of things could be going on: the plugin may be outdated or coded poorly and thus not outputting content correctly, or you may need to insert custom tags or shortcodes to get the plugin to output as you expect, etc.

    If on the other hand you've developed your own plugin and you want to make it accessible to users with the 'subscriber' role, that may not be possible depending on the permissions that are required to use the plugin. For example, if your plugin deletes data from your blog, users are likely going to need permissions that are more lenient than the role of 'subscriber' (but depending on what you're trying to do, that might not be desirable or safe - context is everything).

  3. vicky_wordpress
    Member
    Posted 1 year ago #

    Yes i had developed a plugin and want that to show only for admin and subscribers only.

  4. bcworkz
    Member
    Posted 1 year ago #

    I'm sorry, it's still not completely clear what you want subscribers to see. A settings page or something similar your plugin generates? Or the plugins admin panel that lists all the plugins?

    For a plugin settings page, you need to identify a capability unique to only subscribers and admins, which probably does not exist. You can assign a custom capability with the add_cap() method of WP_Role class. There are also some plugins that make managing capabilities easy.

    You can then use this capability in your plugin when checking with current_user_can() if a particular action is allowable. This includes adding the submenu or menu item to the admin panels.

    If you are referring to the plugins admin panel, it's only possible if you assigned the activate_plugins capability to subscribers, which would be a very dangerous thing to allow. So in practical terms, this is not possible.

Topic Closed

This topic has been closed to new replies.

About this Topic