Author Topic: Small note for Daniel  (Read 4322 times)

Offline joomla.cc

Small note for Daniel
« on: November 10, 2006, 04:55:06 pm »
Hey,

I thought I might be able to help a little. Inside Display.template.php file, I found this:


	
	
	
	
//I couldn't find where all these $message['member'][whatever] variables
	
	
	
	
//are set, so I just send an extra database query to get the member's
	
	
	
	
//money. Can someone tell me where (file and line) the $message variables
	
	
	
	
//are set?
	
	
	
	
global 
$ID_MEMBER$db_prefix;

	
	
	
	
$result_money db_query("SELECT money
	
	
	
	
	
  FROM 
{$db_prefix}members
	
	
	
	
	
  WHERE ID_MEMBER = 
{$message['member']['id']}
	
	
	
	
	
  LIMIT 1"
__FILE____LINE__);
	
	
	
	
$row_money mysql_fetch_array($result_moneyMYSQL_ASSOC);


Well, here is some tips.
Since we do not welcome database calls inside a template file, I suggest the following change:
Remove the bit I quoted above, and replace $row_money['money'] with $message['member']['credit'].

Next:
Open $sourcedir/Load.php
Find:
	
	
	
mem.ID_POST_GROUPmem.lngfilemem.ID_GROUPmem.timeOffsetmem.showOnline,

Replace with:
	
	
 
mem.ID_POST_GROUPmem.lngfilemem.ID_GROUPmem.timeOffsetmem.showOnlinemem.money,


Find:
	
	
	
mem.birthdatemem.ICQmem.AIMmem.YIMmem.MSNmem.postsmem.lastLogin,

Replace with:
	
	
  
mem.birthdatemem.ICQmem.AIMmem.YIMmem.MSNmem.postsmem.lastLoginmem.money,


Find:
	
	
'local_time' => timeformat(time() + ($profile['timeOffset'] - $user_info['time_offset']) * 3600false),

Add After:
	
  
'credit' => $profile['money'],


Obviously not many would care, I know, but for the sake of clean coding, hope this will give you some directions to where extra member variables can be set.

Good luck.  O0

Alex
Joomla! Cyber Community

Offline TechnoDragon

Re: Small note for Daniel
« Reply #1 on: November 10, 2006, 11:44:38 pm »
Don't know about daniel, but I did this and it is awesome...so many queries removed!
Don't tell me to get into shape...I have a shape...It is round!


Offline Daniel15

Re: Small note for Daniel
« Reply #2 on: November 11, 2006, 09:11:28 am »
Hi,
 Thanks for that... I was going to do this, but never got around to finding out how. :P.
I'll probably implement this in the next release, but the problem is how will it edit the previous installs? Should the next upgrade package remove the code from Display.template.php?

Offline Daniel15

Re: Small note for Daniel
« Reply #3 on: December 08, 2006, 12:24:53 pm »
This has been implemented in the latest development version of SMFShop (Revision 37)

Offline joomla.cc

Re: Small note for Daniel
« Reply #4 on: December 08, 2006, 12:29:42 pm »
Good to hear that, Daniel. And glad I could help :) Is there anything to mention using PayPal to supply credit amount?

Offline joomla.cc

Re: Small note for Daniel
« Reply #5 on: December 08, 2006, 12:30:26 pm »
In your development plans for SMFShop I mean :)

Offline Daniel15

Re: Small note for Daniel
« Reply #6 on: December 08, 2006, 12:35:50 pm »
People have been asking about PayPal implementations in SMFShop since the day it came out :P. Unfortunately, I'm not really sure how to implement it...

(My 'TODO' list is still very very long and not many things have been done :P)