MyBB Support

Registered time function MyBB?

Submitted by AndresXZ09, , Thread ID: 2741

Thread Closed

RE: Registered time function MyBB?

AndresXZ09
Closed Account
Level:
0
Reputation:
30
Posts:
1.22K
Likes:
140
Credits:
1.51K
OP
12-04-2015, 06:00 PM
#9
12-04-2015, 05:58 PM
AmN Wrote:
huh.

$plugins->add_hook( 'postbit', 'years_of_service' );

function years_of_service(&$post)
{
Code:
$yearsofservice = date( 'Y', TIME_NOW - $post['userregdate'] );
        $years = ( $yearsofservice == 1  ) ? 'year' : 'years';
        return str_replace( '<years_of_service>',' $yearsofservice . ' ' . $years . ' of service', $post['message'] );
}

and place this in your postbit template: <years_of_service> where you want that stuff to display.

I wanted to learn actually :noh: but thank you anyway, I'll try to base my plugin on that but with configurable settings on the ACP Tongue

Users browsing this thread: 1 Guest(s)