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

Flagging | Forum

B.I.
B.I. Jun 22 '16
Hi yet again! As always I did a search and could not find my exact situation.

I'm looking to edit the Flagging option in Oxwall Software to allow me to add more reasons for flagging things. Right now if you flag something Oxwall gives the default:

"Flag this as...
SPAM
Offence
Illegal"

So multiple things wrong here; 'Offense" is spelled wrong, the Phrasing is off for my site's setup (which I know I can change the first two in Language, just pointing it out.), and I need more than just those three options.

Is there a way to add more custom options to the flagging feature?
Attachments:
  Flagging.png (10Kb)
dave Leader
dave Jun 22 '16
Yes of course but this is considered custom coding. 


 I originally thought maybe you could just add it to the db or just add it to a form option list in the php file, but thats not how its setup.  It would take more than just a few lines of code. 


Have a look at ow_system_plugins/base/views/controllers/flags_index.html


<tr><th style="width: 15%">{text key="base+flag_spam"}</th><th style="width: 15%">{text key="base+flag_offence"}</th><th style="width: 15%">{text key="base+flag_illegal"}</th></tr>



now you could certainly just add a new base key lang and add it so it would show like this here in the html file   {text key="base+flag_myspecialflag"}


but then what do you with it, you would have the write the code to process it on the list and also save it to the db.  It appears to be js based and i suck at js.  But the php file is not what i expected either.  Since it is in a loop you could test it out and see what happens maybe it will do it all for you after just adding the html, i have not yet tested or looked closely enough to know for sure. 


the other thing i might want to mention, is that if you are to the point of having to isolate flag types, maybe its time to just get rid of that member. 








The Forum post is edited by dave Jun 22 '16
dave Leader
dave Jun 22 '16
ok got it, i had to retype this because the token got me grrrr im really starting to hate that thing lol 


first you add the base lang key    i added  flag_abusive   - it has to start with flag_ ok  and it will wrap just so you know if you make it too long... 

i made mine  


Abusive to others  


 and it wraps 


then you go to ow_system_plugins/base/views/controllers/flags_index.html


and add the code to the list that is there 



<!-- added abusive -->
<th style="width: 15%">

{text key="base+flag_abusive"}

</th>



then save that and clear your cache. 


then go to ow_system_plugins/base/components/flag.php 



and you will see this code 


        $element->setOptions(array(           

 'spam' => OW::getLanguage()->text('base', 'flag_spam'),           

 'offence' => OW::getLanguage()->text('base', 'flag_offence'),           

 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'))

                    );


add abusive to the array but remember to move the last closeing ) to your new line and then add a comma to the prev line,  so its like this 



//added abusive 


        $element->setOptions(array(            

'spam' => OW::getLanguage()->text('base', 'flag_spam'),            

'offence' => OW::getLanguage()->text('base', 'flag_offence'),           

 'illegal' => OW::getLanguage()->text('base', 'flag_illegal'),           

 'abusive' => OW::getLanguage()->text('base', 'flag_abusive'))       

 );


and whallahhh its done... 








enjoy.. :)





The Forum post is edited by dave Jun 22 '16
ross Team
ross Jun 22 '16
Topic was moved from General Questions.
Oxwall Türkiye
Oxwall Türkiye Nov 8 '16
Dear Dave 

I applied it but I do not see any space to change the languageI added the required code to flag.phpThere is an option on the site popup screen.Does not appear in language pack

Attachments:
  2016-11-08_20-42-51.png (23Kb)
  2016-11-08_20-48-16.png (18Kb)
dave Leader
dave Nov 8 '16
You will need to create a new lang key for the custom entry.  Make sure you add it to base.
Oxwall Tips
Oxwall Tips Nov 9 '16
+1 to Dave's mode.

My instuctions from a while ago at https://skatips.wordpress.com/...-edit-existing-ones/ .

Overal can confirm that Dave's mode is working if done correctly.


The Forum post is edited by Oxwall Tips Nov 9 '16
dave Leader
dave Nov 9 '16
Thanks OT good to see you back around again.. :)