works like a charm! thanks
Hide links from guests / Filter post content based on user group
-
Hi,
I'd like a plugin that display links to registered users only, is there any plugins that allows this?
From the point of view of a guest, he would see something like [Link available to registered users only] instead of the links.
Actually, it would be even nicer to be able to filter all types of content and replace it with another one according to the group of the user.I know that it's possible
You'd want to create a plugin that acts on the
filter:parse.post
hook, and removes private information (of your choosing) based on whether the user is an admin or not.but haven't find any plugins actually doing it yet
-
Hello @Annihil !
I'd like to know if you've been able to find something to do this or if you've been unsuccessful!
Please let me know!(I'm looking for a plugin to make to challenge myself)
-
Hey @Telokis
I did not investigate further more, so you can challenge yourself and try to make it -
@julian @psychobunny Sorry to bother you guys but I can't figure out which hooks to use. The hook listing is not very useful since there is no explanation.
I'd like to filter the posts during their retrieval so I need post.get and post.getPosts but I also want to filter the little preview showing on the main page. Where is it from?Thanks
-
@Telokis You want
filter:post.get
-
@PitaJ That's what I though as well but when I'm on the homepage of the forum, it doesn't get fired even though the preview is available on the right of the category.
-
@Telokis hmm. Do you mind opening an issue on Github about that? It should be fired.
-
-
@Telokis don't think it's an issue. Use the filter
filter:teasers.get
-
@julian @psychobunny Why was CLS removed from NodeBB? It seems like a feature removed to me.
The pull request:
https://github.com/NodeBB/NodeBB/pull/4162 -
@Telokis Yes, we attempted to use CLS to plumb req, res, etc. data into hooks, but we found that it was often unreliable and wasn't available when you needed it.
We're waiting to try it again in the future because it has potential!
-
@julian Ok thanks for the answer. Is there any workaround available or is it a current lack in the software?
I'd like to get the user uid from a specific hook. (Get teasers) -
@Telokis I added the
uid
to that hook. On the master branch, and in the next version of NodeBB, you'll be good. -
@PitaJ Yes, I know you did and thanks for that. However, I was hoping to be able to do it in another way in v1.4.5.
-
@Telokis there is no way besides maybe cherry picking that specific commit or changing the code yourself
-
@Annihil said in Hide links from guests / Filter post content based on user group:
Hi,
I'd like a plugin that display links to registered users only, is there any plugins that allows this?
From the point of view of a guest, he would see something like [Link available to registered users only] instead of the links.
Actually, it would be even nicer to be able to filter all types of content and replace it with another one according to the group of the user.I know that it's possible
You'd want to create a plugin that acts on the
filter:parse.post
hook, and removes private information (of your choosing) based on whether the user is an admin or not.but haven't find any plugins actually doing it yet
you could simply use the widgets, as they have restrictions on who can or cant see them
-
@ChaosYamYT
True, but that's a not very convenient workaround, I was talking about the content of posts actually -
@Annihil Oh, I see. ( ;-; I got downvoted)
-
@Telokis
What's up with the plugin? -
please! Anyone managed to make this extension?
I really want it!