[ABD] UPS Easy Shop 0.7.0

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [Beta] UPS Easy Shop 0.5.0

Post by woipi90 »

femu wrote:
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.... :(
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.

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 :
  • 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;
Then you should be able to "sell" the permission to play Hangman ;)

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);		}
	}
}
?>
thx very much femu!


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";
femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [Beta] UPS Easy Shop 0.5.0

Post by femu »

Let us know, if it works :roll:
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]
User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [Beta] UPS Easy Shop 0.5.0

Post by woipi90 »

hey femu just uninstalled the old shop of femu and installed yours, right now i'm trunk but i'll report you tomorrow if it's functioning.... ;)

tja i found one little bug if i go in the shop i have the icon of the shop in the headerbar shown a thousand times around the headerlink to the shop.... :(


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";
femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [Beta] UPS Easy Shop 0.5.0

Post by femu »

woipi90 wrote:hey femu just uninstalled the old shop of femu and installed yours, right now i'm trunk but i'll report you tomorrow if it's functioning.... ;)

tja i found one little bug if i go in the shop i have the icon of the shop in the headerbar shown a thousand times around the headerlink to the shop.... :(


grz woipi
Check the edits and refresh everything including the browser cache ...
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]
User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [Beta] UPS Easy Shop 0.5.0

Post by woipi90 »

maybe try this?!

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 {FILE_NAME} 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;

		$auth_setting = 1;
		$auth_id = {PERMISSION_NUMBER};
		$isset = $this->isset_acl($auth_id);

		$sql_ary = array(
			'user_id'			=> $user->data['user_id'],
			'auth_option_id'	=> $auth_id,
			'auth_setting'		=> $auth_setting,
		);

		$sql = 'SELECT *
			FROM ' . ACL_USERS_TABLE . '
			WHERE user_id = ' . $user->data['user_id'] . '
				AND auth_option_id = ' . $auth_id;
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);

		if ($isset && $row['auth_setting'] == $auth_setting)
		{
			$meta_info = append_sid("{$phpbb_root_path}shop.$phpEx");
			meta_refresh(3, $meta_info);
			$message = $message . 'You already have this permission!<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $meta_info . '">', '</a>');
			trigger_error($message);
		}
		elseif ($isset && $row['auth_setting'] != $auth_setting)
		{
			$sql = 'UPDATE ' . ACL_USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' 
				WHERE user_id = ' . $user->data['user_id'] . ' 
					AND auth_option_id = ' . $auth_id;
			$db->sql_query($sql);

			$this->remove_item();
		}
		else
		{
			$sql = 'INSERT INTO ' . ACL_USERS_TABLE . $db->sql_build_array('INSERT', $sql_ary);
			$db->sql_query($sql);

			$this->remove_item();
		}
		$db->sql_freeresult($result);
	}

	function isset_acl($auth_id)
	{
		global $db, $user;

		$sql = 'SELECT COUNT(*) as num FROM ' . ACL_USERS_TABLE . '
			WHERE user_id = ' . $user->data['user_id'] . '
				AND auth_option_id = ' . $auth_id;
		$result = $db->sql_query($sql);
		$num = $db->sql_fetchfield('num');
		$db->sql_freeresult($result);
		
		return $num;
	}
}

?>

grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";
femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [Beta] UPS Easy Shop 0.5.0

Post by femu »

So does it work with your code?
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]
User avatar
woipi90
Registered User
Posts: 908
Joined: Mon Feb 16, 2009 5:32 pm
Location: Austria

Re: [Beta] UPS Easy Shop 0.5.0

Post by woipi90 »

yes it has to and it can be set to no first.... ;)


grz woipi
My mods: Ultimate Board Clubs
Support: only for the UBCS!
-----
function be_friends($uid, $u){return ($u == $user->['user_id']) ? false : true;}
$this->be_friends($uid, $user->['user_id']) ? $allow_pm : echo "You failed again";
IFRA
Registered User
Posts: 6
Joined: Sun Jan 17, 2010 7:26 am
Location: Thailand

Re: [Beta] UPS Easy Shop 0.5.0

Post by IFRA »

I want item to rename user.
andrius757
Registered User
Posts: 117
Joined: Wed Dec 02, 2009 10:05 pm

Re: [Beta] UPS Easy Shop 0.5.0

Post by andrius757 »

IFRA wrote:I want item to rename user.
Would be great, but not just to rename, but buy user permissions like in shop mod(which is now ABD), so user can buy permissions to change his name, etc..
User avatar
darkonia
Registered User
Posts: 1901
Joined: Tue May 13, 2008 1:10 pm
Location: Munich, Germany

Re: [Beta] UPS Easy Shop 0.5.0

Post by darkonia »

or for fun, buy permissions to change other usernames then the own :mrgreen:
MMOG-Heaven - Das Gaming Portal
Community bedeutet Gleichgesinnte finden - MMOG-Heaven ist Deine Community! Von Spielern für Spieler bietet Dir dieses Portal genau das, was ein Spieler braucht. Bleibe ständig informiert, finde die neuesten MMORPGs, oder suche die frischesten News aus der Welt des Online Gamings - dieses und vieles mehr erwartet Dich auf MMOG-Heaven.
starwar
Registered User
Posts: 99
Joined: Tue Nov 21, 2006 7:22 pm

Re: [Beta] UPS Easy Shop 0.5.0

Post by starwar »

Great mod. thk you.

If we can send item to other members,it would be better.

thk
User avatar
keith10456
Registered User
Posts: 2315
Joined: Thu Feb 24, 2005 6:55 pm

Re: [Beta] UPS Easy Shop 0.5.0

Post by keith10456 »

starwar wrote:Great mod. thk you.

If we can send item to other members,it would be better.

thk
See the 1st post... That feature is coming :idea:
Basement24
Registered User
Posts: 17
Joined: Wed Feb 17, 2010 8:23 pm

Re: [Beta] UPS Easy Shop 0.5.0

Post by Basement24 »

This is awesome mod, no bugs!! none that i can see..Also could you make like a plugin manager or something like that so a user can make their own plugins easily..looking forward to next update.

:D
femu
Registered User
Posts: 1070
Joined: Tue Sep 27, 2005 10:03 am

Re: [Beta] UPS Easy Shop 0.5.0

Post by femu »

Thanks. But a plugin manager is more, than we like to have for a EASY shop ;)

There are existing examples and we will add some more. The rest is upd to you guys. You need to have knowledge of PHP, MySQL and phpbb3 to create your own to create specific items. I will create a forum on my area to allow to post and share your self created items.

So the way is always the same. Just the part, where something happens surely differs :lol:

So take a close look on the existing items and start creating your items with your ideas. There are surely many of them!
Regards, femu
_____________________________________________
[My development page] - [My normal homepage (German only)]
jakk
Registered User
Posts: 31
Joined: Sun Jun 21, 2009 4:03 am

Re: [Beta] UPS Easy Shop 0.5.0

Post by jakk »

excellent femu, as always

have to think about uninstalling the mod shop to install this, but wait for something more advanced that :D
ivemfinity.com | mundoforeros.com | support team member phpbb-es.com (Soporte en español)

Return to “[3.0.x] Abandoned MODs”