Trick for turning on auto-APPROVED reporting in ushahidi


#1

I know a LOT of people have been asking for a trick to make the default setting in ushahidi be that all reports appear on the public website WITHOUT requiring prior approval. My buddy wrote a script (about 3 lines) that WORKS (we think, but then again nobody is submitting reports.).


What it does is check every 30 minutes (using a cron job on bluehost) whether the database contains any reports that are less than 30 minutes old that have not been approved. If so, it updates the status to say approved. And viola! New reports appear. This also allows you to un-approve a report without deleting it after it is 30 minutes old, and the cron job hack won't interfere.


Not a bad use of 3 lines of code. Here is the script:

======================================


#!/bin/sh

mysql -D globamh1_kamukunji -u [your_db_username] --password=********** -e 'update

incident set incident_active=1 where incident_active=0 and timediff(now(), incident_dateadd) < time("00:30:00")'


======================================


You will need to tailor it to your instance. Here is what the parts mean:

globalmh1_makukunji = change to the name of your database

[your_db_username] = change to the username that had write access to the database for ushahidi


This script worked on bluehost. Bluehost.com has a cron job scheduler on the control panel.


BTW - it seemed to work when we tested it, but I haven't seen what else this might do to ushahidi over the long run. Use at your own risk.



#2

Or simply jump to applicationcontrollersreports.php, go to around line 367 where it says:


// STEP 3: SAVE CATEGORIES


Go up 3 lines, and change:


$incident->save(); // There are 2 of these - Dont just search


To:


$incident->incident_active = 1;

$incident->save();


Enjoy!


- Reelix



#3

The platform has had this ability for quite some time without a code hack. Please follow the instructions here https://github.com/ushahidi/Ushahidi_Web/issues/817#issuecomment-8209766 to auto approve reports.


#4

We went into the Admin section of Ushahidi as you directed for this built in option and when we follow those directions this is what we get as a error;

Parse error: syntax error, unexpected T_FUNCTION in /home/tpu/public_html/ushahidi/application/views/admin/manage/actions/main.php on line 297