vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Schedualed Task to set user options (https://vborg.vbsupport.ru/showthread.php?t=174350)

upnorth 03-27-2008 06:46 PM

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?

Lynne 03-27-2008 06:59 PM

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.

upnorth 03-27-2008 07:32 PM

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?

upnorth 03-31-2008 01:14 PM

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!

Lynne 03-31-2008 04:05 PM

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?

upnorth 03-31-2008 05:07 PM

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(); 


Lynne 03-31-2008 05:21 PM

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)

upnorth 04-02-2008 02:50 PM

Thanks Lynne. That link was exactly what I needed :D


All times are GMT. The time now is 10:32 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.01068 seconds
  • Memory Usage 1,734KB
  • 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
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete