PDA

View Full Version : Help asap


DJ-Dez
04-01-2013, 01:54 PM
Hiya;

For some reason, we have the usergroup as id 314. Confirmed.

Anybody in that usergroup it will display a userbar. However, for some reason whenever somebody updates something in field24 it will just bypass the 314 usergroup id, meaning they don't have to be in usergroup id 314. We need it strictly to only show a userbar in usergroup id 314.

We've wrapped the <vb:raw donatorbar> in IF statements like, IF in 314 etc but this removes everyones userbar for some reason.

How could we fix this?

kh99
04-01-2013, 02:06 PM
Hmm...well, to start with I don't think you want if (!strpos($post['membergroupids'], 314)), because basically that will only check for 314 if it is the first (or only) member group id. It would be better to use is_member_of($post, 314). Also, I don't understand how field24 works so I can't write the entire condition for you - what's expected in that field, and how does it affect whether or not a user gets a bar?

DJ-Dez
04-01-2013, 02:11 PM
[QUOTE=kh99;2413613]Hmm...well, to start with I don't think you want if (!strpos($post['membergroupids'], 314)), because basically that will only be true if 314 is the first (or only) member group id. It would be better to use is_member_of($post, 314).

kh99
04-01-2013, 02:25 PM
OK, if I had read the second line of code you posted I would have figured out what field24 was for. :)

Anyway, I think the problem is that strpos call doesn't do what you think it does. According to the docs, if the second parameter to strpos() is a number, then it's used as the code for a character. You could put quotes around the 314, but like I mentioned above, I think it would be better to change it to

if (is_member_of($post, 314) && $post['field24']){$donatorbar = true;


and see if that works.

DJ-Dez
04-01-2013, 03:20 PM
Kev, you're a star. That works.

However, now we're trying to display it in the userprofile, but it's not working after corresponding your code.

We have our vbraw template in Memberinfo with this in hook member_complete

No idea why code is failing here, when the user is in the usergroup.

kh99
04-01-2013, 03:34 PM
There is no $post except in postbit. Try changing $post to $userinfo.

DJ-Dez
04-01-2013, 03:35 PM
There is no $post except in postbit. Try changing $post to $userinfo.

Changed both to userinfo, nothing =(

Thanks so far Kevin though

--------------- Added 1364834389 at 1364834389 ---------------

kh99
04-01-2013, 03:42 PM
Hmm...seems like that should have been it. Your code has $post in 3 places, did you change them all? Edit: oh, ok, I see the code you added above.

DJ-Dez
04-01-2013, 03:43 PM
Hmm...seems like that should have been it. Your code has $post in 3 places, did you change them all? Edit: oh, ok, I see the code you added above.

Changed them all now, just missed one. It's working now. Should this code everyone individually?

kh99
04-01-2013, 03:49 PM
Should this code everyone individually?


I'm not sure what you mean. $userinfo should be the member whose profile you're looking at, if that's what you're asking.