user-access-manager icon indicating copy to clipboard operation
user-access-manager copied to clipboard

How to check if current user has groups from inside a content generator

Open Trebly opened this issue 7 years ago • 0 comments

Hi Alex,

I am developing a post-process (callback) on output buffer to cut-off elements which can be not allowed (to receive and see) for the current user. For this I identify and can cut off any full targeted div. Into the div I have like an extended shortcode (not exactly the same delimiters to avoid any confusion) which contains the list of the UAM groups available for the div.

I would run a function which calls UAM with the following structure (quite sure that it already exists into uam) : $allowed = <the function> ( <list of id of groups>, <user : default current>)

This feature allows to cut off parts of articles or other documents, and to go further add watermark for allowed cases as "condidential, secret".

This allows to access the UAM control to elements af html content while currently it is for more larger elements like posts pages, W4poslist or others.

Best regards,

Trebly


note 1 : With your precedent answer I could cut-off elements from the loop of lists of W4 postlist and I have developed a group of function which can be added to a child-theme to install and use this feature.

note 2 : I recently sent a message to colobox panels WP shopmart because the definition of the content generated "panels colorpro", which can be compared with W4 postlist lists, do not show the UAM lateral bar, then Panels cannot be filtered by UAM. A W4Pl which is called by a shortcode can be filtered the W4pl list is seen as content object in WP admin main while coloxbox pro is not... Always with colorbox the items are divs into a panels exactly as it is done by W4pl with elements of lists. The problem is always the same : a mean to filter fine elements (like divs) into contents. I have two solutions with colorbox pro :

  • the same as for W4Poslist (need to patch the plugin and maintain when updated)
  • my new universal solution : cut of a div (the closest identified by a class) of the output buffer when contents my "extended shortcode" with answer false from the UAM function.

Trebly avatar Nov 22 '18 13:11 Trebly