Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ultimate Points and THT Intergration
#1
Hello, im having trouble figuring this out. I have a mod in phpBB called Ultimate Points, and I want to intergrate it with THT. I found this little snippet of code in the p2h.php and im wondering, how do I replace posts with points.

The snippet:
PHP Code:
            case "phpbb":
                
$n 0;
                
$result mysql_query("SELECT * FROM `{$prefix}users` WHERE username = '{$fuser}'"$this->con);
                
$mem mysql_fetch_array($result);
                
$select mysql_query("SELECT * FROM {$prefix}posts WHERE `poster_id` = '{$mem['user_id']}'"$this->con);

                while(
$data2 mysql_fetch_array($select)) {
                    
$date explode(":"strftime("%m:%y" ,$data2['post_time']));
                    if(
$nmonth <= $date[0] && $nyear <= $date[1]) {
                        
$n++;
                    }
                }
                break; 

And the sql table for the counting of the points is in the users table. Can anyone make edits.


Attached Files Thumbnail(s)
   
Reply
#2
This would require modification in quite a few places but here you would essentially cut out all the stuff where you check the month. Since it's points, it doesn't really matter what month those points were made in. Make sure you check to see if there are enough points and then subtract them, depending on what you're calling for.
Kevin Mark - TheHostingTool Lead Developer
Reply
#3
Hmm, im confused now, sorry but im a noob in PHP so I don't really know where to edit
Reply
#4
(05-18-2010, 09:47 PM)Ruko Wrote: Hmm, im confused now, sorry but im a noob in PHP so I don't really know where to edit

You need to get the number of current points from the SQL query. Let's say you stored that in $points["has"] and the number of points you need is in $points["required"]. You could check to see if they had enough like so:
PHP Code:
if($points["has"] >= $points["needed"]) {
   
//will be executed if they have enough points
}
else {
   
//will be executed if they don't have enough points

Literally translated that's, "If the number of points I have is greater than or equal to the number of points I need, do this, if not, then do something else
Kevin Mark - TheHostingTool Lead Developer
Reply
#5
I wouldn't be able to give you any copy and paste code for you to use as I have no idea how your system works but the basic concept should be the same. The specifics, such as the exact SQL query will depend.
Kevin Mark - TheHostingTool Lead Developer
Reply
#6
Since this isn't a THT issue I moved this to a more appropriate area.
- KuJoe
Reply
#7
Basically. Change the SQL code to get the number from the points table. It'll work the exact same, just say posts on the script when it's really points.
Jonny H - THT Main Developer & Founder


Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)