Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Very Simple Automatic Medals Based On Posts
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #11
RE: Very SImple Automatic Medals Based On Posts
For some reason this doesn't work using Template Conditionals plugin, I think the reason is because of the code, I don't understand it but it looks like it is a advanced code than can only be used with PHP in Templates / Complex Templates plugin.

I mean this code:

PHP Code:
<if str_replace($mybb->settings['thousandssep'],'',$post['postnum']) >= $mybb->settings['pn1'] then>


I tried to 'modify' it and it did worked:

PHP Code:
<if $mybb->settings['thousandssep'] + $post['postnum'] >


Is that code right?


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
07-22-2011 12:20 PM
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: #12
RE: Very SImple Automatic Medals Based On Posts
It should work with the Template Conditionals plugin, and no, your code isn't correct unfortunately.

My Blog
07-22-2011 12:30 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #13
RE: Very SImple Automatic Medals Based On Posts
I have not plugins intalled and I'm using mybb 1.6.3 but it doesn't work, it doesn't show a error code or something, it just don't show up Ouch

And sorry, I copy/paste it wrong, the code I modify is now this:

PHP Code:
<if $mybb->settings['thousandssep'] + $post['postnum'] >= $mybb->settings['pn2'] then>


Edit: I'm using a almost clean localhost installation to test this.


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
(This post was last modified: 07-22-2011 12:41 PM by Sama34.)
07-22-2011 12:40 PM
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: #14
RE: Very SImple Automatic Medals Based On Posts
It doesn't make sense to add a thousands separator to the number of posts.

And are you using 'pn1' or 'pn2' ?  You should be comparing with the number (pn1), not the HTML (pn2).

Can you put the following into your template and post the output generated by it?

HTML Code
<div>Thousands Separator: {$mybb->settings['thousandssep']}</div>
<div>Post Num: {$post['postnum']}</div>
<div>PN1: {$mybb->settings['pn1']}</div>


My Blog
07-22-2011 02:55 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #15
RE: Very SImple Automatic Medals Based On Posts
(07-22-2011 02:55 PM)ZiNgA BuRgA Wrote:  It doesn't make sense to add a thousands separator to the number of posts.

Now I removed it and it worked:

PHP Code:
<if $post['postnum'] >= $mybb->settings['pn2'] then>

---

(07-22-2011 02:55 PM)ZiNgA BuRgA Wrote:  And are you using 'pn1' or 'pn2' ?  You should be comparing with the number (pn1), not the HTML (pn2).
I'm using both, I just did the complete tutorial and I paste this in my postbit_author_user:

PHP Code:
1
2
3
4
5
6
<if str_replace($mybb->settings['thousandssep'],'',$post['postnum']) >= $mybb->settings['pn1'] then>
	{$mybb->settings['am1']}
</if>
<if str_replace($mybb->settings['thousandssep'],'',$post['postnum']) >= $mybb->settings['pn2'] then>
	{$mybb->settings['am2']}
</if>


But because it didn't worked I then edited like this:

PHP Code:
1
2
3
4
5
6
<if $mybb->settings['thousandssep'] + $post['postnum'] >= $mybb->settings['pn1'] then>
	{$mybb->settings['am1']}
</if>
<if $mybb->settings['thousandssep'] + $post['postnum'] >= $mybb->settings['pn2'] then>
	{$mybb->settings['am2']}
</if>


Or this (what also worked), as you mentioned, it what useless to use a thousands separator:

PHP Code:
1
2
3
4
5
6
<if $post['postnum'] >= $mybb->settings['pn1'] then>
	{$mybb->settings['am1']}
</if>
<if $post['postnum'] >= $mybb->settings['pn2'] then>
	{$mybb->settings['am2']}
</if>

---

(07-22-2011 02:55 PM)ZiNgA BuRgA Wrote:  Can you put the following into your template and post the output generated by it?

HTML Code
<div>Thousands Separator: {$mybb->settings['thousandssep']}</div>
<div>Post Num: {$post['postnum']}</div>
<div>PN1: {$mybb->settings['pn1']}</div>

Code:
Thousands Separator: ,
Post Num: 105
PN1: 1


I also checked PN2:
PN2 = 100


Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
07-22-2011 05:17 PM
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: #16
RE: Very SImple Automatic Medals Based On Posts
I don't know why the code doesn't work for you. I've tested using Template Conditional, and it works for me.

As far as I know (I can be wrong), the $post['postnum'] variable already formatted in postbit_author_user template. Maybe the comparison won't work correctly if we don't remove the thousand separator from the formatted $post['postnum'].

Example:
If we set the minimum post to get the 2nd Medal to 100 post, the user will get the medal when he/she has 100 - 999 post. Maybe he/she will lost it when he/she has 1000 - 1999 posts, or/and 10000 - 19999 posts.

07-23-2011 07:47 AM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #17
RE: Very SImple Automatic Medals Based On Posts
Can you try doing a complete reinstall?
That is, start from a completely fresh MyBB 1.6.3, and a fresh Template Conditionals plugin.
I have a feeling you don't have a phptpl_allowed_funcs.txt file.

My Blog
07-24-2011 01:22 PM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #18
RE: Very SImple Automatic Medals Based On Posts
Oh well, I thought phptpl_allowed_funcs.txt was a readme file for us to read so I never upload it, that was the problem.

I'm really sorry for taking and wasting your time RateU and ZiNgA BuRgA -.-

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
07-24-2011 10:54 PM
Visit this user's website Find all posts by this user Quote this message in a reply
MrBrechreiz Offline
Member
***
Posts: 69
Joined: May 2012
Post: #19
RE: Very SImple Automatic Medals Based On Posts
Hello together, i have a question to.
Is it possible to do this manually on a specific user id to set?

Thanks
05-06-2012 08:04 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: #20
RE: Very SImple Automatic Medals Based On Posts
Maybe if you wrap an <if> condition around everything.
Note that the more conditionals you set, the more complicated things get.

My Blog
05-06-2012 09:57 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: