Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2003, 02:35 AM
bobhumphries2 bobhumphries2 is offline
 
Join Date: Mar 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Email notification when users online

I'm running a vBulletin board and it would be great if I could be notified by email when certain users come online. I guess it would be like a email notification if your buddies are online, but for moderators only ie this isn't a feature that everyone needs to have on the board. I've been trying to workout how to do it, I have some db skills but little PHP skills so I'm finding it tough going. Would be very grateful if someone could give me some pointers.

TIA
Reply With Quote
  #2  
Old 03-22-2003, 02:47 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll look into it this weekend unless somebody else wants to pounce.
Reply With Quote
  #3  
Old 03-22-2003, 04:54 AM
bobhumphries2 bobhumphries2 is offline
 
Join Date: Mar 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for that - really appreciate any help you have time to give.
Reply With Quote
  #4  
Old 03-23-2003, 01:32 AM
bobhumphries2 bobhumphries2 is offline
 
Join Date: Mar 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've reached a sticking point - I think I've found the section in the members.php file which creates the session entry in the db session table so I've added the following code as a test to send an email but it doesn't seem to do anything (ie I never get an email). Here's the code with my additional code at the end (I haven't included the full original code).

Really appreciate any pointers:

Bob

// ############################### start login ###############################
if ($action=="login") {
$templatesused = 'redirect_login,error_wrongpassword,error_wronguse rname';
include("./global.php");
$userid = 0;
if (isset($username)) {
// get userid for given username
if ($user=$DB_site->query_first("SELECT userid,username,password,cookieuser FROM user WHERE username='".addslashes(htmlspecialchars($username) )."'")) {
if ($user['password']!=md5($password)) { // check password
eval("standarderror(\"".gettemplate("error_wrongpa ssword")."\");");
exit;
}
$userid=$user[userid];
} else { // invalid username entered
eval("standarderror(\"".gettemplate("error_wrongus ername")."\");");
exit;
}

if ($user['cookieuser']==1) {
vbsetcookie("bbuserid",$user['userid']);
vbsetcookie("bbpassword",$user['password']);
}

$DB_site->query("DELETE FROM session WHERE sessionhash='".addslashes($session[dbsessionhash])."'");

$session['sessionhash']=md5(uniqid(microtime()));
$session['dbsessionhash']=$session['sessionhash'];
$DB_site->query("INSERT INTO session (sessionhash,userid,host,useragent,lastactivity,st yleid) VALUES ('".addslashes($session['sessionhash'])."','".intval($userid)."','".addslashes($sessio n['host'])."','".addslashes($session['useragent'])."','".time()."','$session[styleid]')");
vbsetcookie("sessionhash",$session['sessionhash'],0);
$username = $user['username'];
}

// ########################### hack to email if certain user come online #################


vbmail("bob@bob.com","VBTest","Online");
Reply With Quote
  #5  
Old 03-23-2003, 03:36 AM
afterlab's Avatar
afterlab afterlab is offline
 
Join Date: Oct 2001
Location: Dallas, TX
Posts: 327
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It would be best to run it from sessions.php, because not all members have to login in order to be considered online. Most are "cookied" so they can just drop by the forums and be "online".

I can get this hack done in a few minutes, but it seems filburt has this one. Good luck with it.
Reply With Quote
  #6  
Old 03-24-2003, 03:47 AM
bobhumphries2 bobhumphries2 is offline
 
Join Date: Mar 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the tip I'll put in inthe session.php file as well - I could do with a little help - whenever I run this on the server I get the error: call to undefined fuction vbmail:

I can see that the function is stored in /admin/functions.php and referenced by global.php

However if I include global.php just before I make the call the vbmail I get the error: Fatal error: Cannot redeclare regstring - previously declaired in...

Any pointers anyone. Seems like I can't use the vbmail function as it hasn;t been included but when I try and include the library that has it - it tells me that it can't as other members of the library have already been declaired - confused

TIA

Bob
Reply With Quote
  #7  
Old 03-24-2003, 05:26 AM
bobhumphries2 bobhumphries2 is offline
 
Join Date: Mar 2003
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Finally go it to work but ended up using just the mail command rather than the vbmail. Would still be interested why I had the vbmail problems if anyone knows.
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:40 PM.


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.04474 seconds
  • Memory Usage 2,214KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete