MyBB Hacks

Full Version: Very new at PHP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Indeed, that is the next plan. I want only people who have posted threads in certain forums to have it really, so a specific usergroup is the way forward.

Of course, it would be great if one of the options in promotions.php was to be able to choose which Forum a thread had been posted in. That would be a major bonus as it would apply the usergroup automatically and I am looking at trying to modify promotions php to do that.
The Promotions System need more options, it is currently limited and no one has done any plugin that works along it. Just my unrelated opinion.
GAHHH. Blasted blasted mybb. I cannot use the code I posted to query on user groups because of the stupid commas in the mybb additional groups field.

Any suggestions on how I can get round this without having to make my displaygroup the required additional group?

Code:
<if in_array($memprofile['additionalgroups'],array(15)) then>
Stuff visible on profile only if profile owner's additional usergroup is in the above array
</if>

Code:
if strpos(',15,', ','.$memprofile['additionalgroups'],',') !== false

hi Zinga - thank you for the code line - I think I may be using it incorrectly as I am getting this warning error:

Code:
Warning [2] strpos() expects parameter 3 to be long, string given - Line: 135 - File: member.php(1791) : eval()'d code PHP 5.3.6 (Linux)
File	Line	Function  [PHP]	 	errorHandler->error
/member.php(1791) : eval()'d code	135	strpos
/member.php	1791	eval


This is how I wrote the code in my template:

HTML Code
<if (strpos(',15,', ','.$memprofile['additionalgroups'],',') !== false) then>
					<td class="thead tab" title="Uploads" style="cursor: pointer; text-align: center;" abbr="image">
						<strong>Uploads</strong>
					</td>
</if>


Further help appreciated.

Maybe this is what Yumi mean:

PHP Code:
strpos(',15,', ','.$memprofile['additionalgroups'].',')

Hi RateU - thank you, the error is gone but the code is not working as expected. It is hiding for all users - and I have checked that the target group (15) is in the DB and is one of my assigned usergroups.

Did you manage to get a similar code to work on your forum?
Try this:

PHP Code:
strpos(','.$memprofile->user['additionalgroups'].',', ',15,') !== false

(03-28-2012 05:45 AM)RateU Wrote: [ -> ]Try this:

PHP Code:
strpos(','.$memprofile->user['additionalgroups'].',', ',15,') !== false


This is what I have :

HTML Code
<if (stripos(','.$memprofile->user['additionalgroups'].',', ',15,') !== false) then>

					<td class="thead tab" title="Uploads" style="cursor: pointer; text-align: center;" abbr="image">
						<strong>Uploads</strong>
					</td></if>


It is hidden for all users. Including those who are not in group 15.

I'm sorry, what I mean is $memprofile['additionalgroups']
Pages: 1 2 3 4 5 6
Reference URL's