The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I would like to us the Blog data managers to 1) add a title and description to a users blog and 2) make an initial post for them.
I have tried using the blog DM without any success. Anyone ever done this sort of thing? Any suggestions on making it work? Code snippets would be greatly appreciated! Thanks in advance!! Austin |
#2
|
||||
|
||||
![]()
What code have you been trying?
|
#3
|
|||
|
|||
![]()
This is how I would like it to work - unfortunately, it doesnt get past the new statement. Haven't even attempted a post yet!
Code:
<h1>createVbUserBlogDev.php</h1> <?php # Add a user to vBulletin (offline) function qpc_post($varname) { return trim(stripslashes((get_magic_quotes_gpc()) ? $_POST[$varname] : addslashes($_POST[$varname]))); } define('THIS_SCRIPT', 'createVbUserBlogDev.php'); require_once('./global.php'); require_once('./includes/class_dm.php'); require_once('./includes/class_dm_user.php'); $userdmBU = new vB_DataManager_Blog_User($vbulletin, ERRTYPE_ARRAY); // $userdmBU->set('bloguserid', 48); // $userdmBU ->set('title', 'This is a test Title'); // $userdmBU ->save(); ?> <h4>Done!</h4> |
#4
|
||||
|
||||
![]()
You should initialise data managers with a special function:
PHP Code:
|
#5
|
|||
|
|||
![]() Quote:
Code:
define('THIS_SCRIPT', 'createVbUserBlogDev.php'); require_once('./global.php'); require_once('./includes/class_dm.php'); require_once('./includes/class_dm_user.php'); $userdmBU =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY); These lines: Code:
$userdmBU->set('bloguserid', 65); $userdmBU ->set('title', 'This is a test Title'); $userdmBU ->save(); |
#6
|
||||
|
||||
![]()
You do not need to include any DM files, also, you were meant to change the code I posted to suit your situation.
PHP Code:
|
#7
|
|||
|
|||
![]()
Just trying to learn the system.
This doesnt run (hangs on set title): Code:
$userdmBU =& datamanager_init('Blog_User', $vbulletin, ERRTYPE_ARRAY); $userdmBU->set('bloguserid', 65); $userdmBU->set('title', 'This is a test Title'); $userdmBU->set('description', 'This is the description of my blog'); $userdmBU->save(); Code:
$userdmBU =& datamanager_init('Blog_User', $vbulletin, ERRTYPE_ARRAY); $existing = array( 'bloguserid' => 65, 'title' => 'This is a test Title', 'description' => 'This is the description of my blog' ); $userdmBU->set_existing(&$existing); $userdmBU->save(); Austin --------------- Added [DATE]1251775569[/DATE] at [TIME]1251775569[/TIME] --------------- Anyone out there who know this stuff and is willing to share?? Thanks! |
#8
|
||||
|
||||
![]()
Open up the datamanager file - it will show you all the fields you need to set. Also change ERRTYPE_ARRAY to ERRTYPE_STANDARD.
|
#9
|
|||
|
|||
![]()
The code below successfully does what its supposed to, changes the blog title and description. I think its the correct use of the dm class.
There is a problem. The verify_title function in vB_DataManager_Blog_User never returns - so I hacked it (second piece of code). I would like to remove that hack - can you help? PHP Code:
Here is the function (and hack) from the class definition: PHP Code:
Thanks Austin |
#10
|
|||
|
|||
![]()
Well, after getting this code to work, I've decided NOT to use it. The problem is that the translation of special characters from the PHP variables to vB was a mess. A single quote, double quote, or ampersand messed things up.
It just seemed easier to instruct the blog owner on how to edit their blog title, description, and first post. Oh well - it was fun ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|