Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Very new at PHP
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #31
RE: Very new at PHP
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.


[Image: leelink.gif]
MYBB1.6 & XThreads
03-19-2012 07:52 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #32
RE: Very new at PHP
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.

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
03-20-2012 10:12 AM
Visit this user's website Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #33
RE: Very new at PHP
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>



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 03-27-2012 11:44 AM by leefish.)
03-27-2012 11:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #34
RE: Very new at PHP

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


My Blog
03-27-2012 12:31 PM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #35
RE: Very new at PHP
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.



[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 03-28-2012 12:23 AM by leefish.)
03-28-2012 12:21 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #36
RE: Very new at PHP
Maybe this is what Yumi mean:

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


03-28-2012 01:51 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #37
RE: Very new at PHP
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?


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 03-28-2012 02:25 AM by leefish.)
03-28-2012 02:25 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #38
RE: Very new at PHP
Try this:

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


03-28-2012 05:45 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #39
RE: Very new at PHP
(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.



[Image: leelink.gif]
MYBB1.6 & XThreads
03-28-2012 06:31 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #40
RE: Very new at PHP
I'm sorry, what I mean is $memprofile['additionalgroups']

03-28-2012 06:41 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: