thx very much femu!femu wrote:Not included, but I'm pretty sure it's possible to set permissions, if you know, how it's done normally. I never tried it by myself, but if you know how to do it, you can simply create a plugin for it.woipi90 wrote: sorry to ask again but is there also some kind of permission buy tool included? i'm not aware of what had been included in the phantoms mod....![]()
Edit
Ok. I just played arround. You may try following for example, if you like to give permissions (save as root/includes/shop/items/user_permission_XXXXX.php). The XXXXX should be replaced with the permission you like to give (name and also in the PHP below). The second XXXXX in the code is the ID of the permission. So you need check your phpbb_acl_options table and check, which permission you like to "sell". So lets say u_play_hangman with the ID 210 ... Then you :
Then you should be able to "sell" the permission to play Hangman
- save the file as user_permission_hangman
- rename the below class name from user_permission_XXXXX to user_permission_hangman
- change below $auth_id = XXXXX; to $auth_id = 210;
![]()
BUT: It's untested. If you like to see, if it works, please do it LOCALLY !!!! Not in a live enviorment !!!
Especially permissions are very delicate !!!
So below one checks first, if the permission is not already set for the user_id (doesn't matter if yes/no/never) and if not, performs what it should do. If it's set somehow, it shows the error message.
Code: Select all
<?php /** * * @package - phpbb3 UPS Easy Shop * @version $Id: user_posts_100.php 79 2010-02-09 08:12:15Z 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_permission_shop 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['ITEM_USE'], 'confirm' => sprintf($user->lang['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(); $auth_setting = 1; $auth_id = XXXX; $sql = 'SELECT * FROM ' . ACL_USERS_TABLE . ' WHERE user_id = ' . (int) $user->data['user_id'] . ' AND auth_option_id = ' . $auth_id; $result = $db->sql_query($sql); if ( !$result ) { $sql_ary = array( 'auth_setting ' => $auth_setting, 'auth_option_id' => $auth_id, 'user_id' => (int) $user->data['user_id'], ); $sql = 'UPDATE ' . ACL_USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary); $db->sql_query($sql); } else { $meta_info = append_sid("{$phpbb_root_path}shop.$phpEx"); meta_refresh(3, $meta_info); $message = $message . 'This permission is already set!<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $meta_info . '">', '</a>'); trigger_error($message); } } } ?>
grz woipi