Go Back   Pligg Forum > Pligg Development > Pligg Mods
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-07-2007, 11:35 AM
eH9116 eH9116 is offline
Casual Pligger
 
Join Date: Jan 2007
Posts: 50
Downloads: 5
Uploads: 0
Thanks: 4
Thanked 32 Times in 7 Posts
Spam Report Button w/ Inaccurate Story Label

I know this is one feature that has been requested for a while and I know that Ash is apparently working on or finished with something similar. Since I am not an outstanding PHP programmer by any means, you will be REPLACING THE "TELL A FRIEND" FUNCTION. If you're cool with that, then this is for you. After it has been reported as spam, there will be text shown before the story summary: [Reported as inaccurate] and when you visit the story itself it will be above the header in red.
Example: http://strandalo.us/ , look at the first link and click on the story to see what shows up.

1. Ok, first thing you need to do: convert one of the extra link_field's to INT. I used link_field9 for no particular reason, but you can use whichever you want. Go into your "pligg_links" table and edit the STRUCTURE of link_field9 to be, TYPE: INT, LENGTH: 11, DEFAULT: 0 and save it.

2. Open up /recommend.php. Add the following lines:

Line 80, find $to = ""; and replace it with:

Code:
$db->query("UPDATE " . table_links . " set link_field9=link_field9+1 WHERE link_id=$link->id");
$to = "spambot@yourdomain.com";
change the email address to wherever you want the notifications sent.

Line 101, find $subject = Email_Subject . $link->title; and change it to:

Code:
$subject = '"' . $link->title . '" - ' . $_REQUEST['email_message'];
Line 108, find $body = $message . "\r\n" . Incl.... and replace with:

Code:
$body = "URL: " . $link_url . "\nTitle: " . $link->title . "\nDescription: " .  $link->content . "\nUser: " . $current_user->user_login;
3. Ok, now open /templates/yourtemplate/recommend_small.tpl and replace the entire code with the following:

Code:
<form name="email_to" method="get" action="{$my_base_url}{$my_pligg_base}/recommend.php">
  <fieldset style="width: 100px;">
  <legend>Report Spam</legend>
  <input type="text" style="display:none" readonly="readonly" name="email_address_1" size = "25" id="email_address_1_{$link_shakebox_index}" value="spambot@strandalo.us">
  <p>Type:</p>
  <select name="email_message{$link_shakebox_index}" id="email_message{$link_shakebox_index}">
  <option value="Spam">Spam 
  <option value="Duplicate">Duplicate 
  <option value="Unreleased">Unreleased 
  <option value="Wrong Platform">Wrong Platform
  <option value="Incorrect Date">Incorrect Release Date
  <option value="Other">Other Inaccurate Information
  </select>
  <!--<textarea readonly="readonly" name="email_message{$link_shakebox_index}" id="email_message{$link_shakebox_index}" cols="19" rows="1">User: {$user_logged_in}</textarea>-->
  <input type="button" name="email_to_submit" value="Submit" onclick="emailto({$link_id}, {$link_shakebox_index}, '{$instpath}', 1);" class="log2">
  </fieldset>
</form>
You will want to edit the code to your liking, but what this does is create a drop down box of choices for the user to report the link as. Obviously, you should remove or add any <option value="... tags as you want, but I wouldn't change much else.

4. Open templates/yourtemplate/link_summary.tpl and add the following code on Line 2:

Code:
{if $pagename eq "story" && $link_field9 neq 0}
<br /><a style="padding:5px;border:1px solid #FF0000;font-size:18px;color:#FF0000;"><img STYLE="position:relative; TOP:8px;" src="/templates/digitalnature/images/cross.png">&nbsp;Game was reported as possible spam, a duplicate, or inaccurate!</a><br /><br />
{/if}
If you want the text only to show up when a certain number of users have designated it as spam, change the "neq 0" to something like "> 3" so it will only display when more than 3 people have claimed it as spam. Also notice the cross.png file that I have used, you can either borrow mine or remove the cross, also be sure to change the text to fit your site.

On Line 92, before {if $isadmin eq "yes" .... put the following:

Code:
<span id="spam"> | <a style="color:#d01c23" href="javascript://" onclick="show_hide_user_links(document.getElementById('spam-{$link_shakebox_index}'));">Spam!</a>
</span>
at Line 105, between </span> and <span id="ls_adminlinks-{$li..., put the following code:

Code:
{if $user_logged_in neq ""}
		
		<span id="spam-{$link_shakebox_index}" style="display:none;">
		  &raquo; <a href="javascript://" onclick="show_recommend({$link_id}, {$link_id}, '{$instpath}');">Report Spam</a>		 	  
		 </span>
		{else}
		
		<span id="spam-{$link_shakebox_index}" style="display:none;">
		  &raquo; You must be logged in.		 	  
		 </span>
		{/if}

then goto Line 193, where it says {if $Enable_Recommend eq 1} and remove everything from that line to the line before {if $story_status ne 'di...., so you should now have at Line 193:

Code:
{if $Enable_AddTo eq 1}
  			| <a href="javascript://" onclick="var replydisplay=document.getElementById('addto-{$link_id}').style.display ? '' : 'none';document.getElementById('addto-{$link_id}').style.display = replydisplay;">{#PLIGG_Visual_LS_AddThisLinkTo#}</a>
{/if}	
{if $story_status ne 'discard' && $link_shakebox_currentuser_votes eq 0 && $link_shakebox_currentuser_reports eq 0}
     {if ....
Now, go back to about Line 131 where you will find {checkActionsTpl location="tpl_link_summary_pre_story_content"}, directly after that put the following:

Code:
{if $link_field9 neq 0 && $pagename neq "story"}<b>[Reported as possible Spam/Duplicate/Inaccurate]</b>{/if}
It should be noted that you can change the "neq 0" to ">3" so that it will only show up when more than 3 people have reported it as spam.

You don't need to worry about enabling link_field9 in extra_fields.php, so that should be it! A couple of notes:

- The format of the email can be changed in recommend.php to your liking.
- If something is reported falsely as spam, be sure to edit the value of link_field9 back to 0 in "pligg_links" or maybe -1000 if people are insisting that it is spam.
- This works on Pligg Beta 9 with the DigitalNature template. I am not sure how well it will work on other versions and other templates, but I would imagine it should not be too much of a problem, it can't hurt to try it out, just backup your files first and post here to let me know what works/doesn't!

I will include the three files that I have edited below: "recommend.php" and "recommend_small.tpl" should be exactly as edited above, so feel free to use those two files, but only use "link_summary.tpl" for REFERENCE because I have made many other changes to it that you may not want. Simply make changes to YOUR link_summary.tpl file in step 4 of my process. Be sure to MAKE BACKUPS of these 3 files before you do this and I hope you enjoy it! Please leave any comments or feedback as it is possible that I have left something out since it is a lot of changes and I may have missed one. Enjoy!
Attached Files
File Type: zip Spam.zip (5.9 KB, 41 views - Who Downloaded?)

Last edited by eH9116 : 03-07-2007 at 11:41 AM.
Reply With Quote
The Following 8 Users Say Thank You to eH9116 For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 03-09-2007, 10:09 PM
Geoserv Geoserv is offline
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 855
Downloads: 60
Uploads: 0
Thanks: 75
Thanked 49 Times in 45 Posts
Thanks for the mod. Why can;t we have this and "Tella Friend" at the same time?

Geoserv
Reply With Quote
  #3 (permalink)  
Old 03-10-2007, 05:45 AM
diablo diablo is offline
Casual Pligger
 
Join Date: Nov 2006
Posts: 44
Downloads: 7
Uploads: 0
Thanks: 6
Thanked 11 Times in 4 Posts
yeah man,
craziest mods i ever saw here
your mod - my games - needs so many changes, but it will be the same effect if i click VOTE - and then those news goes to my profile as - news i voted for -
and why we need to replace functions???
report function is better just dropdown menu with ajax call.
like boddit.com, or dealspl.us whatever
Reply With Quote
  #4 (permalink)  
Old 03-13-2007, 07:51 AM
Geoserv Geoserv is offline
Banned
Pligg Version: 9.8.
Pligg Template: Custom
 
Join Date: Feb 2007
Location: Canada
Posts: 855
Downloads: 60
Uploads: 0
Thanks: 75
Thanked 49 Times in 45 Posts
Does anyone know if there is a way to do both? Perhaps using a different field number.

Geoserv.
Reply With Quote
  #5 (permalink)  
Old 03-25-2007, 08:05 PM
diablo diablo is offline
Casual Pligger
 
Join Date: Nov 2006
Posts: 44
Downloads: 7
Uploads: 0
Thanks: 6
Thanked 11 Times in 4 Posts
after a closer look
i found that you need to change few files:
recommend.php and recommend_small.tpl also xmlhttp.js and xmlhttp.php

copy and rename those files as recommend.php ->reportstory.php
and recommend_small.tpl -> reportstory.tpl
do all changes in these files.
and change form action in reportstory.tpl to
<form name="email_to" method="get" action="{$my_base_url}{$my_pligg_base}/reportstory.php">
and onclick="emailto to onclick="emailtospam

then look for function show_recommend and emailto
they are in xmlhttp.js and xmlhttp.php

just duplicate and rename those functions to show_spam and emailtospam
and you will see that you have to change file names in those functions as well.
look for old names - recommend -

then just change that Report spam link in link_summary.tpl from onclick="show_recommend to onclick="show_spam

and yahoo
__________________
-...-

Last edited by diablo : 03-25-2007 at 08:11 PM.
Reply With Quote
The Following User Says Thank You to diablo For This Useful Post:
  #6 (permalink)  
Old 03-29-2007, 09:31 PM
IPopu IPopu is offline
New Pligger
 
Join Date: Mar 2007
Posts: 22
Downloads: 10
Uploads: 0
Thanks: 3
Thanked 0 Times in 0 Posts
Has any one developed a method to maintain both the tell a friend feature as well as this feature yet? Or any tips on adequately doing so?
Reply With Quote
  #7 (permalink)  
Old 03-29-2007, 11:37 PM
onelessthang's Avatar
onelessthang onelessthang is offline
Constant Pligger
 
Join Date: Feb 2007
Location: Dallas, TX - USA
Posts: 120
Downloads: 3
Uploads: 0
Thanks: 39
Thanked 32 Times in 16 Posts
IPopu

diablo post describes what you need to do to have both. Now if only I would take the initiative and combine the two into one on the Pligg Wiki

Be Well,
OneLessThang
Reply With Quote
  #8 (permalink)  
Old 04-05-2007, 12:05 AM
MobileFreak MobileFreak is offline
Casual Pligger
 
Join Date: Mar 2007
Posts: 32
Downloads: 11
Uploads: 0
Thanks: 6
Thanked 1 Time in 1 Post
Allow reporting only once?

I'm trying to extend this mod by having a feature that allows a user to report a link only once (basically it'd be like voting ) ... So if a user has already reported a link, the Report Spam button for him for that particular link would be disabled.

It would be great if someone could provide me with info on where to start and what to look for to do this - would save me some time !! (I've just started playing around with Pligg for the last few days)
Reply With Quote
  #9 (permalink)  
Old 04-05-2007, 12:10 AM
Yankidank's Avatar
Yankidank Yankidank is offline
Send a message via AIM to Yankidank Send a message via Skype™ to Yankidank
Pligg Founder
Pligg Version: 9.9
Pligg Template: Blue Green Str
 
Join Date: Dec 2005
Location: Savannah, GA
Posts: 1,359
Downloads: 58
Uploads: 6
Thanks: 88
Thanked 139 Times in 93 Posts
MobileFreak: you should try out the latest SVN version of Pligg. It has a "bury" function that might be what you're looking for. Check out the Pligg Demo (which is running an SVN version from a few weeks ago) to see it in action.
__________________
Need a Pligg Host?
Get 3 free months
when you buy a year of hosting.
Use the coupon PLIGG at either...
MidPhase hosting starting at $7.95/month.
ANhosting hosting starting as low as $4.95/month.
Reply With Quote
  #10 (permalink)  
Old 04-05-2007, 12:28 AM
MobileFreak MobileFreak is offline
Casual Pligger
 
Join Date: Mar 2007
Posts: 32
Downloads: 11
Uploads: 0
Thanks: 6
Thanked 1 Time in 1 Post
Thnx ! Will try that out right away
Reply With Quote
Reply



Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
Report button rhythm General Help 3 08-05-2007 03:02 AM
7.1 bug report: who voted for this story Linlay Bug Report 2 05-06-2006 05:42 PM
Idea for scalable story promotion jvallery Core Development 6 04-18-2006 08:41 PM


LinkBacks Enabled by vBSEO 3.0.0