1 (edited by asd9991 2007-06-17 01:06)

Topic: Registration Date and the Posts per day average

how can I  change the poster registration date?
and I want to add the average Posts per day for poster but don't know how to do it, help me please.

Thanks in advance. smile

Re: Registration Date and the Posts per day average

Registration date is stored as a unix timestamp in the database. A simple update statement would change it for you.
And average posts per day would simply be
# posts / # days since registration
# posts is recorded in the database
#days is simply the current time minus the registration timestamp divided by 86400 and rounded down.

Re: Registration Date and the Posts per day average

I forgot to mention that I'm new to this so please can you be more specific and give me a step by step guide .

Re: Registration Date and the Posts per day average

Changing registration date/time:

update prefixusers set registered = timestamp where id = #

where prefix is your database prefix, timestamp is the new unix timestamp, and # is the ID of the user whose registration time you want to change

Posts per day (for the current, logged in user):

$posts_per_day = $pun_user['num_posts'] / floor((time() - $pun_user['registered']) / 86400);

Re: Registration Date and the Posts per day average

Where do i put this code?
I'm a n00b, so please bare with me...

Re: Registration Date and the Posts per day average

The first bit I gave you is an SQL query. Execute it as you would any other.
The second bit simply stores the average posts per day in a variable. Put it where you need it, echo it out (you will need to change the variables, obviously, if you're not using it for the currently logged in user but are using information from elsewhere).

Re: Registration Date and the Posts per day average

I don't know how to execute an SQL query...

Re: Registration Date and the Posts per day average

asd9991 wrote:

I don't know how to execute an SQL query...

You can use the DB management plugin.

Looking for a certain modification for your forum? Please take a look here before posting.

9 (edited by asd9991 2007-06-19 03:39)

Re: Registration Date and the Posts per day average

Thanks a lot man!

Re: Registration Date and the Posts per day average

I have fixed the registration date.
As for my second question, I want to displays the user's post per day average underneath the posts. something like this. http://aycu05.webshots.com/image/16724/ … 553_rs.jpg
I have tried to run this code

$posts_per_day = $pun_user['num_posts'] / floor((time() - $pun_user['registered']) / 86400);

As an SQL Query, it didn't work.
Please help me.

Re: Registration Date and the Posts per day average

That code is PHP, not an SQL query

Re: Registration Date and the Posts per day average

So, i put the code in a file rename it into something.php and upload it into the forum directory?

Re: Registration Date and the Posts per day average

asd9991 wrote:

So, i put the code in a file rename it into something.php and upload it into the forum directory?

This did not work sad
Help me please.

Re: Registration Date and the Posts per day average

Moved to Modifications

Re: Registration Date and the Posts per day average

Now, if you want to make it look like that...

FIND

            if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];

REPLACE WITH

            if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'].' ('.round($pun_user['num_posts'] / floor((time() - $pun_user['registered']) / 86400), 2).' posts/day)';

Re: Registration Date and the Posts per day average

I've tried to run this query but it didn't work
FIND if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];
REPLACE WITH if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'].' ('.round($pun_user['num_posts'] / floor((time() - $pun_user['registered']) / 86400), 2).' posts/day)';

Re: Registration Date and the Posts per day average

That is not an SQL query. It looks nothing like an SQL query. It is PHP. You need to open viewtopic.php, find the code I posted in the FIND block, and replace it with the code I posted in the REPLACE WITH block.

Re: Registration Date and the Posts per day average

I DID IT!!!!!!!!!!!
THNX

19 (edited by asd9991 2007-06-19 23:37)

Re: Registration Date and the Posts per day average

Oh wait, there something wrong, every member have the same average.:|
What I want is for example asd9991 has 12 Posts and registered 4 days ago so his average will be 12/4= 3, Smartys has  5047 Posts and registered 1164 days ago so his average will be 5047 /1164 = 4.33

Re: Registration Date and the Posts per day average

That's what I get for doing it too fast, here's the way it should be

FIND

            if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];

REPLACE WITH

            if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
                $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'].' ('.round($cur_post['num_posts'] / floor((time() - $cur_post['registered']) / 86400), 2).' posts/day)';