osticket-plugin-mentioner
osticket-plugin-mentioner copied to clipboard
Doesn't work with 1.11 or 1.12 - Plans to update to latest osTicket versions?
Hi there,
I'm running osTicket v 1.11 and I tried your plugin (which seems like a great addition to the core functionality), but it throws an exception. So I was just wondering if you were planning to update this plugin to function in the newest versions?
This is the error I get when I add mentions into a ticket.
[Thu Jul 11 13:16:43.299811 2019] [php7:error] [pid 19673] [client 10.0.50.64:59867] PHP Fatal error: Uncaught InvalidArgumentException: User expected in /var/www/html/osticket/include/class.user.php:1369\nStack trace:\n#0 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(92): UserList->add(Object(Staff))\n#1 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(48): MentionerPlugin->checkThreadTextForMentions(Object(MessageThreadEntry))\n#2 /var/www/html/osticket/include/class.signal.php(98): MentionerPlugin->{closure}(Object(MessageThreadEntry), NULL)\n#3 /var/www/html/osticket/include/class.thread.php(1671): Signal::send('threadentry.cre...', Object(MessageThreadEntry))\n#4 /var/www/html/osticket/include/class.thread.php(1677): ThreadEntry::create(Array)\n#5 /var/www/html/osticket/include/class.thread.php(2748): ThreadEntry::add(Array)\n#6 /var/www/html/osticket/include/class.thread.php(2963): MessageThreadEntry::add(Array, Array)\n#7 /var/www/html/osticket/include/class.ticket.php(2700): ObjectThread->addMessage(Array, Array)\n#8 /var/www/html/osticket/tickets.php(89): in /var/www/html/osticket/include/class.user.php on line 1369, referer: https://help.esgsolutions.com/tickets.php
Huh, Staff objects aren't Users anymore? Interesting.
Now the irritation, I'll have to write branches that for each version.. which goes against the whole point of plugins in the first place, or force everyone who uses it to upgrade.
Thanks for the report mate, answer: yes. We use this plugin a lot, so I'll be adding support soon. Likely before we've upgraded.
On Fri, 12 Jul. 2019, 03:44 nminaker, [email protected] wrote:
Hi there,
I'm running osTicket v 1.11 and I tried your plugin (which seems like a great addition to the core functionality), but it throws an exception. So I was just wondering if you were planning to update this plugin to function in the newest versions?
This is the error I get when I add mentions into a ticket. [Thu Jul 11 13:16:43.299811 2019] [php7:error] [pid 19673] [client 10.0.50.64:59867] PHP Fatal error: Uncaught InvalidArgumentException: User expected in /var/www/html/osticket/include/class.user.php:1369\nStack trace:\n#0 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(92): UserList->add(Object(Staff))\n#1 /var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(48): MentionerPlugin->checkThreadTextForMentions(Object(MessageThreadEntry))\n#2 /var/www/html/osticket/include/class.signal.php(98): MentionerPlugin->{closure}(Object(MessageThreadEntry), NULL)\n#3 /var/www/html/osticket/include/class.thread.php(1671): Signal::send('threadentry.cre...', Object(MessageThreadEntry))\n#4 /var/www/html/osticket/include/class.thread.php(1677): ThreadEntry::create(Array)\n#5 /var/www/html/osticket/include/class.thread.php(2748): ThreadEntry::add(Array)\n#6 /var/www/html/osticket/include/class.thread.php(2963): MessageThreadEntry::add(Array, Array)\n#7 /var/www/html/osticket/include/class.ticket.php(2700): ObjectThread->addMessage(Array, Array)\n#8 /var/www/html/osticket/tickets.php(89): in /var/www/html/osticket/include/class.user.php on line 1369, referer: https://help.esgsolutions.com/tickets.php
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11?email_source=notifications&email_token=ABGXTD3THSVWJTOJXYF5XELP65WQ7A5CNFSM4IBPLRT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G6WHGAA, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGXTDZ5OUSEDMBHHWTZIZTP65WQ7ANCNFSM4IBPLRTQ .
Thanks for the response, and thanks for making such a seemingly useful plugin (I say "seemingly" , only because I haven't been able to try it out yet).
Is there a way to check the version and then call one function if its < 1.11 (or in whichever version this functionality changed) and another function if its >= 1.11?
Thanks again.
Cheers,
Nick
I don't see why not, the version must be defined in the code somewhere.
On Fri, 12 Jul. 2019, 10:31 nminaker, [email protected] wrote:
Thanks for the response, and thanks for making such a seemingly useful plugin (I say "seemingly" , only because I haven't been able to try it out yet).
Is there a way to check the version and then call one function if its < 1.11 (or in whichever version this functionality changed) and another function if its >= 1.11?
Thanks again.
Cheers,
Nick
Nicholas Minaker Manager of Field Services and Technical Support +1-613-217-2719
From: Aaron [email protected] Sent: Thursday, July 11, 2019 5:22:53 PM To: clonemeagain/osticket-plugin-mentioner Cc: Nicholas Minaker; Author Subject: Re: [clonemeagain/osticket-plugin-mentioner] Doesn't work with 1.11 or 1.12 - Plans to update to latest osTicket versions? (#11)
Huh, Staff objects aren't Users anymore? Interesting.
Now the irritation, I'll have to write branches that for each version.. which goes against the whole point of plugins in the first place, or force everyone who uses it to upgrade.
Thanks for the report mate, answer: yes. We use this plugin a lot, so I'll be adding support soon. Likely before we've upgraded.
On Fri, 12 Jul. 2019, 03:44 nminaker, [email protected] wrote:
Hi there,
I'm running osTicket v 1.11 and I tried your plugin (which seems like a great addition to the core functionality), but it throws an exception. So I was just wondering if you were planning to update this plugin to function in the newest versions?
This is the error I get when I add mentions into a ticket. [Thu Jul 11 13:16:43.299811 2019] [php7:error] [pid 19673] [client 10.0.50.64:59867] PHP Fatal error: Uncaught InvalidArgumentException: User expected in /var/www/html/osticket/include/class.user.php:1369\nStack trace:\n#0
/var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(92):
UserList->add(Object(Staff))\n#1
/var/www/html/osticket/include/plugins/mentioner/class.MentionerPlugin.php(48):
MentionerPlugin->checkThreadTextForMentions(Object(MessageThreadEntry))\n#2
/var/www/html/osticket/include/class.signal.php(98): MentionerPlugin->{closure}(Object(MessageThreadEntry), NULL)\n#3 /var/www/html/osticket/include/class.thread.php(1671): Signal::send('threadentry.cre...', Object(MessageThreadEntry))\n#4 /var/www/html/osticket/include/class.thread.php(1677): ThreadEntry::create(Array)\n#5 /var/www/html/osticket/include/class.thread.php(2748): ThreadEntry::add(Array)\n#6 /var/www/html/osticket/include/class.thread.php(2963): MessageThreadEntry::add(Array, Array)\n#7 /var/www/html/osticket/include/class.ticket.php(2700): ObjectThread->addMessage(Array, Array)\n#8 /var/www/html/osticket/tickets.php(89): in /var/www/html/osticket/include/class.user.php on line 1369, referer: https://help.esgsolutions.com/tickets.php
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11?email_source=notifications&email_token=ABGXTD3THSVWJTOJXYF5XELP65WQ7A5CNFSM4IBPLRT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G6WHGAA , or mute the thread < https://github.com/notifications/unsubscribe-auth/ABGXTDZ5OUSEDMBHHWTZIZTP65WQ7ANCNFSM4IBPLRTQ
.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub< https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11?email_source=notifications&email_token=AHGC4ZAGOFAEFRS66YY3QG3P66QC3A5CNFSM4IBPLRT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZYAUMA#issuecomment-510659120>, or mute the thread< https://github.com/notifications/unsubscribe-auth/AHGC4ZBOMI2X46IRK3BYQBDP66QC3ANCNFSM4IBPLRTQ
.
This email contains confidential and/or privileged information and may be read and used only by the intended recipient. Please do not copy any portions or this email, and do not disseminate its contents to anyone without our consent. If you are not the intended recipient of this message please delete it immediately and inform the sender that you have received this message in error.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11?email_source=notifications&email_token=ABGXTD5GF77EKMGHOD7JJWLP67GGDA5CNFSM4IBPLRT2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZYKYXI#issuecomment-510700637, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGXTD32PG6B625EMQL4G6TP67GGDANCNFSM4IBPLRTQ .
hi @clonemeagain long time from last.. ostiket before 1.10 not have way to check corrected version.. so will be a pain.. in some weeks i can make some test and report feedback here!
Hey Chief, still haven't upgraded our instance yet, business priorities have changed and I've got minimal time for open source projects now. Frustrating. But if you're able to, a pull request would be welcomed
take easy @clonemeagain i understand! time day it's precious now! right? i'm in same behaviour.. pufff very very frustrating.. but i'll make some space and try to made a pull request!
plesase stay alert .. thanks dude!
While not a proper fix the bodge below gets staff mentions working again in latest version of osTicket (tested in v1.14.1).
Line 85, change from
$stafflist = new UserList ();
to
$stafflist = new StaffList ();
At the very bottom add the below (it's the UserList definition from class.user.php in osTicket v1.10.1)
class StaffList extends ListObject
implements TemplateVariable {
function __toString() {
return $this->getNames();
}
function getNames() {
$list = array();
foreach($this->storage as $user) {
if (is_object($user))
$list [] = $user->getName();
}
return $list ? implode(', ', $list) : '';
}
function getFull() {
$list = array();
foreach($this->storage as $user) {
if (is_object($user))
$list[] = sprintf("%s <%s>", $user->getName(), $user->getEmail());
}
return $list ? implode(', ', $list) : '';
}
function getEmails() {
$list = array();
foreach($this->storage as $user) {
if (is_object($user))
$list[] = $user->getEmail();
}
return $list ? implode(', ', $list) : '';
}
static function getVarScope() {
return array(
'names' => __('List of names'),
'emails' => __('List of email addresses'),
'full' => __('List of names and email addresses'),
);
}
}
@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks! However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error. But the internal notice will still be posted, however no e-mail is being send. Any idea?
@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks! However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error. But the internal notice will still be posted, however no e-mail is being send. Any idea?
same issue here with v1.14.1 when use mentions (#user)
hi @AdamDempsey @DanielKng and @wgalafassijr , your code @AdamDempsey seems works but need two tings:
- a version check to property stil works with current stable version due 1.14 are just so new..
- the change use the name from staf so 500 error are due $stafflist doe snot have the staf name..
so @clonemeagain as you said before logn time ago, staff object aren't users anymore! due the change does no included the people listed in the user database (only staff).. it fails if you search for some of the staff members.. i do not remenber right now the format of.. but like array we must merged and dischard the duplicates (one person in user list also can be the same in staff lits)
this seems all the logic must be include in a function that first try the user database and if the mentioned tag are not foud try them the staff databe users.
@AdamDempsey We got 1.14.1 running and I added your Code. It works, and users can be added as collaborators, thanks! However, if i enable the "Use #mentions for ticket notifications"-Option i´ll get an HTTP 500 error. But the internal notice will still be posted, however no e-mail is being send. Any idea?
We're also installing it on osTicket v1.14.2 and got the same error when using #function. Really look forward to a way to solve this problem! If someone has a way to solve it, please kindly guide. Thanks a lot!
Also installed on OSTicket v1.14.1 and got the same error using the #agent function. Really want to use this on internal notes which doesn't work with @agent as, even with the code above added, a new user is created and added as a collaborator. The user doesn't get notified about new internal notes.
@clonemeagain Have you managed to have a look at getting the # mentions working with 1.14.x?
I am on 1.14.1 and able to get # notification emails after changing the following:
Line 371 from private function notifyStaffOfMention(ThreadEntry $entry, UserList $recipients) {
to private function notifyStaffOfMention(ThreadEntry $entry, StaffList $recipients) {
I am on 1.14.1 and able to get # notification emails after changing the following: Line 371 from
private function notifyStaffOfMention(ThreadEntry $entry, UserList $recipients) {
toprivate function notifyStaffOfMention(ThreadEntry $entry, StaffList $recipients) {
Worked for me too with this change. Thank you.
Need to write a version check then branch it. If someone has already done that I'm happy to merge their PR
@clonemeagain
that would be more then awesome <3 We have also issues using your awesome plugin with v1.15.1 - if it would work, it would be such a great help :)
Adding collaborators over "@" works without a problem, but trying to use "#" for E-Mail notifications gives us this after creating the comment-post:
**Fatal error:** Uncaught InvalidArgumentException: User expected in /var/www/vhosts/xyz.com/httpdocs/include/class.user.php:1460 Stack trace:
#0 /var/www/vhosts/xyz.com/httpdocs/include/plugins/mentioner/class.MentionerPlugin.php(92): UserList->add(Object(Staff))
#1 /var/www/vhosts/xyz.com/httpdocs/include/plugins/mentioner/class.MentionerPlugin.php(48): MentionerPlugin->checkThreadTextForMentions(Object(ResponseThreadEntry))
#2 /var/www/vhosts/xyz.com/httpdocs/include/class.signal.php(98): MentionerPlugin->{closure}(Object(ResponseThreadEntry), NULL)
#3 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(1806): Signal::send('threadentry.cre...', Object(ResponseThreadEntry))
#4 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(1812): ThreadEntry::create(Array)
#5 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(2992): ThreadEntry::add(Array)
#6 /var/www/vhosts/xyz.com/httpdocs/include/class.thread.php(3175): Respons in /var/www/vhosts/xyz.com/httpdocs/include/class.user.php on line 1460
Hey anyone here using this plugin on the latest version? Does it work for you with those fixes?
- https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11#issuecomment-573572279
- https://github.com/clonemeagain/osticket-plugin-mentioner/issues/11#issuecomment-778804103
i am using it only in older versions.. why i must upgrade if are workinig.. and there's not security issues.. for that i can patch the code.. its php!
Has anyone had any luck getting this to work with v1.16.x? Tried the above fixes but the #mentions are still throwing an error. Just get an internal server error 500. Interestingly nothing shows up in any php logs.
Hello @VonSchnitzel Have you already seen https://github.com/clonemeagain/osticket-plugin-mentioner/issues/15 ? Have you already tried the forked version at https://github.com/bobweston/osticket-plugin-mentioner ? Hope this may help.
Hey @XKa-MSF-OCB . Thanks yeah I tried your fix for the function and also just tried directly from bobweston's fork. Interestingly using the forked version gave me an actual PHP error this time:
Uncaught InvalidArgumentException: User expected in /include/class.user.php:1476
Not sure what's causing this or how to fix it but it must be something unique to our setup if it works for others.