• hosta1

    (@hosta1)


    I’m experiencing an issue with the Restrict User Access plugin when trying to fetch an access level’s name by its ID using the function rua_get_level(). Although I can retrieve the access level object, the name property either returns empty or doesn’t exist for valid access level IDs.

    I am using a shortcode to pass the level_id and call the function to display users of that access level. The code snippet is designed to display a button with the access level name, which toggles a table of users belonging to that access level. However, the name property of the access level isn’t returned properly.

    Could you please confirm if this is a known issue or if there is another method for retrieving an access level’s name by its ID?

    Thanks!

Viewing 1 replies (of 1 total)
  • Plugin Author Joachim Jensen

    (@intoxstudio)

    Hi,

    Would something like this work for you?

    rua_get_level($level_id)->get_title()

    If you are looking for the actual name/slug, and not the title, that is not currently possible via the RUA API, but I can see how that could be useful.

    Since Access Levels are stored as custom post types, you could do this for now:

    get_post($level_id)->post_name

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.