Buenas, tengo la siguiente duda:
En varios mods, como la tienda, si haces 'x' acción, y recibes un mensaje privado, está configurado para que reciba el mensaje privado del usuario con id 1 (eso entiendo)
Facilitando el siguiente fragmento de código, ¿cómo podría hacer que el MP lo envíe el usuario, por ejemplo, con id 2?
// Who is receiving the IM
$pmto = array(
'to' => array($row['ownerid']),
'bcc' => array()
);
// The message subject
$subject = sprintf($txt['shop_im_trade_subject'], $row['name']);
// The actual message
$message = sprintf($txt['shop_im_trade_message'], $context['user']['id'], $context['user']['name'], $row['name'], formatMoney($row['tradecost']));
// Send the PM
sendpm($pmto, $subject, $message, 0, $pmfrom);
$context['shop_buy_message'] = sprintf($txt['shop_trade_bought_item'], $row['name'], $row['real_name']);
Entiendo que sea cosa de la variable $pmfrom, ¿debo crear otra que indique la id 2, o hay alguna posibilidad de especificar la id en esa variable?
Gracias.
según smf
array sendpm(array recipients, string subject, string message,
bool store_outbox = false, array from = current_member, int pm_head = 0)
- sends an personal message from the specified person to the
specified people. (from defaults to the user.)
- recipients should be an array containing the arrays 'to' and 'bcc',
both containing id_member's.
- subject and message should have no slashes and no html entities.
- pm_head is the ID of the chain being replied to - if any.
- from is an array, with the id, name, and username of the member.
- returns an array with log entries telling how many recipients were
successful and which recipients it failed to send to.
lo que te interesa
Quote- from is an array, with the id, name, and username of the member.
entonces tu $pmfrom seria
$pmfrom= array(
'id'=> 2,
'name'=>'nombre',
'username'=>'username',
);
Definido el array no hay ningún problema. Muchas gracias por la ayuda ;)