vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Can't Get an External Page to Work with Data Manager (https://vborg.vbsupport.ru/showthread.php?t=304240)

ShannonA 11-06-2013 11:25 PM

Can't Get an External Page to Work with Data Manager
 
I've been trying to create an external page that accesses vBulletin to add (or later, subtract) a user to a secondary usergroup. It sounds like it should be an easy enough task using the datamanager, though I've never used the datamanager before.

Unfortunately, when I try to do this, the web page dies out sometime during its look at "includes/init.php". I can't find any errors in the WWW error files, nor does anything show up on screen.

Code:

<?

  $forumFile = "/defined/here";
  addUserToGroup(981,0);
 
function addUserToGroup($userid,$groupid) {

  global $forumFile;

  define('VB_AREA', 'External');
  define('SKIP_SESSIONCREATE',1);
  define('SKIP_USERINFO',1);
  define('THIS_SCRIPT', __FILE__);

  define('CWD',$forumFile);

// I've verified that $forumFile is set correctly here

echo "A";

  require_once(CWD . '/includes/init.php');

echo "B";

    $userinfo = fetch_userinfo($userid);
    $membergroups = fetch_membergroupids_array($userinfo);

#    $userdm =& datamanager_init('User', $vbulletin, ERRTYPE_STANDARD);
 
  }

?>

I see the "A", but not the "B". Any ideas?

vB 4.2.2

tbworld 11-07-2013 12:06 AM

What you are seeing is typical when running "init.php" -- the code is executing. I will not get into the details since what you need is a work-around.

Two methods are available to you write to a log file or capture / buffer the stdio using other php methods. I suggest, since you are learning, to use something like 'Firephp' a Firefox add-on which will let you log to the console log in Firefox. Chrome has a similar add-on but I am not familiar with it.

https://addons.mozilla.org/en-US/firefox/addon/firephp/

At this point do not worry about why echo does not work after requiring "init.php". You will figure that out later when you are more familiar with vbulletin code.

Hope this helps, have fun. :)

ShannonA 11-07-2013 06:26 AM

Thanks for the advice (and link)


All times are GMT. The time now is 08:51 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.01035 seconds
  • Memory Usage 1,713KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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