vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Member of the Day! (https://vborg.vbsupport.ru/showthread.php?t=34779)

Psychdrone 02-10-2002 10:19 PM

Quote:

Originally posted by FireFly
........If you want I can post the modified code here,.........
and thats why you are so cool :p , thanks for giving me a chance to figure it out on my own, I looked at it for about 10 menites but couldn't figure it out:(

But I am learning my friend, jsut at a slow pace (lots of other stuff going on in life) I shall amaze you one day:)

cditty 02-10-2002 11:11 PM

It looks like the Order by RAND() function is not available for mysql versions 3.22 or lower. Any way of getting the sql rewritten to work with 3.22? :)

Thanks

Chris

Admin 02-11-2002 09:04 AM

What version is your MySQL? I know that the ability to order by RAND() was only added in a certain version... I'll dig up see if I can find the older way to get a random row. :)

cditty 02-11-2002 01:46 PM

I'm running 3.22.32. I looked and the order by rand() does only seem to be available to 3.23 and up.

I am trying to talk myself into upgrading the mysql version, but I'm chicken.

Admin 02-11-2002 04:29 PM

Ok my book tells me you should change the query to this:
PHP Code:

    $newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
                                        FROM user
                                       WHERE userid<>
$daybits[1]
                                         AND (usergroupid=5
                                          OR usergroupid=6
                                          OR usergroupid=7
                                          OR usergroupid=2)
                                       ORDER BY randNum
                                       LIMIT 1"
); 


cditty 02-11-2002 06:04 PM

Works like a champ. Thanks.

Chris

Psychdrone 02-11-2002 11:35 PM

firefly?

Admin 02-12-2002 09:56 AM

Right, sorry. :)

Just change first line of code to this:
Code:

$thisdate=date('W');
And I think you're done.

over 02-13-2002 10:50 AM

thanks gonna try this 1 out :)

Massiel 02-14-2002 01:07 AM

How do you run a query? I am new at this, you lost me hehe

Sharp 02-15-2002 03:55 AM

Yes, how do you run a query? :?:

Double bump this. :)

cditty 02-18-2002 05:50 PM

Firefly, any way to put a little graphic or something on the MOTD user's post for the day? Something like the birthday hack.

ps...my users really like this. thanks.

Chris

Hamma 02-18-2002 07:30 PM

Quote:

Originally posted by FireFly
Replace:
Code:

                                      WHERE userid<>$daybits[1]
with:
Code:

                                      WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)

By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)

When I do this, ?resetmember=1 does not work anymore, which makes me wonder what it will do at midnight

WreckRman2 02-19-2002 02:51 AM

I installed this but it shows the same member everyday unless I do the reset thing myself. In other words it's not selecting a new member on it's own each day. Any ideas why?

DiSS Troya 02-20-2002 08:43 AM

Nevermind, I fixed my problem.

cditty 02-23-2002 10:25 PM

****bump****

Floris 02-24-2002 11:55 AM

Waaaaaay cool.

I just applied 'Who was online today' hack and merged that with the WOL box, I had one blank line left, and this just fit in perfectly! Fnx ;)

WreckRman2 02-24-2002 03:24 PM

Quote:

Originally posted by WreckRman2
I installed this but it shows the same member everyday unless I do the reset thing myself. In other words it's not selecting a new member on it's own each day. Any ideas why?

I've ran this for about a week now and it's never changed the member of the day. Any reason why it isn't automatically changing daily?

Admin 02-24-2002 03:58 PM

What version of MySQL are you using?

ForKmaN 02-24-2002 09:52 PM

I get this:

Database error in vBulletin 2.2.1:

Invalid SQL: SELECT userid,username
FROM user
WHERE userid<>
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near 'AND (usergroupid=5
OR usergroupid=6
' at line 4

mysql error number: 1064

Date: Sunday 24th of February 2002 03:53:22 PM
Script: http://www.gb-mod.net/forums/forums/index.php?
Referer: http://www.gb-mod.net/forums/admin/i...hp?action=head


And how Do I query that first line?

cditty 02-25-2002 02:09 AM

By chance did you try the query that FireFly gave me?

PHP Code:

$newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
                                        FROM user
                                       WHERE userid<>
$daybits[1]
                                         AND (usergroupid=5
                                          OR usergroupid=6
                                          OR usergroupid=7
                                          OR usergroupid=2)
                                       ORDER BY randNum
                                       LIMIT 1"
); 


FireFly, any thoughts about my last question? ie....use an image on the MOTD's posts. Something like the birthday hack?

Chris

ForKmaN 02-27-2002 03:09 AM

I would try but how do i run a query?

cditty 02-27-2002 02:02 PM

Check out this thread - http://www.vbulletin.com/forum/showt...threadid=18558

Chris

wvvwnet 02-27-2002 11:55 PM

DO you have an example of forum has this hacks work on?

Admin 02-28-2002 10:05 AM

This forum.

streamzone 03-03-2002 12:59 AM

sounds like a cool hack. i ran the db queery and modified the index.php then added the code to forumhome template...but i do not see member of the day :(

verion 2.2.2.

any idea's on what i should try fellas?

Thanx

streamzone 03-03-2002 01:04 AM

umm...DUH!! i swear my own eyes deceive me sometimes. i got it working by following the very easy directions and its working great. thanx again for another cool hack guys.

neal 03-03-2002 08:21 PM

Quote:

Originally posted by ForKmaN
I get this:

Database error in vBulletin 2.2.1:

Invalid SQL: SELECT userid,username
FROM user
WHERE userid<>
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=2)
ORDER BY RAND()
LIMIT 1
mysql error: You have an error in your SQL syntax near 'AND (usergroupid=5
OR usergroupid=6
' at line 4

mysql error number: 1064

Date: Sunday 24th of February 2002 03:53:22 PM
Script: http://www.gb-mod.net/forums/forums/index.php?
Referer: http://www.gb-mod.net/forums/admin/i...hp?action=head


And how Do I query that first line?

This is exactly what I am getting... it is not a random problem like you were having cditty. Any ideas anyone?

cditty 03-03-2002 09:47 PM

Quote:

Originally posted by FireFly
Replace:
Code:

                                      WHERE userid<>$daybits[1]
with:
Code:

                                      WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)

By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)


Chen, any idea on how to get the time feature to work with that mysql you gave me? I played with it a bit and couldn't figure it out.

Thanks

Chris

Admin 03-04-2002 11:37 AM

What went wrong cditty?

ForKmaN and neal, run the query I gave in the hack instructions.

cditty 03-04-2002 02:34 PM

I don't know. It's weird. I figured it musta had something to do with the customized sql that you had to give me. Every time I tried it, I got an invalid sql command.

I also just sent you a pm....

Chris

neal 03-04-2002 02:35 PM

I have done so, and I still get the error

ForKmaN 03-05-2002 02:25 PM

works for me now :)

cditty 03-07-2002 01:42 AM

Any ideas on mine FireFly?

Chris

Admin 03-07-2002 08:55 AM

What's the error you are gettting, Chris?

cditty 03-07-2002 10:50 AM

This is the error that I am getting.

[code]
Database error in vBulletin 2.2.1:

Invalid SQL: -1209600
AND (usergroupid=5
OR usergroupid=6
OR usergroupid=7
OR usergroupid=9
OR usergroupid=10
OR usergroupid=2)
ORDER BY randNum
LIMIT 1
mysql error:

mysql error number:

Date: Thursday 07th of March 2002 06:46:03 AM
[\code]

This is the code as I have it in my index.php3 file.
Code:

$newmember=$DB_site->query_first("SELECT userid,username,userid*0+RAND() AS randNum
                                        FROM user
                                      WHERE userid<>$daybits[1] AND posts>99
                                        AND lastactivity>time()-(86400*14)
                                        AND (usergroupid=5
                                          OR usergroupid=6
                                          OR usergroupid=7
                                          OR usergroupid=9
                                          OR usergroupid=10
                                          OR usergroupid=2)
                                      ORDER BY randNum
                                      LIMIT 1");

I have tried it with and without the "s around the time() section. Wierd thing is that I can run this query though mysqladmin.

Chris

cditty 03-07-2002 10:59 AM

I just got it going. I simply replaced the "s with 's. Seems to work like a charm.

Thanks again.

Chris

Dakota 03-12-2002 03:31 PM

Thanks, my members love this hack, just need to change it so that the use must still be active on the forum.

Dakota 03-13-2002 10:07 PM

Quote:

Originally posted by FireFly
Replace:
Code:

                                      WHERE userid<>$daybits[1]
with:
Code:

                                      WHERE userid<>$daybits[1] AND lastactivity>".time()-(86400*14)."
(14 is the number of days)

By the way, I'm not sure myself whether it's lastactivity or lastvisit we need to check, so I'm open for corrections here. :)

when I changed it to go by the activity, it gave me an error. I don't know why, I copied everything correctly.

cditty 03-13-2002 10:54 PM

try using single quotes instead of double. That was my problem.

Chris


All times are GMT. The time now is 04:17 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01757 seconds
  • Memory Usage 1,837KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (2)bbcode_php_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete