Pagina 1 di 1

Codice per MP

Inviato: 04/08/2013, 12:11
da Astro86
Ciao a tutti, volevo sapere che codici bisogna usare per far si che un utente riceva un MP... vi spiego meglio xD

sul mio forum (diciamo) ho un negozio a punti che ad ogni articolo che inserisco posso inserirci un file in php che ha diverse funzioni

ad esempio

Codice: Seleziona tutto

<?php
/**
*
* @package - phpbb3 UPS Easy Shop
* @version $Id: user_color_black.php 138 2010-02-22 10:39:40Z femu $
* @copyright (c) Wuerzi (http://spieleresidenz.de), (c) femu (http://die-muellers.org)
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/*
 * @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

class user_color_black extends item
{
	function init()
	{

	}

	function get_actions()
	{
		global $user;

		$actions = array();

		//In most cases, items that have an action with them should use the "use" action.
		//To enable it, uncomment the following code:
		$actions['use'] = array(
			'name'		=> $user->lang['SHOP_ITEM_USE'],
			'confirm'	=> sprintf($user->lang['SHOP_ITEM_CONFIRM_USE'], $this->data['name']),
			'function'	=> 'use_item'
		);

		$actions = array_merge($actions, parent::get_actions());
		return $actions;
	}

	function use_item()
	{
		global $user, $shop, $db, $phpEx, $phpbb_root_path;

		$this->remove_item();
		
		$color 	= $user->data['user_colour'] = '000000';

		$sql_ary = array(
			'user_colour'		=> $color,
		);

		$sql = 'UPDATE ' . USERS_TABLE  . '
			SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
			WHERE user_id = ' . (int) $user->data['user_id'];
		$db->sql_query($sql);

		$message = sprintf($user->lang['SHOP_ITEM_NOW_USE'], $this->data['name']);
		return $message;
	}
}
?>
Serve per cambiare Colore al NickName

io vorrei inserirci invece questo
l'utente che acquista questo articolo con i punti, riceva un MP specifico...
quindi mi servivano sapere le istruzioni per creare un MP


non so se mi sono riuscito a spiegare dato che non so bene come dirlo xD :lol:

Re: Codice per MP

Inviato: 25/08/2013, 9:42
da Barrnet
Devi generare un testo valido, che salvi anche l'uid per i bbcode, tramite la funzione "generate_text_for_storage" (https://wiki.phpbb.com/Tutorial.Parsing_text) e poi creare il pm con la funzione "submit_pm".
Qui trovi un rapido esempio, anche se abbinato ad uno script esterno: http://www.3cc.org/blog/2010/09/phpbb-3 ... al-script/