collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 265
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Installation errors? Mod incompatibilities? Upgrade problems? Make your way over to the Install and Upgrade Support board for all your solutions!

Author Topic: Next Level (countdown)  (Read 12105 times)

0 Members and 2 Guests are viewing this topic.

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Next Level (countdown)
« on: February 05, 2009, 11:49:07 PM »
Would it be possible to add to the User Info block...

Posts: ###
Next Level: ###
Total Messages: ##
New Messages: ##

with the "Next Level" acting as a countdown until the next user level? This might inspire users to posts more just to hit that next level.
I Post You Post - Forum Owners Helping Forum Owners

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #1 on: February 06, 2009, 03:01:02 AM »
SPortal2.php

Find:

Code: [Select]
//If you install the Membercolor Link the colors will be autmaticly set.
Replace:

Code: [Select]
global $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT min_posts
FROM {db_prefix}membergroups
WHERE min_posts > {int:current}
ORDER BY min_posts
LIMIT 1',
array(
'current' => $memberContext[$member_id]['posts'],
)
);
list ($next_post) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);

$next_post_left = $next_post - $memberContext[$member_id]['posts'];

//If you install the Membercolor Link the colors will be autmaticly set.

Then you can use $next_post_left where you want it to appear.
And slowly, you come to realize... It's all as it should be...

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #2 on: February 06, 2009, 03:05:56 AM »
I apologize, I'm still learning the ins/outs of SP. In order to insert it into the User Info box as above, which file(s) would I add $next_post_left to?
I Post You Post - Forum Owners Helping Forum Owners

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #3 on: February 06, 2009, 03:16:02 AM »
No problems. You should use that in the same function. Like this:

SPortal2.php

Find:

Code: [Select]
<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['posts'], ': ',$memberContext[$member_id]['posts'],'<br />';
Replace:

Code: [Select]
<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> ', $txt['posts'], ': ',$memberContext[$member_id]['posts'],'<br />';

echo '
<img src="' . $settings['images_url'] . '/dot.gif" alt="', $txt['sp-dot'], '" /> Next Post Level: ', $next_post_left, '<br />';
And slowly, you come to realize... It's all as it should be...

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #4 on: February 06, 2009, 03:18:59 AM »
Outstanding, thanks!  ;D
I Post You Post - Forum Owners Helping Forum Owners

Offline Smoky Blue

  • Jr. Member
  • **
  • Posts: 52
  • Gender: Female
    • HouseOfSmoky
Re: Next Level (countdown)
« Reply #5 on: February 12, 2009, 04:24:23 AM »
Mr. Blue is slick with the coding  :mouse:

lol nice and thanks.. might get around to trying it out  :nervous-happy:

Offline Killer

  • Semi Newbie
  • *
  • Posts: 5
Re: Next Level (countdown)
« Reply #6 on: February 17, 2009, 03:07:19 PM »
Wow, this works perfectly :D

Why not just add this as an option for that block in the next update?

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #7 on: April 02, 2009, 07:11:02 AM »
I had to remove the WHERE part to stop it giving me a db error.

Thing is that for members that aren't part of a post based group it shows the db default which is '-1'

Then again I've not tried it on the portal itself I'm trying the code for within posts in display.php but still same code applies pretty much.

Could you show me how I could do an if/else statement so if $post_next_level = -1 then it should use the members secondary group which by default should be post based group.

Thank you.
0ot


Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #8 on: April 02, 2009, 01:16:24 PM »
SiNaN, should this work with 2.2?
I Post You Post - Forum Owners Helping Forum Owners

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #9 on: April 02, 2009, 07:41:56 PM »
Try it ?

Should do no ?

The code worked on my display.template for smf2

Except it should be based on your id_post_group and not on your primary id_group which far as I can tell you need to tell the query that your id_group = id_post_group which is found in 'members' and not membergroups.

I think.

I'm not very clued up on mysql.
Giving me an headache. :P
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #10 on: April 03, 2009, 02:11:06 AM »
For 2.2 (SMF 2.0 RC1):

SPortal2.php

Find:

Code: [Select]
$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];
Replace:

Code: [Select]
$member_info['karma']['total'] = $member_info['karma']['good'] - $member_info['karma']['bad'];

global $smcFunc;
$request = $smcFunc['db_query']('', '
SELECT min_posts
FROM {db_prefix}membergroups
WHERE min_posts > {int:current}
ORDER BY min_posts
LIMIT 1',
array(
'current' => $member_info['posts'],
)
);
list ($next_post) = $smcFunc['db_fetch_row']($request);
$smcFunc['db_free_result']($request);
$next_post_left = $next_post - $member_info['posts'];

Find:

Code: [Select]
<li>', sp_embed_image('dot'), ' <strong>', $txt['posts'], ':</strong> ', $member_info['posts'], '</li>';
Replace:

Code: [Select]
<li>', sp_embed_image('dot'), ' <strong>', $txt['posts'], ':</strong> ', $member_info['posts'], '</li>
<li>', sp_embed_image('dot'), ' <strong>Next Post Left:</strong> ', $next_post_left, '</li>';

Moving this to the Custom Coding board as this will not be a default feature.
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #11 on: April 03, 2009, 02:32:45 AM »
That gave me a 500 error?

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #12 on: April 03, 2009, 02:36:22 AM »
Take the change back. That error is quite normal when you have a database error in built-in block codes. Are you using SMF 2.0 RC1?
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #13 on: April 03, 2009, 02:41:35 AM »
I undid the change, yes I have RC1

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #14 on: April 03, 2009, 02:50:42 AM »
Now I have SimplePortal 2.2 installed on a SMF 2.0 RC1 forum and the edit I gave above works perfectly. Would you attach your SPortal2.php file here so that I can check it?
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #15 on: April 03, 2009, 02:53:52 AM »
Here ya go...thanks for the help

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #16 on: April 03, 2009, 02:56:51 AM »
Here you are. Tested on my forum too.

As a note, either your editor or your FTP Client replace the line brakes in your files for some reason. I see them double in my editor.
« Last Edit: April 03, 2009, 02:59:55 AM by [SiNaN] »
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #17 on: April 03, 2009, 03:00:43 AM »
Perfect! Thank you very much!

LOL Only thing is that is says..." Next Post Left: -1152" cuz I already reached the max posts. Easy enough though, just increase the next post level :D

Thanks again

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #18 on: April 03, 2009, 03:04:14 AM »
Lol. Use this then. :D
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #19 on: April 03, 2009, 03:08:06 AM »
There we go! Thanks a lot!

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #20 on: April 03, 2009, 03:08:29 AM »
You're welcome!
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #21 on: April 03, 2009, 03:11:35 AM »
Ok I lied, it's almost perfect how about saying what the next post level is? :D

I know you're busy supporting the new release but when you get a moments that would be cool.

Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #22 on: April 03, 2009, 03:14:50 AM »
Okay, I'm in a good mood today. :P
And slowly, you come to realize... It's all as it should be...

Offline mrtrc266

  • Jr. Member
  • **
  • Posts: 91
  • Gender: Male
    • Monsters Mansion
  • SMF Version: 2 RC3
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #23 on: April 03, 2009, 03:17:58 AM »
You are da Bomb! Thanks again!


Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #24 on: April 03, 2009, 08:29:26 AM »
can you tell me how I could get the info based from the users post group rather than their primary group as none post based groups are by default set at "-1".

id_post_group is found in "members" and not "membergroups"

Thank you.
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #25 on: April 03, 2009, 08:33:42 AM »
Sorry but I couldn't get the relation between primary group, -1 and this. Could you elaborate your question?
And slowly, you come to realize... It's all as it should be...

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #26 on: April 03, 2009, 09:00:10 AM »
Hmmm Ok.

In my mySQL database all members that are assigned to none post based groups like admin, global moderators, vip members and producers have "-1" as default in in membergroups min_posts but in the db in members each member also has id_post_group which is the users true post group rather then being based on membergroups id_group which is based on users primary group which in my case most members are in a none post based group called producers.

I was wondering how to make it so that it works from members id_post_group rather than their primary group id.

Thank you & sorry for the epic reply I'm not very good at explaining things.
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #27 on: April 03, 2009, 09:10:45 AM »
So you don't want the Next Level to be calculated/displayed when user has a primary group set?
And slowly, you come to realize... It's all as it should be...

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #28 on: April 03, 2009, 09:18:37 AM »
There's nothing to calculate.

I'd like it to get the users id_group based on member id_post_group

Then even if user has a none post based primary group it will still display the levels until next post based count.

I think. :P

I'm not very good with this mysql query stuff.

Taaa  :thumbsup:
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #29 on: April 03, 2009, 09:24:30 AM »
Codes I gave gives you the count of posts needed for next level of post count based group regardless of the users' primary group status. Even if user has a non-post count based primary group, it will give the correct next level post count value.
And slowly, you come to realize... It's all as it should be...

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #30 on: April 03, 2009, 09:29:48 AM »
Oh right, sorry mate.

I guess it must be my end as I was trying to apply it to display.template within threads so I guess it must be applying the same thing to each person.
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #31 on: April 03, 2009, 09:36:12 AM »
What codes are you using there? The same won't work.
And slowly, you come to realize... It's all as it should be...

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #32 on: April 03, 2009, 09:49:40 AM »
I noticed.

The other coder on my site said he would look into it tomorrow.

I was trying to make %bars using bar.gif and sums depending on what users post group is.

It works fine with the first if statement but for all the rest of the users with more than the first if statement it just displays bar at 100% and isn't going to the next elseif.

Like I said I'm not very efficient with mySQL, sorry to bother you.
0ot


Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #33 on: April 03, 2009, 10:03:11 AM »
I got your code to work on display.template.php
for user info on threads. :D

Now to get the graph code working.

I think I should be able to get that working now taaa.

Code: (Code I used for display.template SMF 2.04b) [Select]
      // setup next level
  global $smcFunc, $memberContext;
      $request = $smcFunc['db_query']('', '
         SELECT min_posts
         FROM {db_prefix}membergroups
         WHERE min_posts > "'.$message['member']['posts'].'"
         ORDER BY min_posts
         LIMIT 1',
         array(
         )
      );
      list ($next_post) = $smcFunc['db_fetch_row']($request);
      $smcFunc['db_free_result']($request);
      $next_post_left = $next_post - $message['member']['posts'];
 
  // show next level
  echo 'Nxt Lvl In: ', $next_post_left, ' Posts<br/>';
0ot


Offline [SiNaN]

  • Mr. SimplePortal
  • Developer
  • *
  • Posts: 6782
  • SMF Version: 2.0.15
  • SP Version: 2.3.7
Re: Next Level (countdown)
« Reply #34 on: April 03, 2009, 10:29:45 AM »
Code: [Select]
echo '<img src="', $settings['images_url'], '/bar.gif" width="', (int) (($next_post_left/$next_post) * 100), '" height="15" alt="" />';
And slowly, you come to realize... It's all as it should be...

Offline KahneFan

  • Jr. Member
  • **
  • Posts: 83
    • I Post You Post
  • SMF Version: 2 RC1.2
  • SP Version: 2.3.1
Re: Next Level (countdown)
« Reply #35 on: April 03, 2009, 03:30:58 PM »
Perfect, thanks!!
I Post You Post - Forum Owners Helping Forum Owners

Offline Sentinel [AF]

  • Semi Newbie
  • *
  • Posts: 25
  • Gender: Male
  • Mr Grumpy
    • Alternating Frequencies
  • SMF Version: 2 Beta 4
  • SP Version: 2.0.5
Re: Next Level (countdown)
« Reply #36 on: April 03, 2009, 08:07:12 PM »
Thanks :thumbsup:

I'll try that now.
Not been having much luck at my end :P

Ok that makes go down backwards like how I started off earlier on.
I made a calculation to make it go upwards instead but the problem is that it doesn't take into account that with each level it needs to reset to 100% full or 0% depending on whether you are decreasing or increasing the bar.

So I made a few $variables to try and make it remove the previous $next_post from both the $message['member']['post's] & the $next_post total but for some reason it isn't taking them into account.

I'll figure it out though- eventually.
HaHa this php & sql stuff is complicated.
« Last Edit: April 03, 2009, 08:20:03 PM by TheSentinel »
0ot