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.
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → 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.
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.
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 .
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);
Where do i put this code?
I'm a n00b, so please bare with me...
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).
I don't know how to execute an SQL query...
I don't know how to execute an SQL query...
You can use the DB management plugin.
Thanks a lot man!
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.
That code is PHP, not an SQL query
So, i put the code in a file rename it into something.php and upload it into the forum directory?
So, i put the code in a file rename it into something.php and upload it into the forum directory?
This did not work
Help me please.
Moved to Modifications
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)';
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)';
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.
I DID IT!!!!!!!!!!!
THNX
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
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)';
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Registration Date and the Posts per day average
Powered by PunBB, supported by Informer Technologies, Inc.