jaclas
Forum Replies Created
-
Pasting me the same documentation over and over again doesn’t help at all, because it doesn’t have a word to say about it.
English is not my native language, perhaps I write poorly, but probably not so bad that it is impossible to understand what I mean…
But I managed to achieve what I needed, which UM does not have out of the box. See:
View post on imgur.com
And I don’t have to manually type this message anywhere, it generates itself automatically, based on the restrictions given to the post.
- This reply was modified 2 years, 1 month ago by jaclas.
After many hours of searching, I think the key is filter um_post_content_restriction_settings, but I’m not sure yet how to use it, there is completely no documentation.
I’m still investigating…
I know that this one I can but it is completely unusable for several reasons:
- it requires MANUAL and correct writing of both conditions and message, at A, B, C, it may be simple, but imagine 15 roles…
- I won’t be writing articles, but a person who is a writer and doesn’t understand much about the computer (already teaching Gutenberg is a challenge!)
- articles will have access controlled by settings in the post editor, not in the content via shortcodes (like here https://docs.ultimatemember.com/article/1623-post-term-restriction-content-settings)
I am looking for an automaton, a function that can generate a message or a list of roles that have access to the current post. Oddly, this is not available.
I use a Bricks Builder
yes, thx
Thx for hint.
if anyone needs it, I publish the function code that returns the priority of the role assigned to the logged in user:
function getUserRolePriority() {
$um_roles_keys = get_option( 'um_roles', array() );
$userrole = UM()->user()->get_role();
if (str_starts_with($userrole, 'um_')) {
$userrole = substr($userrole, 3);
}
$rolemeta = get_option( "um_role_{$userrole}_meta", false );
if ( ! $rolemeta ) {
$prio = 0;
} else {
$prio = ! empty( $rolemeta['_um_priority'] ) ? $rolemeta['_um_priority'] : 0;
}
return $prio;
}I am familiar with this documentation. It does not solve my problem. I am asking how to display the message:
“Access to this content is allowed only for B and C”.
Yes, please close topic. Thx for reply.
The link I provided was just a submission to the Bricks Builder authors forum. But as I wrote, unfortunately, no one has still addressed it, nor have they even written back to me on the submission ??
I am hoping that maybe someone from you will motivate them ??After all, you probably also care that your plugin works with the increasingly popular builder, right?
After analysis I came to the conclusion that the problem is in Bricks Builder, here I described my findings:
Unfortunately, still nothing has been corrected and I can’t use UM ??
Have you dealt with this problem? According to Aswin’s tip, I still can’t get the excerpt content.
In list of UM hooks:
https://docs.ultimatemember.com/article/1324-hooks-list
I don’t see um_restricted_singular_post hook. I’m not a WordPress expert but I guess there should be a description of this hook?
I’m sorry Aswin, but the code I checked (and linked above) was just from the site you directed me to. It was published by nsinelnikov on gist (github) and I copied it from there. It doesn’t work for excerpt, unfortunately.
I search solution for this issue too