Que no cuenten créditos en un foro [SMF Shop]

Started by Diego Andrés, August 06, 2013, 02:31:42 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Diego Andrés

Hola amigos, hace un tiempo le ayudé a un usuario en SimpleMachines que preguntaba si se podía evitar que en un foro no se dieran créditos del MOD SMF Shop.
Bueno es muy fácil, tan solo hacemos lo siguiente ....




../Sources/Post.php

Buscamos:

// Begin SMFShop code

// New topic?
if ($newTopic)
$points = !empty($board_info['shop_pertopic']) ? $board_info['shop_pertopic'] : $modSettings['shopPointsPerTopic'];
else
$points = !empty($board_info['shop_perpost']) ? $board_info['shop_perpost'] : $modSettings['shopPointsPerPost'];

// Are bonuses allowed in this board?
// Strip out all BBCode
$plaintext = preg_replace('[\[(.*?)\]]', ' ', $_POST['message']);
// Convert all newlines into spaces
$plaintext = str_replace(array('<br />', "\r", "\n"), ' ', $plaintext);
// Convert multiple successive spaces into a single space
$plaintext = preg_replace('/\s+/', ' ', $plaintext);

// The bonus for each word...
$points += ($modSettings['shopPointsPerWord'] * str_word_count($plaintext));
// ...and bonus for each letter
$points += ($modSettings['shopPointsPerChar'] * strlen($plaintext));

// Is there a limit set, and are we over it?
if (isset($modSettings['shopPointsLimit']) && $modSettings['shopPointsLimit'] != 0 && $points > $modSettings['shopPointsLimit'])
// If so, set the number of points to the limit
$points = $modSettings['shopPointsLimit'];


Añadimos después:

if ($board == "ID DEL FORO EN EL QUE NO SE DARÁN COINS")
    $points = "0";


Tan solo cambiamos "ID DEL FORO EN EL QUE NO SE DARÁN COINS"  por la ID del foro.
¿Cómo se cuál es la ID del foro?

Muy fácil, accedes a un foro y en la URL verás esto: "index.php?board=8.0"
En este caso la ID sería 8

Y quedaría algo así:
if ($board == "8")
    $points = "0";


Bueno espero que les guste este pequeño tip  :D

Créditos: Cristian Ospina
Last Edit: August 20, 2019, 09:30:26 PM by Diego Andrés