vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Help asap (https://vborg.vbsupport.ru/showthread.php?t=296763)

DJ-Dez 04-01-2013 01:54 PM

Help asap
 
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

Code:

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

Quote:

Originally Posted by kh99 (Post 2413636)
There is no $post except in postbit. Try changing $post to $userinfo.

Changed both to userinfo, nothing =(

Thanks so far Kevin though

--------------- Added [DATE]1364834389[/DATE] at [TIME]1364834389[/TIME] ---------------

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

Quote:

Originally Posted by kh99 (Post 2413641)
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

Quote:

Originally Posted by DJ-Dez (Post 2413642)
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.


All times are GMT. The time now is 05:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02215 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete