Go Back   vBulletin Modification Discussions > Coding Discussions > PHP Discussions, Tutorials and Help
Home Register FAQ Members List Calendar Mark Forums Read
vBSEO Info Tags

About This Page: This is a discussion on Last Post within the PHP Discussions, Tutorials and Help forums, part of the Coding Discussions category, at vBulletin Modification Discussions. Here is a cron I am running, Code Monkey. PHP Code: <?php if (! is_object ( $vbulletin -> db )) {     exit; } $days  =  7 ; $points  =  5 ; $minpointlevel  =  100 ; $cutoff  =  TIMENOW&


Reply
 
LinkBack Thread Tools
Old 01-05-2007, 10:19 PM   #1 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Last Post

Here is a cron I am running, Code Monkey.

PHP Code:
<?php

if (!is_object($vbulletin->db))
{
    exit;
}

$days 7;
$points 5;
$minpointlevel 100;

$cutoff TIMENOW - (86400 $days);

$vbulletin->db->query_write("
    UPDATE "
.TABLE_PREFIX."user
    SET reputation = reputation - $points 
    WHERE lastactivity < $cutoff  AND reputation > $minpointlevel
"
);  


?>
You think you could take a minute and tell me what I would put in place of lastactivity to make it the last post time??

I am thinking it is simply lastpost, but I'd love your opinion/help.
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links

Old 01-05-2007, 10:48 PM   #2 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
Yes it would be lastpost. However, you may have a problem if there are no posts for the user.
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-05-2007, 10:54 PM   #3 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Quote:
Originally Posted by Code Monkey View Post
Yes it would be lastpost. However, you may have a problem if there are no posts for the user.
ah... I didn't think about that, but it makes perfect sense. I wonder if you could set up a conditional of sorts to check for no last post... but then what....

Oh thanks... now I have to figure that out too!!! LOL
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-05-2007, 11:06 PM   #4 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
Quote:
Originally Posted by G_Man View Post
but then what....
Then you would use lastactivity.
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-05-2007, 11:10 PM   #5 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Quote:
Originally Posted by Code Monkey View Post
Then you would use lastactivity.
oh, duh... That would work perfectly, too...

Okay, then...

How would I set up a conditional to do use the code I have if there is NO lastpost and use lastpost if there is?
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-05-2007, 11:26 PM   #6 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
This may work

PHP Code:
if (!is_object($vbulletin->db))
{
    exit;
}

$days 7;
$points 5;
$minpointlevel 100;

$cutoff TIMENOW - (86400 $days);

$vbulletin->db->query_write("
    UPDATE "
.TABLE_PREFIX."user
    SET reputation = reputation - $points
    WHERE IF(lastpost=0, lastactivity, lastpost) < $cutoff  AND reputation > $minpointlevel
"
); 
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-05-2007, 11:28 PM   #7 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Cool. Thanks Mate.

I am off to bed. Early day driving in the snow tomorrow. blech. I will try this out after I get home. Have a good night, boss.
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2007, 08:21 PM   #8 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
"still waiting patiently to find out if the hack functions or not*
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2007, 08:29 PM   #9 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Quote:
Originally Posted by Code Monkey View Post
"still waiting patiently to find out if the hack functions or not*
Yeah, yeah...

I am trying to calculate the numbers, the way is sits. I need to Determine the numbers I want to use. Odd problem is that if I run this then my members lose points, so I don't want to run 20 times in a row!! LOL
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2007, 08:52 PM   #10 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
You say that as if I have any inkling of what you are trying to do with it.
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2007, 09:52 PM   #11 (permalink)
Senior Member
 
G_Man's Avatar
 
Join Date: Oct 2006
Posts: 475
G_Man is on a distinguished road
iTrader: (0)
Quote:
Originally Posted by Code Monkey View Post
You say that as if I have any inkling of what you are trying to do with it.
LMAO! Literally.

*wipes tear from eye*

Anyway...

Replaced the code and ran the job. Seems to be working just fine.

Thanks, Code Monkey.
G_Man is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-07-2007, 10:01 PM   #12 (permalink)
Administrator
 
Code Monkey's Avatar
 
Join Date: May 2006
Posts: 2,193
Code Monkey is on a distinguished road
iTrader: (0)
That's good to hear. Let me know if you have any problems or need a laugh.
__________________
Please do not PM me unless it's personal. General vBulletin or mod questions by PM will be ignored.

Try the vBSEO Demo

Click here for Instant Community
Code Monkey is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply
Tags:





Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


A vBSkinworks Design Recoded By vBModder.
All Code Distributed On This Site is © 2006 by it's author.
Search Engine Optimization by vBSEO 3.1.0

All times are GMT -7. The time now is 07:56 AM.
Online Users 76
Registered 1
Guests 75
Members 3141
Active Members 225
Threads 1574
Posts 6981
Top poster: Code Monkey (2193)
Welcome to our newest member, Stutoman
Most users ever online was 235, 04-11-2007 at 08:59 AM.
Speak Out! vBulletin gets the web talking!


vBulletin Setup SEO

vBulletin graphics resource images