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: 195
  • 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]

Welcome to SimplePortal.net! You can download SimplePortal from the Downloads Area!

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

0 Members and 1 Guest 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!