Luke,
firtly, why would you ever need it? The role itself is nothing but a named set of capabilities. As a developer you check if the current user has some capability and you do not care the role. You usually use has_capability() or require_capability() for this. See the public API defined in lib/accesslib.php
firtly, why would you ever need it? The role itself is nothing but a named set of capabilities. As a developer you check if the current user has some capability and you do not care the role. You usually use has_capability() or require_capability() for this. See the public API defined in lib/accesslib.php
we have a role called parent, and need some text to only display to parents and no one else so am looking for somthing like isadmin() but for othe roles....
unless i create a custom capability ( but i dont know how)
Depending on where the text goes you may be able to control this already by clever use of other capabilities (e.g. for a label on course page I think you can make the label hidden, then override to give parents 'viewhiddenactivities' on just that label).
If not then yes you should create a new capability. For example if the text is part of a new plugin you're building, your new capability should go in the access.php of that plugin. If it is not part of a plugin then it should probably go in local/db/access.php. See docs/source for more details on capabilities.
If you really really want to ensure the text appears to parents and not to any other role, even admin, then don't forget to use the 'false' flag to $doanything when you check has_capability.
--sam
If not then yes you should create a new capability. For example if the text is part of a new plugin you're building, your new capability should go in the access.php of that plugin. If it is not part of a plugin then it should probably go in local/db/access.php. See docs/source for more details on capabilities.
If you really really want to ensure the text appears to parents and not to any other role, even admin, then don't forget to use the 'false' flag to $doanything when you check has_capability.
--sam
Luke -where are you wanting this text only to parents to appear? As Sam says,if it's something like a label or a block you can set it up so only parents can see it as in the docs here
But again - it depends on where you want this text.
But again - it depends on where you want this text.