Sarteck
02-25-2012, 03:38 PM
I'm designing a "Puppet" system that will allow some users to post as another account. I'm having a bit of trouble, though.
I get the usernametaken error each time I post, but I don't really see why.
on newpost_process (only enclosed by the outer IF block for testing).
if ($vbulletin->userinfo['userid'] == [MYUSERID])
{
$persona_id = $vbulletin->input->clean_gpc('p', 'persona_id', TYPE_UINT);
if ($persona_id && ($vbulletin->userinfo['userid'] != $persona_id)) // If "persona_id" is set from form data AND the persona ID is not the UserID
{
require_once(DIR . '/includes/functions_cbps.php');
$personas = get_personas($vbulletin->userinfo['userid']);
if ($personas && (in_array($persona_id, $personas))) // If this user has personas, AND the persona they are trying to post as does indeed belong to them, then continue.
{
$persona = fetch_persona($persona_id); // Gets the UserInfo of a persona given an ID.
$dataman->set('username',$persona['username']);
$dataman->set('userid',$persona['userid']);
}
else
{
standard_error('You seem to be trying to post as a Persona that doesn\'t belong to you.', false);
}
}
}
It is getting the persona info fine, but setting the userid and username fields of the post seems to give it a heart attack or something.
Is there some permissions things I have to muck around with? I basically want to enable the ability to post with a persona using the forum permissions of the logged-in user. (Later, before I release it, I'll be restricting it to just a few forums.)
Anyways, could anyone point me in the right direction?
I get the usernametaken error each time I post, but I don't really see why.
on newpost_process (only enclosed by the outer IF block for testing).
if ($vbulletin->userinfo['userid'] == [MYUSERID])
{
$persona_id = $vbulletin->input->clean_gpc('p', 'persona_id', TYPE_UINT);
if ($persona_id && ($vbulletin->userinfo['userid'] != $persona_id)) // If "persona_id" is set from form data AND the persona ID is not the UserID
{
require_once(DIR . '/includes/functions_cbps.php');
$personas = get_personas($vbulletin->userinfo['userid']);
if ($personas && (in_array($persona_id, $personas))) // If this user has personas, AND the persona they are trying to post as does indeed belong to them, then continue.
{
$persona = fetch_persona($persona_id); // Gets the UserInfo of a persona given an ID.
$dataman->set('username',$persona['username']);
$dataman->set('userid',$persona['userid']);
}
else
{
standard_error('You seem to be trying to post as a Persona that doesn\'t belong to you.', false);
}
}
}
It is getting the persona info fine, but setting the userid and username fields of the post seems to give it a heart attack or something.
Is there some permissions things I have to muck around with? I basically want to enable the ability to post with a persona using the forum permissions of the logged-in user. (Later, before I release it, I'll be restricting it to just a few forums.)
Anyways, could anyone point me in the right direction?