- Posts: 13
- Thank you received: 0
Kunena 7.0.2 Released
The Kunena team has announce the arrival of Kunena 7.0.2 [K 7.0.2] in stable which is now available for download as a native Joomla extension for J! 5.3.x/5.4.x/6.0.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0
Question [Solved] Report to moderator through the PM-system not email
16 years 4 months ago - 15 years 11 months ago #32319
by john7p
Hello,
Like others I found that it would be usefull to use the "report to moderator" function through the installed PM system.
After some digging in the source i found that the funtionality is there.
At least for the "Clexus PM" system. I don't know if it is active tough.
For the PM-system I am using "UddeIM" the prepwork has been done. But the final function is not in place.
As seen in the file "\components\com_kunena\template\default\plugin\report\report.php"
at line 184
Below that at line 283 the funtion SendClexusPM() is there.
Is there a wizzard aboard who likes to finish or create the final funtion SendUddeIM()? I am no scriptkiddy outherwise I would finnish it.
Thanks for reading my boring msg :laugh:
Greetings from a rainy
Holland
John
___________
I am trying myself now. :S
Is there progres? Oh yes.....
I have changed at line 31 the $type to '1' and the function is executed.
I just have to get the query to the database right.
I will post further progres later :lol:
Like others I found that it would be usefull to use the "report to moderator" function through the installed PM system.
After some digging in the source i found that the funtionality is there.
At least for the "Clexus PM" system. I don't know if it is active tough.
For the PM-system I am using "UddeIM" the prepwork has been done. But the final function is not in place.
As seen in the file "\components\com_kunena\template\default\plugin\report\report.php"
at line 184
Code:
case 'uddeim':
SendUddeIM();
break;
Below that at line 283 the funtion SendClexusPM() is there.
Is there a wizzard aboard who likes to finish or create the final funtion SendUddeIM()? I am no scriptkiddy outherwise I would finnish it.
Thanks for reading my boring msg :laugh:
Greetings from a rainy
John
___________
I am trying myself now. :S
Is there progres? Oh yes.....
I have changed at line 31 the $type to '1' and the function is executed.
I just have to get the query to the database right.
I will post further progres later :lol:
Last edit: 15 years 11 months ago by sozzled. Reason: Changed subject to improve search relevance
Please Log in or Create an account to join the conversation.
16 years 4 months ago - 16 years 4 months ago #32404
by john7p
Replied by john7p on topic Succes !! Report to moderator through the PM-system UddeIM
Just to let you know 
I made great progress. After some trail and error I got a report out.
UddeIM 1.9 has an API onboard so you can send an IM with just a little coding.
Attached is my \components\com_kunena\template\default\plugin\report\report.php
My coding is not that spectacular, and I had to leave out some blocks of code that didn't respond correctly for my situation.
I am running a localhost to learn. I got some 20 users and the admin is the moderator.
I made the next changes:
At line 32 I added:
I did this because I could not find the place where "type" (line 31) was set
At line 162 I changed:
$sender into $reporter
Because UddeIM uses the id-number and not the name. otherwise the IM originates from "Public-Users" (ID=0)
At line 185 I changed for the correct funtion-call:
This is the function:
When executing collecting the admins-list and the moderators-list from line 99, they turn up empty so there is no recipient. So I hardcoded $admin here.
Perhaps de Devs could incorparate this in the next release. And cleanup some of my coding.
It was a nice puzzle.
Greetings John
I made great progress. After some trail and error I got a report out.
UddeIM 1.9 has an API onboard so you can send an IM with just a little coding.
Attached is my \components\com_kunena\template\default\plugin\report\report.php
My coding is not that spectacular, and I had to leave out some blocks of code that didn't respond correctly for my situation.
I am running a localhost to learn. I got some 20 users and the admin is the moderator.
I made the next changes:
At line 32 I added:
Code:
$type = '1';
I did this because I could not find the place where "type" (line 31) was set
At line 162 I changed:
$sender into $reporter
Because UddeIM uses the id-number and not the name. otherwise the IM originates from "Public-Users" (ID=0)
At line 185 I changed for the correct funtion-call:
Code:
SendUddeIM($reporter, $subject, $message, $msglink, $mods, $admins);
This is the function:
Code:
Function SendUddeIM($reporter, $subject, $message, $msglink, $mods, $admins){
require_once(JPATH_SITE.'/components/com_uddeim/uddeim.api.php');
$uddeim = new uddeIMAPI();
$admin = 62;
if (!$uddeim->isInboxLimitReached($toid)){
$uddeim->sendNewMessage($reporter, $admin, $message, 1, 1); }
}
When executing collecting the admins-list and the moderators-list from line 99, they turn up empty so there is no recipient. So I hardcoded $admin here.
Perhaps de Devs could incorparate this in the next release. And cleanup some of my coding.
It was a nice puzzle.
Greetings John
Last edit: 16 years 4 months ago by john7p. Reason: Upload file
Please Log in or Create an account to join the conversation.
16 years 4 months ago #32530
by john7p
Replied by john7p on topic Another question.
New development:
I tracked down the way $mod en $admin work.
I could not get the IM out for them.
I found that $mod uses $mod->userid, and $admin uses $amdin->id.
That was one to produce a headacke.
I came up with the next function:
And now where is the catch?
If a mod is an admin too, then he gets a message as mod and one as admin. One message is enough.
How do I check if a mod is or is not an admin?
I have tryed using array_search() but i could not get it to work.
Does anybody have any idee on how to fix this ???
Greetings John
I tracked down the way $mod en $admin work.
I could not get the IM out for them.
I found that $mod uses $mod->userid, and $admin uses $amdin->id.
That was one to produce a headacke.
I came up with the next function:
Code:
Function SendUddeIM($reporter, $subject, $message, $msglink, $mods, $admins){
require_once(JPATH_SITE.'/components/com_uddeim/uddeim.api.php');
$uddeim = new uddeIMAPI();
// to each admin
foreach ($admins as $admin) {
if (!$uddeim->isInboxLimitReached($admin->id)){
$uddeim->sendNewMessage($reporter, $admin->id, $message, 1, 1); }
}
// to each mod
foreach ($mods as $mod) {
if (!$uddeim->isInboxLimitReached($mod->userid)){
$uddeim->sendNewMessage($reporter, $mod->userid, $message, 1, 1); }
}
}
And now where is the catch?
If a mod is an admin too, then he gets a message as mod and one as admin. One message is enough.
How do I check if a mod is or is not an admin?
I have tryed using array_search() but i could not get it to work.
Does anybody have any idee on how to fix this ???
Greetings John
Please Log in or Create an account to join the conversation.
16 years 4 months ago - 16 years 4 months ago #32542
by xillibit
I don't provide support by PM, because this can be useful for someone else.
Replied by xillibit on topic Re:!! succes!! Report to moderator through the PM-system not email
Hello,
This is a good thing what you are develloping, i have not tested your code, i have just tried to modify a bit your function SendUddeIM(). I do a check on the file uddeim.api.php because in uddeim version before the 1.9, this file doesn't exist. I test if the user if a moderator and like that the pm is send, but i don't know if by default the administrator is set moderator too.
This is a good thing what you are develloping, i have not tested your code, i have just tried to modify a bit your function SendUddeIM(). I do a check on the file uddeim.api.php because in uddeim version before the 1.9, this file doesn't exist. I test if the user if a moderator and like that the pm is send, but i don't know if by default the administrator is set moderator too.
Code:
function SendUddeIM($reporter, $subject, $message, $msglink, $mods, $admins){
if(file_exists(JPATH_SITE.'/components/com_uddeim/uddeim.api.php')) {
require_once(JPATH_SITE.'/components/com_uddeim/uddeim.api.php');
}
$uddeim = new uddeIMAPI();
$kunena_db->setQuery("SELECT userid, moderator FROM #__fb_users");
$kunena_db->query();
$datas = $kunena_db->loadObjectList();
// to each users with moderator=1 this depends on the settings in the table jos_fb_users
foreach ($datas as $row) {
if($row->moderator == "1") {
if (!$uddeim->isInboxLimitReached($row->userid)){
$uddeim->sendNewMessage($reporter, $row->userid, $message, 1, 1); }
}
}
}
I don't provide support by PM, because this can be useful for someone else.
Last edit: 16 years 4 months ago by xillibit.
Please Log in or Create an account to join the conversation.
16 years 4 months ago #32545
by john7p
Replied by john7p on topic Re:!! succes!! Report to moderator through the PM-system not email
Thanks xillibit,
Thank you for the help.
I think my question is not that clear. I will try to explain:
Half of the work has already been done by the original code.
The moderators for the current forum catagory are already known through $mods
The administrators for the site are known through $admins
These two array's are handed down through the code originating from line 100
I need to compare the $mods->userid against the $admin->id
I created a foreach to send to the $admins
I now need a foreach to send to the $mods except if he is an admin.
Otherwise this mod gets double messages.
It should look somthing like this:
This is very simplified but this is what I need. Or rather what I think is needed.
Thank you for the help.
I think my question is not that clear. I will try to explain:
Half of the work has already been done by the original code.
The moderators for the current forum catagory are already known through $mods
The administrators for the site are known through $admins
These two array's are handed down through the code originating from line 100
I need to compare the $mods->userid against the $admin->id
I created a foreach to send to the $admins
I now need a foreach to send to the $mods except if he is an admin.
Otherwise this mod gets double messages.
It should look somthing like this:
Code:
foreach admin {sendmessage}
foreach mod
if (mod = admin {
//do nothing
else {
sendmessage}
This is very simplified but this is what I need. Or rather what I think is needed.
Please Log in or Create an account to join the conversation.
16 years 4 months ago - 16 years 4 months ago #32580
by john7p
Replied by john7p on topic Report to mod through the PM resolved double msg for mod=admin
Hello
How could I be so dumb. :blush: :blush: :blush:
Trying to develop something with the display-errors off at the serverside.
I noticed it after messing with array-functions.
Meanwhile I already wrote my own search function.
It was a good practice for a former dbase III plus/clipper programmer.
Here it is my solution. If someone can do it simpler using array() stuf be my guest :lol:
The question now is, do you want a Joomla Administrator to receive reports if he is NOT a Moderator. IF not, then cut-out the code you don't need.
@xillibit,
Thanks for your reply. Kick de Devs if you feel like it :lol: , and ask them if they would like to use this in a next release.
One question though:
Where is $type configured in line 31?
Is it hardcoded "0" somwhere or is it changed in the backend?
John
How could I be so dumb. :blush: :blush: :blush:
Trying to develop something with the display-errors off at the serverside.
I noticed it after messing with array-functions.
Meanwhile I already wrote my own search function.
It was a good practice for a former dbase III plus/clipper programmer.
Here it is my solution. If someone can do it simpler using array() stuf be my guest :lol:
Code:
Function SendUddeIM($reporter, $subject, $message, $msglink, $mods, $admins){
require_once(JPATH_SITE.'/components/com_uddeim/uddeim.api.php');
$uddeim = new uddeIMAPI();
// to each Joomla admin
foreach ($admins as $admin) {
if (!$uddeim->isInboxLimitReached($admin->id)){
$uddeim->sendNewMessage($reporter, $admin->id, $message, 1, 1);}
}
// to each mod
foreach ($mods as $mod) {
// If this moderator is NOT a Joomla administrator then proceed to sending msg
if (!is_admin($mod->userid, $admins)){
if (!$uddeim->isInboxLimitReached($mod->userid)){
$uddeim->sendNewMessage($reporter, $mod->userid, $message, 1, 1); }}
}
}//end of sendudeIM
Function is_admin($moderator,$admins){
foreach ($admins as $isadmin){
IF ($isadmin->id = $moderator){return true;}
}
return false;// moderator is not an Admin
} //end of is_admin
The question now is, do you want a Joomla Administrator to receive reports if he is NOT a Moderator. IF not, then cut-out the code you don't need.
@xillibit,
Thanks for your reply. Kick de Devs if you feel like it :lol: , and ask them if they would like to use this in a next release.
One question though:
Where is $type configured in line 31?
Is it hardcoded "0" somwhere or is it changed in the backend?
John
Last edit: 16 years 4 months ago by john7p. Reason: typo
Please Log in or Create an account to join the conversation.
Time to create page: 0.288 seconds