[OzzModz] Conversation Lock & Invite Permissions

[OzzModz] Conversation Lock & Invite Permissions 2.0.0

No permission to download
post a complete example not just bits of template code that have no meaning in this add-on.
Or better yet @kick provide us with your own free add-on that accomplishes the exact same features (and more?).
Before these messages get deleted and the thread is reverted to its actual purpose, let me add that unless you find a security issue, it is sometimes better and more polite to contact the author privately to provide your opinion and/or expertise thus allowing them to update the resource, if they so desire, on their own time and as they see fit without potential users of the add-on wondering what is going on.
Constantly bombarding resource threads with what you see as improvements (regardless of whether you are right or not) is not the right approach in my opinion.
I have always welcomed suggestions for improving my code but not everyone may wish it. There is a fine line between trying to help and just trying to show off.
Sometimes it is better to write code in a certain way in order for it to be understood much more easily rather than trying to save a few lines of code. We all have our own style, it does not necessarily mean one is better than the other.
As I suggested before, you might wish to create your own add-ons (at least 1 XF add-on) first so we may all learn from your exemplary code.
 
Again, as it stands there is nothing wrong with the template modification as it's being done now.
His point is that it may be preferable to do a regular expression. Ideally what you're searching for in a template modification should ultimately be as few characters as possible, while obviously matching enough and not too much.

Can't be bothered to write a proper regex but in pseudo-code essentially instead of this:
Code:
<xf:option name="open_invite" checked="{{ ($draft.open_invite OR $conversation.open_invite) ? 'checked' : '' }}">
You would match this:
Rich (BB code):
<xf:option name="open_invite".*>
Significantly, if we ever changed this bit:
Code:
checked="{{ ($draft.open_invite OR $conversation.open_invite) ? 'checked' : '' }}"
Then with a full string replacement, it would break, with a regular expression, it would work automatically.

It's resource standard #18 so definitely something developers need to be careful of:
Template modifications must be careful not to replace too much of a template. This might require the use of more complex methods such as a PHP callback or regular expression match.

That all said, @kick, your attitude (as noted by others) does come across as arrogant and unnecessarily antagonistic in some cases. It is good that you are taking the time to report potential issues to fellow developers and it is appreciated, but sometimes the credibility and respect that earns can be quickly lost if it is done in a tone that comes across poorly.
 
Now THAT makes more sense than what I interpreted as being originally suggested.

This is what I suggested to Ozzy before @Chris D replied..
Simply use 2 template modifications. One for each permission (invite and lock) and use $0.

IE:

Find:
Code:
/<xf:option name="open_invite".+<\/xf:option>/isU

Replace:
Code:
<xf:if is="$xf.visitor.hasPermission('snogConvoLockInvite', 'invite')">
    $0
</xf:if>
 
Last edited:
That’s more like it 👍
Yeah, I thought so too. But now that I understand what @kick might have been trying to say, this might be better as a single modification...
Code:
/(<xf:option name="open_invite".+<\/xf:option>).+(<xf:option name="conversation_locked".+<\/xf:option>)/isU

And using $1 and $2 to do the replacements.

All his talk about macros and such just confused things so far as I'm concerned.
 
@Chris D, I write everything adequately, but maybe somewhere a bit cruel (but in the future it will be useful to him). But this time I even praised the developer, since his level has really grown and has already become fewer at times times wrong, so besides this, his code has become nicer and smarter.
@Snog, so here it is possible. And the truth is so beautiful and comfortable? And at the same time, when changing templates, even adding new functions or changes inside a block will not break when updating and will be supported both with new releases and with old ones. In this case, you do not copy-paste the engine and received only advantages. Yes, regular expressions can be complicated, but they are worth learning and practicing with them. Because on some regular expressions we can make better quality and without problems even make parsers from one format to another.
For example:
View attachment 207446
We just found 3 blocks and in front of them inserted 3 macros that add their own. Here the same principle and in addition, it will be possible to omit the requirement 2.1 as well as 2.0 it will be fine then to work. Only then he finds these blocks and wraps them in the conditions. And all because the search for regular expression and data insertion, what is found and the initial tags will be similar in search with 2.0.
I showed in this example and said how to do that would be more correct.
I do not want to humiliate the developer or something else. I showed only the best opportunity and the output that will be faster, more convenient and more profitable. The ideal code does not exist and never will be, because every developer has experience over time, and this experience is taken from practice and writing code not a dozen times. I am not perfect either, and there are mistakes and problems, but I try to get better. And with what you wrote a year ago and after practicing writing applications for a year, you yourself look at your code and be horrified how you could write this. When in the future you implement or rewrite code.
In this topic, I just pointed to the small minuses of development and which would be worth correcting.
After I was told that I did the same thing in the engine, I wrote that it is worth making a new modification, and not to make a modification that copies the paste engine only by adding over its condition.
If I hurt someone badly or offended, I beg your pardon. Just XF is considered to be a really smart engine. But here are some additions that just spoil the picture and that they would not say bad things about the engine and the corresponding messages to the authors are needed in order for them to put their code in the code. In addition to this, I don’t know the reason for rejecting the same chic offer that will make code style for add-on developers like XF:
But this is their decision and most likely there are reasons for that.
 
@kick, the example you gave was actually quite confusing (at least it was to me). And I have to attribute that to a language barrier. You might be better off giving examples as they apply to the add-on like I did. That would make things much clearer than the way you posted your examples here. The mention of macros really threw me off the track of what you were trying to say.

It wasn't until @Chris D replied that I understood what you might have been trying to say.
 
@ozzy47 ,

I know you´ll kill me - but is there a chance you could improve this add-on with an extended and required function further on? When I say "GPDR", you´ll bury your face in your hands, like I do ;)

Anyway - the invite system for conversation lacks in one aspect. When you are engaged in a conversation with 2 others, 30 messages have been exchanged, you may be reach a point, where someone wants to add another person to the conversation for whatever reason. May be one of the original conversation participants has written something, that the new guy shouldn´t read, some sensitive informations you don´t wanna give away. At that point this particular participant has no option to prevent, that the 4th user joins the conversation.

So, when you as the webmaster are offering the option to invite members into conversations, you are responsible that this is going by the terms of the f** GPDR. To be able to comply with that, would it be possible to extend this add-on with an admin option, that all conversation participants have to activly confirm an invitation of a third person, before that person in fact joins and can read the messages?
 
Hi,
Would it be possible for this to lock conversations even if the person isn't the conversation starter? Looking for this specifically for staff.
 
@Ozzy47 thanks mate for the add-on, I seem not to be able to find the lock conversation functionality anywhere.

I have active conversations with some members but checked everywhere to lock them and could not find way to do that!
 
@Ozzy47 thanks mate for the add-on, I seem not to be able to find the lock conversation functionality anywhere.

I have active conversations with some members but checked everywhere to lock them and could not find way to do that!

Any reply to the above @Ozzy47 ?
 
Back
Top Bottom