1 edb Feb 04, 2009 06:31
3 edb Feb 07, 2009 03:41
Okay that's cool. I was doing pretty good until I noticed a funky little detail that I finally figured out the root cause of.
$params['User']->login shows me the new login if that was changed.
$params['User']->email shows me the new email if that was changed.
$params['User']->url shows me the new website if that was changed.
Here's the bad part:
$params['User']->group_ID shows me the OLD group ID if that was changed.
Now compliments of pre_dump (or print_r but it's all the same really) that part of what shows up is a "[Group] = > Group Object" that happens to contain lots of groovy info about the NEW group, including the new group ID. All I want is the ID, but I can't for the life of me guess how to get a tiny bit out of a group out of a user out of a param. Or a this or a that or a thing. Or a freakin partridge in a stupid pear tree >:-<
help again some more?
EDIT: I also tried doing it with
$UserCache->get_by_ID( $updated_pilot_id )
after correctly identifying the "updated_pilot_id" bit via params[User] but same thing: a group object that doesn't want to play nice with the few tiny little tricks I know.
4 yabba Feb 07, 2009 07:18
echo $params['User']->Group->ID;
You'd have expected the group_ID to be correct though :-S
¥
5 edb Feb 07, 2009 13:16
Thanks again ¥åßßå. In my head I sort of thought "just keep guessing at combinations of ['these'] and ->those until you get lucky" but that gets frustrating fast ya know?
6 edb Feb 09, 2009 21:27
Okay something went weird after I went live with this thing. Seems that when I put someone else into a group then using $params['User']->Group->ID so that's what the code does.
if( $params['User']->Group->ID != $old_pilot_data['pilot_group'] ) {
if( $query_changed ) {$query .= ","; }
$query .= " pilot_group = '".$params['User']->Group->ID."'";
$query_changed = true;
}
The problem now is that the very first registrant is actually officially in group #4, but for some reason my plugin's table thinks she is in group #0.
My GUESS is that I need to do something like this:
if( current_User is the same as User ) {
do something different
} else {
do it the way ¥åßßå showed you
}
Thoughts? Oh and if any of you code junkies out there want to see the end result of all this lemme know and I'll PM you a register link. It's not much yet cuz all it does is collect a bunch of info with a post. I get a few days of rest before I have to start making it actually score points.
7 edb Feb 12, 2009 05:27
Okay this is (a) causing registration problems and (b) not worth trying to fix nicely. I'll just do a query I shouldn't need to do and get the new user's group ID for the "AfterUserUpdate" hook so that people can register.
;)
¥