collapse

* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

Author Topic: [SMF Arcade 2.5 RC2] Assign Category when installing  (Read 264 times)

0 Members and 1 Guest are viewing this topic.

Offline thedukeisnotdead

  • Not So New
  • *
  • Posts: 19
  • Karma: 1
  • Gender: Male
[SMF Arcade 2.5 RC2] Assign Category when installing
« on: February 04, 2013, 01:57:38 AM »
Right now when we install the default category is set to 0.
 
Where is that code? I would like to change it to '1' which is our defualt, new games category.
 
Thanks
 

Offline thedukeisnotdead

  • Not So New
  • *
  • Posts: 19
  • Karma: 1
  • Gender: Male
Re: [SMF Arcade 2.5 RC2] Assign Category when installing
« Reply #1 on: February 04, 2013, 02:40:20 AM »
Ok, I found the code in the Subs-ArcadeAdmin:
 
I changed the 0 to a 1 and it shows up in the default category of 1. Problem is now, the category counter needs to be increased in the db.
 
Find:
 
Code: [Select]

// Creates new game. Returns false on error and id of game on success
function createGame($game)
{
 global $scripturl, $txt, $db_prefix, $user_info, $smcFunc, $modSettings;
 $smcFunc['db_insert']('ignore',
  '{db_prefix}arcade_games',
  array(
   'id_cat' => 'int',
   'internal_name' => 'string',
   'game_name' => 'string',
   'submit_system' => 'string',
   'description' => 'string',
   'help' => 'string',
   'enabled' => 'int',
   'num_rates' => 'int',
   'num_plays' => 'int',
   'game_file' => 'string',
   'game_directory' => 'string',
   'extra_data' => 'string',
  ),
  array(
   0,
   $game['internal_name'],
   $game['name'],
   $game['submit_system'],
   '',
   '',
   1,
   0,
   0,
   $game['game_file'],
   $game['game_directory'],
   '',
  ),
  array()
 );

Change to:
 
Code: [Select]
// Creates new game. Returns false on error and id of game on success
function createGame($game)
{
 global $scripturl, $txt, $db_prefix, $user_info, $smcFunc, $modSettings;
 $smcFunc['db_insert']('ignore',
  '{db_prefix}arcade_games',
  array(
   'id_cat' => 'int',
   'internal_name' => 'string',
   'game_name' => 'string',
   'submit_system' => 'string',
   'description' => 'string',
   'help' => 'string',
   'enabled' => 'int',
   'num_rates' => 'int',
   'num_plays' => 'int',
   'game_file' => 'string',
   'game_directory' => 'string',
   'extra_data' => 'string',
  ),
  array(
   1,
   $game['internal_name'],
   $game['name'],
   $game['submit_system'],
   '',
   '',
   1,
   0,
   0,
   $game['game_file'],
   $game['game_directory'],
   '',
  ),
  array()
 );


 
 
find:
 
Code: [Select]

  // Final install data
  $gameOptions = array(
   'internal_name' => $game['internal_name'],
   'name' => $game['name'],
   'description' => '',
   'thumbnail' => $game['thumbnail'],
   'thumbnail_small' => $game['thumbnail_small'],
   'help' => !empty($game['help']) ? $game['help'] : '',
   'game_file' => $game['file'],
   'game_directory' => $game_directory,
   'submit_system' => $game['submit_system'],
   'score_type' => $game['score_type'],
   'extra_data' => $game['extra_data'],
  );
  $success = false;
  if (!isset($game['error']) && $id_game = createGame($gameOptions))
     $success = true;

Change to:
 
Code: [Select]

  // Final install data
  $gameOptions = array(
   'internal_name' => $game['internal_name'],
   'name' => $game['name'],
   'description' => '',
   'thumbnail' => $game['thumbnail'],
   'thumbnail_small' => $game['thumbnail_small'],
   'help' => !empty($game['help']) ? $game['help'] : '',
   'game_file' => $game['file'],
   'game_directory' => $game_directory,
   'submit_system' => $game['submit_system'],
   'score_type' => $game['score_type'],
   'extra_data' => $game['extra_data'],
  );
  $success = false;
  if (!isset($game['error']) && $id_game = createGame($gameOptions))
  {
   $success = true;
   updateCategoryStats();   
  }
« Last Edit: February 04, 2013, 03:00:11 AM by thedukeisnotdead »