vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Getting Member list + adding user. (https://vborg.vbsupport.ru/showthread.php?t=277483)

newsun 01-24-2012 06:14 PM

Getting Member list + adding user.
 
Ok, so I've got the task of adding new members to our vB forum from an account we already have in our system. I figured the API would be where to start, but it's confusing my brain for some reason on how to use it at all.

Does anyone have any good examples of a complete php script that can do the above two things:

get member list
add member

I'm also willing to use another method as I have not gotten any API code working yet.

newsun 01-26-2012 05:34 PM

No one has any input on this?

Lynne 01-26-2012 08:46 PM

Have you tried looking in our articles forums? I'm pretty sure there are a couple of articles on adding users there.

newsun 01-26-2012 09:02 PM

I saw one on this for v3 that didn't include any of the basic code to get connected to the API in the first place and it was also not for v4 so I dunno what would transfer over once i actually could get API output.

Basically if someone could show me how what to post to api.php via get to start using the API methods, I'm sure I could manage the rest. There are methods listed for listing the users and for registering them. I'm mostly confused on the getting started part.

Lynne 01-26-2012 09:40 PM

The API for creating a user in vb3 is probably not much different than creating a new user in vb4.

kh99 01-26-2012 09:52 PM

If I were going to do what you described, I think I would look at admincp/user.php for the code that gets executed when a user is added from the admincp. It's this section, starting around line 980:

Code:

// ###################### Start do update #######################
if ($_POST['do'] == 'update')


It's basically

Code:

$userdata =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
$userdata->adminoverride = true;
$userdata->set('something', $somevalue);
// etc, etc
$newuserid = $userdata->save();


As far as I know there is no documentation of everything you can set() (although there may be an article somewhere), but I believe they mostly match the columns in the user table (and you can figure things out by comparing the admincp form fields to what gets set in user.php).

newsun 02-17-2012 07:01 AM

I just went ahead and access the database directly for this and it worked fine.

Selected all the records, then parsed through them to find the settings I needed and now I can add users directly to the dbs easily.

Thanks for help.


All times are GMT. The time now is 05:27 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.01424 seconds
  • Memory Usage 1,716KB
  • 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
  • (2)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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