Could this be the problem:
PHP Code:
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
Once again the code will run fine it it is fed
PHP Code:
$userdata->fetch_field('membergroupids')
from useradmin_update_save which suggests that the problem is not in this part but in the sql of getting membergroupids directly from the database.
--------------- Added [DATE]1306036694[/DATE] at [TIME]1306036694[/TIME] ---------------
I have even tried:
Code:
$membergroupids = fetch_membergroupids_array($user, false);
still not working correctly... no errors I am making the changes directly in the function directly without using the hook to avoid any complications. I know the above function should be working as it is used as part of the default vb code within the same function.
but then doing:
PHP Code:
$sbusergroups = $sbmemgroups;
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
does nothing
however from useradmin_update_save I can do:
PHP Code:
$sbmemgroups = $userdata->fetch_field('membergroupids');
$sbusergroups = explode(",", $sbmemgroups);
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
and that works without any problem... all I want is to be able to get the member groups of the user in paidsub_build and process it though:
PHP Code:
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
just as I am able to do from useradmin_update_save
--------------- Added [DATE]1306050752[/DATE] at [TIME]1306050752[/TIME] ---------------
I think there may be a way to get the output I want via the fetch_membergroupids_array function but I do not know how to use it.
As stated above as long as I can get something that works as the below does but for paidsub_buid I am good:
PHP Code:
$sbmemgroups = $userdata->fetch_field('membergroupids');
$sbusergroups = explode(",", $sbmemgroups);
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
--------------- Added [DATE]1306057439[/DATE] at [TIME]1306057439[/TIME] ---------------
Ok so here is what I did to test this out:
I fed the data directly from txt files so that I could see that the functions run correctly. The program grabs no data externally just runs identical code on the paidsub_build hook and the useradmin_update_save hook.
When run from the paidsub_build it never runs completely but useradmin_update_save works. They both use exactly the same code. Example:
PHP Code:
$sbmemgroups2 = file_get_contents('data2.txt');
$sbusergroups = explode(",", $sbmemgroups2);
foreach($sbusergroups as $sbgroup)
{
$sbgroupint = intval($sbgroup);
if ($sbgroupint == 16)
{
$sbpaid = true;
}
}
The contents of data2.txt are not changed. When run via useradmin_update_save returns true and when run via paidsub_build returns false...