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:
<h1>createVbUserBlogDev.php</h1>
<?php
# Change Blog Title and Description
define('THIS_SCRIPT', 'createVbUserBlogDevR2.php');
require_once('./global.php');
require_once('./includes/class_dm.php');
require_once('./includes/class_dm_blog_user.php');
$userdm = new vB_DataManager_Blog_User($vbulletin, ERRTYPE_ARRAY);
$existing = array(
'bloguserid' => 67
);
$userdm->set_existing(&$existing);
$userdm->set('description', 'Updated Program Created Blog Description');
$userdm->set('title', "J Paul's LoanWorkout911 Blog");
$userdm->pre_save();
if (count($userdm->errors) > 0)
{
echo("Some error<br />");
}
else
{
echo("No errors<br />");
$userdm->save();
}
?>
<h4>Done!</h4>
Here is the function (and hack) from the class definition:
PHP Code:
/**
* Verifies the title is valid and sets up the title for saving (wordwrap, censor, etc).
*
* @param string Title text
*
* @param bool Whether the title is valid
*/
function verify_title(&$title)
{
// replace html-encoded spaces with actual spaces
$title = preg_replace('/&#(0*32|x0*20);/', ' ', $title);
// AK Hack
return true;
// censor, remove all caps subjects, and htmlspecialchars post title
$title = htmlspecialchars_uni(fetch_no_shouting_text(fetch_censored_text(trim($title))));
// do word wrapping
$title = fetch_word_wrapped_string($title, $this->registry->options['blog_wordwrap']);
return true;
}
Thanks
Austin