*

Recent

Author Topic: Favorites delete  (Read 6729 times)

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Favorites delete
« on: August 30, 2011, 05:37:43 PM »
Basically what this mod does is add an X on the right side of each favorite you have allowing you to delete them if you accidentally added them to favorites or if you really dont like it anymore.

Search for
Code: [Select]
function favorites(){
Add this Before
Code: [Select]
function deletefavorite(){
global $domain, $db, $usrdata;
$in1 = $db->query(sprintf('SELECT * FROM dd_games WHERE ID=\'%u\'', $_GET['deleteID']));
$in = $db->fetch_row($in1);
$gamename = ereg_replace('[^A-Za-z0-9]', '', $in['name']);

echo '<div class=\'msg\'>Are you sure you want to remove the game '.$gamename.' from your favorites?<br>
<a href=\''.$domain.'/index.php?action=myaccount&cmd=favorites&deletename='.$gamename.'&deleteID='.$_GET['deleteID'].'\'>Yes</a> &nbsp; <a href=\''.$domain.'/index.php?action=myaccount&cmd=favorites\'>No</a></div>';

}

Under function favorites(){ where it says global add this to it after seo_on and before the ;
Code: [Select]
, $template
Search for
Code: [Select]
function favorites(){
global $domain, $db, $usrdata, $thumbsfolder, $gamesfolder, $seo_on, $template;

Add this after
Code: [Select]
if ( isset ( $_GET['deleteID'] ) && !empty ( $_GET['deleteID'] ) ) {
mysql_query('DELETE FROM dd_user_favorites WHERE userid=\''.$usrdata['userid'].'\' AND gameid=\''.$_GET['deleteID'].'\'');
echo '<div class=\'msg\'>Deleted '.$_GET['deletename'].' from your favorites.</div>';
}

search for
Code: [Select]
<a href=\''.$playlink.'\' class=\'playlink\'><b>Play</b></a></td>
Add in line after </a>
Code: [Select]
';
mysql_query('DELETE FROM dd_user_favorites WHERE ID='.$in['ID'].'');
echo'<div style="float: right; padding-right: 20px;"><a href=\''.$domain.'/index.php?action=myaccount&amp;cmd=deletefavorite&amp;deleteID='.$in['ID'].'\'><img src=\''.$domain.'/templates/'.$template.'/images/deletebtn.png\' border=\'0\' alt=\'\' /></a></div>

Search for
Code: [Select]
case 'favorites':
favorites();
break;

Add after
Code: [Select]
case 'deletefavorite':
deletefavorite();
break;


Ok that should be all that is needed to be added to delete favorites. If im missing something or if it doesnt work let me know



kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Favorites delete
« Reply #1 on: September 01, 2011, 10:30:07 AM »
Looks good so far. Have to test it out when we get a chance. Thanks!

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Favorites delete
« Reply #2 on: September 01, 2011, 04:29:02 PM »
No problem i figured this was a needed feature and i will be figuring out how to make it so you can only add a certain game to your favorites once where as now u can just continue adding it and youll have a bunch of doubles

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Favorites delete
« Reply #3 on: September 01, 2011, 09:37:58 PM »
That shouldn't be too hard, just add in a query to see if there is already a favorite set with that userid/gameid combo, and reject it if there is, or add it if there is not.

We like to do things around here in a logical order so that we don't have to go back and recode things multiple times, and we seem to be bogged down in trying to get people to help with translating the next release. So it will have to wait if its left up to us I'm afraid :p

Thanks!

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Favorites delete
« Reply #4 on: September 01, 2011, 10:02:26 PM »
translating to different languages? Why not try using the google page translator it will translate all the text on a web page to whatever language you want. Also when i get the only allow adding a game to favorites once working ill post it here aswell

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Favorites delete
« Reply #5 on: September 02, 2011, 02:46:44 AM »
Well, we didn't want to be relying on an outside party for the translation for one. And Google doesn't always get it right anyways. Plus, doing it this way allows the webmaster to set it up in their own language natively rather than in English with a translate button, or even modify it fairly easily.

Thanks, will be looking forward to seeing it.

Dillon

  • Developer
  • Sr. Member
  • ******
  • Posts: 340
  • Force: +3/-0
    • Arcade Freak
Re: Favorites delete
« Reply #6 on: September 02, 2011, 12:52:00 PM »
well i didnt mean actually adding a translate button i ment using that to help make the language packs. If no one wants to help make the language packs then whoever needs them will just have to deal with it not being fully correct and they could come here and tell you what to fix if they're at all great full for the work your doing here

kurt

  • Developer
  • Hero Member
  • ******
  • Posts: 634
  • Force: +16/-1
Re: Favorites delete
« Reply #7 on: September 03, 2011, 11:47:25 AM »
Now there is an idea that had not cross our minds. Might have to give it a try and see how it works. Thanks for the idea