[DEV] Item Shop

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Locked
Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Dec 16, 2002 12:43 am

L0cke wrote: Well can someone tell me how to do this..
If cost was in the inventory (so users could brag about how much they spent) and itd say "no items in inventory" if you displayed images on viewtopic, it'd be the best ever. :P


The funny thing about that is, even if someone did tell you how to do that there would always be more to add. :P

I'm not coding the shop today, so I can't tell you sorry. You just need to edit the viewtopic.php file go down to where the loop for the item variable is and make a check to see if it's null, then if it is set it to User owns nothing. or whatever.

User avatar
L0cke
Registered User
Posts: 426
Joined: Sat Aug 24, 2002 7:57 pm
Location: Missouri

Post by L0cke » Mon Dec 16, 2002 12:56 am

Well it's NULL but i don't know PHP and if I replace NULL with "The user has no items" it just errors me up. Sigh.

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Dec 16, 2002 1:11 am

Your code would have to look something like this

if (is_null($variable)) { $variable = "This user has no items"; }

replace the $variable with the actual variable name that I forget

brettm133
Registered User
Posts: 50
Joined: Thu Sep 26, 2002 12:06 pm

Post by brettm133 » Mon Dec 16, 2002 2:11 am

wow.. nice mod.. just installed it and it works great.. however.. when i view a topic it shows all my items underneath where the avatar would be.. my question is... how do you make it so the pictures of your items do not show on your viewtopic? here is what my viewtopic looks like: http://members.lycos.co.uk/brett133/php ... ic.php?t=2

see i used fairly large images for items... is there any way i can make these items not show up.. i do want to keep the text link in though


i know.. i forgot a break in btwn the items and points.. :)

Ghyste
Registered User
Posts: 38
Joined: Sun Sep 15, 2002 10:32 pm

Post by Ghyste » Mon Dec 16, 2002 2:11 am

EEP!
those white dead topics I told you about well
some of the users accounts got screwed

so when they post and i try and view it I get this

Information

Fatal Error Getting User Info!

and when I view there profile I get this:


phpBB : Critical Error
ERROR: Getting Global Variables!


I just told them to make new accounts
should I worry about this?

User avatar
L0cke
Registered User
Posts: 426
Joined: Sat Aug 24, 2002 7:57 pm
Location: Missouri

Post by L0cke » Mon Dec 16, 2002 3:32 am

Code: Select all

	//start of display-items
	$gsql = "select * from " . CONFIG_TABLE . " where config_name='viewtopic'";
	if ( !($gresult = $db->sql_query($gsql)) )
	{
		message_die(CRITICAL_ERROR, 'ERROR: Getting Global Variables!');
	}
	$grow = mysql_fetch_array($gresult);
	if ($grow['config_value'] == images)
	{
		$itempurge = str_replace("Þ", "", $postrow[$i]['user_items']);
		$itemarray = explode('ß',$itempurge);
		$itemcount = count ($itemarray);
		$user_items = "";
     		for ($xe = 0;$xe < $itemcount;$xe++)
		{
			if ($itemarray[$xe] != NULL)
			{
				if (file_exists("shop/images/".$itemarray[$xe].".jpg"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].jpg\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
				elseif (file_exists("shop/images/".$itemarray[$xe].".gif"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].gif\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
				
			}
			if (is_null($user_items)){ $user_items .= "This user has no items"; }
		}
	}
	$usernameurl = append_sid("shop.".$phpEx."?action=inventory&searchname=".$postrow[$i]['username']);
I figured this would be right.. but it's not. :/

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Dec 16, 2002 3:39 am

You put it in the wrong place... drop it another brace, out of the loops.

And yes, I would worry if it's saying it can't retrieve global variables. It means either the shop_install.php file didn't work, or you've changed something.

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Dec 16, 2002 3:40 am

brettm133 wrote: wow.. nice mod.. just installed it and it works great.. however.. when i view a topic it shows all my items underneath where the avatar would be.. my question is... how do you make it so the pictures of your items do not show on your viewtopic? here is what my viewtopic looks like: http://members.lycos.co.uk/brett133/php ... ic.php?t=2

see i used fairly large images for items... is there any way i can make these items not show up.. i do want to keep the text link in though


i know.. i forgot a break in btwn the items and points.. :)


There's an option in the shop configuration panel. I think I mentioned that in the FAQ.

User avatar
L0cke
Registered User
Posts: 426
Joined: Sat Aug 24, 2002 7:57 pm
Location: Missouri

Post by L0cke » Mon Dec 16, 2002 3:44 am

Code: Select all

	//start of display-items
	$gsql = "select * from " . CONFIG_TABLE . " where config_name='viewtopic'";
	if ( !($gresult = $db->sql_query($gsql)) )
	{
		message_die(CRITICAL_ERROR, 'ERROR: Getting Global Variables!');
	}
	$grow = mysql_fetch_array($gresult);
	if ($grow['config_value'] == images)
	{
		$itempurge = str_replace("Þ", "", $postrow[$i]['user_items']);
		$itemarray = explode('ß',$itempurge);
		$itemcount = count ($itemarray);
		$user_items = "";
     		for ($xe = 0;$xe < $itemcount;$xe++)
		{
			if ($itemarray[$xe] != NULL)
			{
				if (file_exists("shop/images/".$itemarray[$xe].".jpg"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].jpg\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
				elseif (file_exists("shop/images/".$itemarray[$xe].".gif"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].gif\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
			}
		}
				if (is_null($user_items)){ $user_items .= "This user has no items"; }
	}
	$usernameurl = append_sid("shop.".$phpEx."?action=inventory&searchname=".$postrow[$i]['username']);
Still not working.. :(
Other options for variables are...
$itemcount
$itemarray
$itempurge
$user_items

User avatar
L0cke
Registered User
Posts: 426
Joined: Sat Aug 24, 2002 7:57 pm
Location: Missouri

Post by L0cke » Mon Dec 16, 2002 3:45 am

Also, when it's where it was in that first code I showed you, it shows "User has no items" before images

Zarath
Registered User
Posts: 736
Joined: Fri Dec 06, 2002 9:01 am
Contact:

Post by Zarath » Mon Dec 16, 2002 3:56 am

because it uses .= not =

you should be using = too, not .=

try if (strlen($user_items) < 2)) {...

User avatar
L0cke
Registered User
Posts: 426
Joined: Sat Aug 24, 2002 7:57 pm
Location: Missouri

Post by L0cke » Mon Dec 16, 2002 4:06 am

Code: Select all

	//start of display-items
	$gsql = "select * from " . CONFIG_TABLE . " where config_name='viewtopic'";
	if ( !($gresult = $db->sql_query($gsql)) )
	{
		message_die(CRITICAL_ERROR, 'ERROR: Getting Global Variables!');
	}
	$grow = mysql_fetch_array($gresult);
	if ($grow['config_value'] == images)
	{
		$itempurge = str_replace("Þ", "", $postrow[$i]['user_items']);
		$itemarray = explode('ß',$itempurge);
		$itemcount = count ($itemarray);
		$user_items = "";
     		for ($xe = 0;$xe < $itemcount;$xe++)
		{
			if ($itemarray[$xe] != NULL)
			{
				if (file_exists("shop/images/".$itemarray[$xe].".jpg"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].jpg\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
				elseif (file_exists("shop/images/".$itemarray[$xe].".gif"))
				{
					$user_items .= " <img src=\"shop/images/$itemarray[$xe].gif\" title=\"$itemarray[$xe]\" alt=\"$itemaray[$xe]\">";
				}
			}
		}
			if (strlen($user_items) < 2) { $user_items = "This user has no items"; }				
	}
	$usernameurl = append_sid("shop.".$phpEx."?action=inventory&searchname=".$postrow[$i]['username']);

That did it, it works! Thank you so much, man. Your mod is sweet!
Check your PMs

baselineace
Registered User
Posts: 177
Joined: Sat Oct 05, 2002 2:46 pm
Contact:

Post by baselineace » Mon Dec 16, 2002 11:17 am

JuggleNuts wrote:
baselineace wrote:Can someone post the manual addition to the SQL database because I get errors.


Here yar be:

Code: Select all

insert into phpbb_config values ('viewprofile', 'images')

insert into phpbb_config values ('viewinventory', 'grouped')

insert into phpbb_config values ('specialshop', 'ßstoreÞdisabledßnameÞEffects StoreßoffÞ1ßoffÞ1ßoffÞ1ßoffÞ1ßoffÞ1ßoffÞ1')

alter table phpbb_users add `user_effects` CHAR (255)

alter table phpbb_users add `user_privs` CHAR (255)


That doesn't work

baselineace
Registered User
Posts: 177
Joined: Sat Oct 05, 2002 2:46 pm
Contact:

Post by baselineace » Mon Dec 16, 2002 11:26 am

Since installing this mod I have a strange error message, www.baselineace.com/phpBB2. Please check that out!

kip2001
Registered User
Posts: 313
Joined: Sun Sep 15, 2002 9:44 am

Post by kip2001 » Mon Dec 16, 2002 11:51 am

Ya, I'll tell you thats strange: :lol:
The page cannot be found

Locked

Return to “[2.0.x] MODs in Development”