XF 2.2 Only click url when logged in, is that possible?

Status
Not open for further replies.

Black Tiger

Well-known member
Hello.

I want to have one node where people can post some links either internal (my forum webspace of the forums) or external.

However, I would like to have it that way, so visitors can see the post content but not be able to click on the url's.
Or rather, that they can see the post content, but they have to be registered/logged in to be able to see (and click) the url's posted.

How can I achieve this?
Because in usergroup permissions I can set the view option for the post (which should be yes) and attachments, but not for url's and we don't work with attachments.
 
I think I found one:

That should do the trick, then we can hide the url's under the spoiler.
 
I think I found one:

That should do the trick, then we can hide the url's under the spoiler.
It might not work with 2.2 since that addon hasn't been updated in 2.5 years. The developer also hasn't been logged on in 2 months.
 
I just tested it. It seems to work, only part of it can't be translated.

@Gh0stAdventures maybe it doesn't need to much work as it seems to work with 2.2 already. But would be nice if you could check if it's safe to use or create a better one.
 
I just tested it. It seems to work, only part of it can't be translated.

@Gh0stAdventures maybe it doesn't need to much work as it seems to work with 2.2 already. But would be nice if you could check if it's safe to use or create a better one.
It can be easily translated by the phrases :)

I guess the addon is working correctly and no errors appearing. So guess you can use this one and if you face any problems just let us know :)
 
remember, you'll also hide it from google/bots that way.

perhaps a bit of JS may be better to prevent default (jquery does that with a return false)?

something like (psedo code)
Code:
<xf:if is = "guest">
<script>
$( function() { 
    $('.message-content').on('click', 'a', function() {
        return false;  
    });
});
</script>
</if>
 
It can be easily translated by the phrases :)
No it can't as the text "to view the Spoiler content" is written hardcoded in English in the .xml file. There is no option in the addon to adjust/translate that part, at least I can't find it, neither in the language text.
The addon seems the work fine and I didn't see any errors yet. It only gave a warning on installation that some things in the .xml file might have content which should be looked at. But I didn't see anything odd, so I selected the box and choose install. Didn't see any error.

remember, you'll also hide it from google/bots that way.
Yep, that's no issue, it's even how I want it. As long as Google can read the post content, which is possible. The spoiler only hides the url posted in the spoiler which Google does not need to see.
It will be used to some files which can be downloaded. But to save bandwidth I don't want every guest to be able to download it and I don't need Google to show where the files are. So that is a good thing.

As for JS or jquery stuff, I don't have any knowledge about that or about coding, so I have no clue.
 
Glad you found a solution. I have needed something similar but necessarily in specific posts do I just put the links in s notice that shows only in a fortification forum and to specific user groups, but I might try that addon if I find I need the links in posts.
 
@Gh0stAdventures @briansol You guys seem to know something more about coding.
Now tonight I got a system notice, same which I got when I installed that addon.

Unexpected contents in this file:
src/addons/xerolabs/HideSpoilertoGuest/_data/template_modifications.xml
but I don't see anything odd. Is there anything I can change in that file so that notice dissapears?
 
Status
Not open for further replies.
Back
Top Bottom