Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: wtfwtf on January 01, 2019, 07:13:22 PM

Title: post rank id in code
Post by: wtfwtf on January 01, 2019, 07:13:22 PM
hello
is there a way to specify a specific post rank id in the code
example:
 postrank[1]
Title: Re: post rank id in code
Post by: Kindred on January 01, 2019, 09:53:08 PM
No. It is calculated,  not specified
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 04:14:08 AM
No. It is calculated,  not specified

is there a way to execute code specific to post count rank ?
Title: Re: post rank id in code
Post by: Arantor on January 02, 2019, 04:18:27 AM
Depends what you want to do and where, bearing in mind that post counts are recalculated every single time anyone makes a post, and recalculated for every single user, potentially, at that same time.
Title: Re: post rank id in code
Post by: Aleksi "Lex" Kilpinen on January 02, 2019, 04:24:50 AM
Basically, yes that should be possible by using the membergroup ids, but depending on the specific usecase it might not be the best of ideas.
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 10:35:40 AM
guys, i appreciate the opinions and the philosophical input
but i need concrete answers , concrete code to find
so that i can modify

thank you
Title: Re: post rank id in code
Post by: Illori on January 02, 2019, 10:38:51 AM
we need concrete answers from you so we can provide you code that will WORK.
Title: Re: post rank id in code
Post by: Aleksi "Lex" Kilpinen on January 02, 2019, 10:47:55 AM
Would help to know exactly what you want to do and where.

To specify something for a user with less or more than X posts, you can use $user_info['posts']
To specify something for a user in a certain membergroup, you can use $user_info['groups']
https://wiki.simplemachines.org/smf/$user_info (https://wiki.simplemachines.org/smf/$user_info)

To go further, we would probably all want to know what you are trying to do.
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 01:45:47 PM
Would help to know exactly what you want to do and where.

To specify something for a user with less or more than X posts, you can use $user_info['posts']
To specify something for a user in a certain membergroup, you can use $user_info['groups']
https://wiki.simplemachines.org/smf/$user_info (https://wiki.simplemachines.org/smf/$user_info)

To go further, we would probably all want to know what you are trying to do.

thanks Lex, that would be pretty helpful i think
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 01:46:44 PM
Would help to know exactly what you want to do and where.

To specify something for a user with less or more than X posts, you can use $user_info['posts']
To specify something for a user in a certain membergroup, you can use $user_info['groups']
https://wiki.simplemachines.org/smf/$user_info (https://wiki.simplemachines.org/smf/$user_info)

To go further, we would probably all want to know what you are trying to do.

does the $user_info['groups']
also applies for post based groups ?
Title: Re: post rank id in code
Post by: Arantor on January 02, 2019, 02:14:57 PM
Under some circumstances, yes. But more details about what you’re trying to do now would be useful.
Title: Re: post rank id in code
Post by: Kindred on January 02, 2019, 02:47:26 PM
are you just trying to determine which group a user is in?
(e.g. show this if user is not Newbie)
or, are you trying to SET the group? (which is what you first post suggested)

If the first, then what lex said...  but we can help further if you tell us details like what you are actually trying to do...
if the second, then no, as I said.
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 02:59:20 PM
are you just trying to determine which group a user is in?
(e.g. show this if user is not Newbie)
or, are you trying to SET the group? (which is what you first post suggested)

If the first, then what lex said...  but we can help further if you tell us details like what you are actually trying to do...
if the second, then no, as I said.

i am looking to block post count based on post count, date registered and time online, thus blocking the ranking up until specific conditions are met.
i can do this via a series of conditions that would take place before the update post count take place
Title: Re: post rank id in code
Post by: Aleksi "Lex" Kilpinen on January 02, 2019, 04:15:49 PM
Okay, now that's not gonna be so easy. The user_info variables are meant for checking what is, not defining what should be.
Title: Re: post rank id in code
Post by: Arantor on January 02, 2019, 04:18:11 PM
are you just trying to determine which group a user is in?
(e.g. show this if user is not Newbie)
or, are you trying to SET the group? (which is what you first post suggested)

If the first, then what lex said...  but we can help further if you tell us details like what you are actually trying to do...
if the second, then no, as I said.

i am looking to block post count based on post count, date registered and time online, thus blocking the ranking up until specific conditions are met.
i can do this via a series of conditions that would take place before the update post count take place

No, you really can’t, not without rewriting how post count group calculation is done.
Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 04:47:41 PM
Okay, now that's not gonna be so easy. The user_info variables are meant for checking what is, not defining what should be.

 if ($user_info['posts'] == 20  || $user_info['posts'] == 60   || $user_info['posts'] == 100  || $user_info['posts'] == 200 )
    {
      $regy =  time()  - DateRegistered;
      rankPost = $regy  >= (1000 * 3600) ? true : false;
    }
    else
      $rankPost = true;

<![CDATA['update_post_count' => !$user_info['is_guest'] && !isset($_REQUEST['msg']) && $board_info['posts_count'] && $rankPost,]]>

Title: Re: post rank id in code
Post by: wtfwtf on January 02, 2019, 06:03:51 PM
remarks ?
Title: Re: post rank id in code
Post by: Kindred on January 02, 2019, 08:00:43 PM
Seems overly complicated and basically useless
Title: Re: post rank id in code
Post by: Aleksi "Lex" Kilpinen on January 03, 2019, 12:49:26 AM
Can't say much, not a part of SMF codebase I am very familiar with, but I am wondering where you would do this exactly. And if it wouldn't actually break something. But it's always good to experiment I guess.
Title: Re: post rank id in code
Post by: Arantor on January 03, 2019, 02:36:18 AM
Wait, those are your thresholds? No wonder you have issues! There is your problem, make the gaps between them waaaaay bigger. Like a scale more like 0/25/50/100/500/1000/2500/5000.