We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Here is my Moderator Log Project | Forum

dave Leader
dave Dec 13 '13

Several times now i have had moderaters argue about who did what regarding members.  So i came up with a very basic format.


Disclaimer:  Yes this works but it is very basic, for now it only works when you delete a member. I have not yet found a general place where i can build a function to pass all user events through.  So for now i will just have to pick and choose which events i want to record and post this code in that event function. 


So there are lots of things on the todo list for now, but again i have tested this for the delete user option from userside member display and it works.


My plan is to add it to all of the following events userside and admin side: 

delete user,

approve,

suspend,

check IP (ip tracker plugin) this will confirm that moderators checked the ip,

change role,

change password,

delete another users content (image, video, forum post, etc.. )


and that is a good start...   I hope that Oxwall comes out with something in the next version or so for this. You have a ox_logs dir but nothing in there.


Also if anyone wants to help please do...


So far this is what i have that works...


This works for delete user only for now..


1. create a text file in ow_logs named modlog.txt  with permissions at least 666


2. edit ow_system_plugins/base/bol/user_service.php


find this code (about line 671)


public function deleteUser( $userId, $deleteContent = false )
{


and add AFTER the {  this code


// added for modlog
           
            //get date
            $logdate = date('Y-m-d');
            $logtime = time();  

        

            //get user displayname of the user being deleted
             $logusername = $this->getDisplayName($userId);
  
           //get moderator name of the mod doing the delete

           // TODO need to pass the moderator user id here from the initiating file in order to post the mod info here rather than admin
            $moduser = 'admin';


            //set the name of the log file and location

            $modlogfile = 'ow_logs/modlog.txt'; 

         

           // Lets make sure the file exists and is writable first
           if (is_writable($modlogfile))
           {
             // The data to add to the file
             $logdata = $logusername. "-" . $userId . " was deleted by ". $moduser . " on " . $logdate . " at " . $logtime . "\n";

            

             //update log file
             file_put_contents($modlogfile, $logdata, FILE_APPEND | LOCK_EX); 

           

          }else{

                    // TODO create a else error process here, since the process is running of a inline confirm alert, not sure we can just say return or not
                 //cannot get the else to work regarding display of message or return false
                // throw new InvalidArgumentException('Log File Failure - user not deleted!');               
                // return false;
               }

    // end of add



make sure the origional delete process for this function is here in this area


then save the file


here is the sample of the contents of the text file..


Geert-10 was deleted by admin on 2013-12-13 at 1386936743


If you would like to help please lets figure out the error display first, i was not able to get that to work correctly if the file is not writable. 


The Forum post is edited by dave Dec 13 '13
dave Leader
dave Dec 20 '13
I have actually given this idea to a dev and they are currently working on a plugin for this. :)
dave Leader
dave Jan 21 '14

Looks good Thao,


Great Job, looks like a solid base and i like the way you trapped the queries.  So what is the next step? What did you have planed?  Do you want me or someone to try to finish the plugin files up and submit it for approval, i would like to see this as a free plugin if possible. 

dave Leader
dave Jan 23 '14
excellent thank you so much for this :)
S. Bourdon
S. Bourdon Apr 30 '14
Is this plugin still in development? 
dave Leader
dave May 1 '14
have not done much with it due to my health lately.   As you can see i was working with Thao Le on this and his last post is where we left off i believe.  
Oxwall Accessories
Oxwall Accessories May 1 '14
If you dont mind this is something we would like to maybe look into. 
dave Leader
dave May 1 '14
I dont mind, as long as i get a free copy with upgrades when your done.  I cant speak for Thao Le but i think he might be ok with it, last i heard he didnt have much time to do this, but shoot him a msg anyway to check, if  you dont here from him in 2 weeks then i would say go for it.   


is that a deal free copy ?

Oxwall Accessories
Oxwall Accessories May 1 '14
of course dave. I was actually going to offer you a free plugin regardless for the help you provide people around here. Let me know what one you want and Ill grant you a license. 
dave Leader
dave May 2 '14
No big deal buddy and i appreciate that, lets do it this way i would feel better.  If you happen to develop this into a plugin then just toss me a license for a copy of it.  If not no worries, its all good :)
dave Leader
dave Apr 4 '15
Since noone including me has done anything with this, i am about a week from finishing this project finally.  I been working on it for a few days and have come a long way. Yeah i know but my health comes first. ill submit it to oxwall as soon as i have it done, im very close. 


Thanks dave 

The Forum post is edited by dave Apr 4 '15
dave Leader
dave Apr 4 '15
here is a sample 





S. Bourdon
S. Bourdon Apr 5 '15
Very interesting!

Keep up the good work!  ;)


PS: Is the "delete another users content (image, video, forum post, etc.. )" option available?


Many thanks!

dave Leader
dave Apr 5 '15
Thanks for the nice words.  


Those options are available if you are a admin or moderator.  I did have to remove the Password change and the avatar change because that is part of the admintools plugin from Mr. Puru and i dont want to have this first version require any other plugins in order to run. It would be unprofessional of me to add those feature codes as he has the plugin for that and it would just be wrong and unethical to do so. 


Now later when we get the bugs worked out and get some solid ground then we can add those options back just as optional if you happen to have the admintools plugin.  


The first version i really want to only address those features and options that are available via the core install, that way anyone can run this plugin and it will be effective.


I also thought about including a button to clear the log but changed my mind as if someone wanted to cover their tracks they could exploit that feature.  So the only way to clear the log is to truncate the table via phpMyAdmin.    

The Forum post is edited by dave Apr 5 '15
S. Bourdon
S. Bourdon Apr 5 '15
Thank you for these informations.  I really appreciate it!


By the way, are you still interested in releasing it as a free plugin?

Will your plugin be compatible with older versions of Oxwall (1.5.3 in my case)?


Again, many thanks!

dave Leader
dave Apr 5 '15
I dont have a dedicated dev area for oxwall im building this using my live site which is current version so i would guess it would be ok but i really dont know about 1.5.3 


That was my original plan was to offer it cheap or free, but i may need to pay for some help, i am stuck at the moment and i have asked a dev if they could help for a fee. If i have to pay to get this done then of course i cant offer it for free.  So we will see.  I do know one thing, this is my first experience with PDO and i dont like it.  I have done plugins and modules for quite a few things and this is certainly the most challenging.  Oxwall claims development is easy to do, i beg to differ with that statement. 

The Forum post is edited by dave Apr 5 '15
dave Leader
dave Apr 5 '15
I really need some docs on using ajax listener when it comes to oxwall objects and instances. I am not new to ajax but i am totally lost when applying it to oxwall plugin.  


I have a ajax php file in controllers dir  with the ajax class that extents the OW_ActionController  but after that im totally lost. 


If i wanted to capture an instance would i just do something like this in the ajax file?


public function isfeat ()

{

 $isfeat = BOL_UserService::getInstance()->markAsFeatured();

 }


and if so do i need to set up a route for this ajax file in init?

and where do i call the isfeat function from or does it call itself since its an ajax file?


i am hopelessly lost here... 


are there any docs at all on using ajax and oxwall ?

dave Leader
dave Apr 9 '15
http://www.oxwall.org/store/item/1067  its done waiting for approval.   There were three things i left off because i still need to learn those.  


One is avatar (you will need the admin tools plugin from puru) 

The other one is roles (i could not figure this part out yet)

The other one is photo edit (again will take me some time to figure this out)  


All three of those ill have to hook into the plugin itself and not the system and thats where i need i need to learn to do that. 


So those three will be on the next version. But gosh there is plenty of stuff on this regarless.  And more to come. 


We will see how i do first time thru the oxwall approval process.  

Its $5.00 i could not do it for free as i wanted to, i do apologize for that.   But once i get up and running with plugins i will do a free plugin, you have my word on that one :) 

The Forum post is edited by dave Apr 9 '15
dave Leader
dave Apr 9 '15

cool beans folks, now i have learned to do the avatar without requiring the admin tools plugin (which is a great plugin by puru by the way) and i have also learned to do the events and also the photo and roles.   So those have been added and i have updated my zip file for oxwall review team.


Also i am considering adding the password but im not sure yet.


Anyway so we are full speed ahead here so far.   Just wanted to share.  :)

The Forum post is edited by dave Apr 9 '15