I'm trying to do this: The access to page A is limited to website readers that are members of specified groups only. The access to page B is wider, the same readers like for page A can access it but also other too. I use shortcode in the Content of page B to create link to page A (in fact it's an excerpt from the text of page A, that's why I use shortcode).
When somebody who doesn't have access to page A click on that link, he/she will see an error message and possibility to login with different username. I would like to hide completely that link for such readers (it means the shortcode will return empty string) but I can not figure out how to check whether currently logged user has privileges to access page A or not. If possible I don't want to create some additional permission for that purpose as it's already there - appropriate user groups are selected on "access" tab of page A.
Please, could someone help me with that?