Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 03-27-2008, 06:46 PM
upnorth upnorth is offline
 
Join Date: Jul 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Schedualed Task to set user options

Hi
I'm wondering if anyone knows how I can setup a scheduled task to set / reset user options that an admin might see in the control panel for a user. Items like "Receive Admin Email, Invisible Mode etc" I'd also like to do this on a user group basis. That is set everyone's Invisible Mode in the Registered users group to yes or no.

Anyone able to help?
Reply With Quote
  #2  
Old 03-27-2008, 06:59 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can do some of these things through the Execute SQL Query page - queries.php - so I would grab the queries from there and then put them in their own page and just run the script as a Scheduled Task.
Reply With Quote
  #3  
Old 03-27-2008, 07:32 PM
upnorth upnorth is offline
 
Join Date: Jul 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I took a look at the queries.php page but its a little beyond me. Are you able to help pull out what I need and develop the script?
Reply With Quote
  #4  
Old 03-31-2008, 01:14 PM
upnorth upnorth is offline
 
Join Date: Jul 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Anyone able to help me parse this queries.php page and construct the script needed for this scheduled task? I really need this to work so that the LDAP mod that I installed works properly but I don't understand the code on this page or scheduled tasks well enough to accomplish this on my own.

Any help would be greatly appreciated!
Reply With Quote
  #5  
Old 03-31-2008, 04:05 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I recall looking at the queries.php page back when you first posted and it didn't look like a fun task to figure out. Is there some reason you don't want to set these options for your users when they first register? It seems like that would be much easier. If you are already writing to the database with their username/password/etc, why not just write these other settings. Or, after they register and on the Thank You for Registering screen, why not direct them to their User CP to pick their options?
Reply With Quote
  #6  
Old 03-31-2008, 05:07 PM
upnorth upnorth is offline
 
Join Date: Jul 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

umm well the current LDAP mod creates the user directly in the db so it bypasses the default settings with regards to new users etc within vB.

below is the code that the LDAP mod uses to create the new user....just not sure how to add to it so that it creates the new users similar to the way the default settings would within vB.

PHP Code:
if(defined('LDDEBUG')) { wrlog("++ LoginScript:\t creating user in vBulletin database"); }
$newuserid $newuser->save();
$vbulletin->GPC['vb_login_username']=$vbulletin->GPC['vb_login_username'];
$vbulletin->GPC['cookieuser']=$vbulletin->GPC['vb_login_username'];
verify_authentication($vbulletin->GPC['vb_login_username'], $vbulletin->GPC['cookieuser'], true);
exec_unstrike_user($vbulletin->GPC['vb_login_username']);
process_new_login($vbulletin->GPC['logintype'], $vbulletin->GPC['cookieuser'], $vbulletin->GPC['cssprefs']);
if(
defined('LDDEBUG')) { wrlog("++LoginScript:\t logging in"); if($fp) { fclose($fp); } }
do_login_redirect(); 
Reply With Quote
  #7  
Old 03-31-2008, 05:21 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looking through the registration.php page and then looking for where the defaults get set, I see that class_dm_user.php gets used to set the registration defaults. Perhaps look into calling this page (in the includes directory) and using the function set_registration_defaults will help you out. That function, however, is included in "class vB_DataManager_User extends vB_DataManager". So, you might want to look into using the datamanager to include this.


edit: This article may help you out: Add new Users (automatically)
Reply With Quote
  #8  
Old 04-02-2008, 02:50 PM
upnorth upnorth is offline
 
Join Date: Jul 2003
Posts: 81
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Lynne. That link was exactly what I needed
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:16 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03816 seconds
  • Memory Usage 2,224KB
  • Queries Executed 13 (?)
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)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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_postinfo_query
  • fetch_postinfo
  • 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