Implemented "Post as user"

Liam's add-ons
Post Macros

DragonByte Tech

Licensed
Licensed
Joined
Mar 9, 2020
Messages
5
Reaction score
3
I would like a new user group permission to control whether a macro can be posted as another user (`\XF::asVisitor(\XF\Entity\User $user, \Closure $closure);`.

Use case: Posting canned replies to bug reports in a similar fashion to XF's "Bug Bot" user.

I would be happy to contribute this feature to the add-on if you can point me to the GitHub repository it's hosted in :)
 

SyTry

Administrator
Staff member
Administrator
Moderator
Licensed
Joined
Jul 8, 2019
Messages
314
Reaction score
170
Hello,

We don't have a GitHub repository for any of our add-ons because we don't use GitHub :rolleyes:

This can be a good suggestion !

Regards, SyTry
 

CRUEL-MODZ

Administrator
Staff member
Administrator
Moderator
Licensed
Joined
Jul 8, 2019
Messages
810
Reaction score
319
Hello,

Where do you want us to define this, by creating a macro, in an option or other ?

Regards, CRUEL-MODZ
 

CRUEL-MODZ

Administrator
Staff member
Administrator
Moderator
Licensed
Joined
Jul 8, 2019
Messages
810
Reaction score
319
Hello,

So I found a solution which consists in adding a hidden input at the editor level, the problem is that if you refresh the page then I lose this hidden input, and if I don't have this hidden input I won't be able to post the message by another account unfortunately, if you had another solution I'm a taker.

Regards, CRUEL-MODZ
 

DragonByte Tech

Licensed
Licensed
Joined
Mar 9, 2020
Messages
5
Reaction score
3
The easiest solution would probably be a new kind of replacement variable, like `{=+Username}`, instead of a pre-defined setting in the macro itself.

Upon submitting the post, check whether the user has permission to post as another user. If not, just remove that part from the post. If yes, look up the user name.
 

DragonByte Tech

Licensed
Licensed
Joined
Mar 9, 2020
Messages
5
Reaction score
3
Perfect 👍

EDIT: The only thing that could improve it would be to pre-define the contents of the username field in the macro settings, since I'll want to use the same user multiple times.
 

CRUEL-MODZ

Administrator
Staff member
Administrator
Moderator
Licensed
Joined
Jul 8, 2019
Messages
810
Reaction score
319
the username field is already predefined in the macro by a: {=+Username} so in our case: {=+Test} : Screenshot
 

CRUEL-MODZ

Administrator
Staff member
Administrator
Moderator
Licensed
Joined
Jul 8, 2019
Messages
810
Reaction score
319
I just have to create the permission, and I can post the update ;)
 
Top Bottom