MyBB Community Forums

Full Version: Add message to users with X time registered
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

I'm looking for a way to display X text on users postbit after a year has passed since his registration, two years and so on.

A guy on another forum told me about the timestamp but I don't know how to use it properly.

I though on do something like if ($mybb->user['regdate'] => the date, timestamp or I don't know ) { echo "The message"; }

What do you guys think so far, how could it be done?
$plugin->add_hook('postbit', 'x_run');


function x_run(&$post) {
      if($post['regdate'] > strtotime('-2 years'))  // Make a static int afterwards
                $post['the_display_bit'] = 'omg 2 years';
}

Then add {$post['the_display_bit']} to the postbit template.
(2015-04-20, 12:17 AM)Rakes Wrote: [ -> ]
$plugin->add_hook('postbit', 'x_run');


function x_run(&$post) {
      if($post['regdate'] > strtotime('-2 years'))  // Make a static int afterwards
                $post['the_display_bit'] = 'omg 2 years';
}

Then add {$post['the_display_bit']} to the postbit template.

or this in the template postbit or postbit_classic

<if $post['regdate']+(60*60*24*365) <= TIME_NOW then>1 Year</if>

<if $post['regdate']+(60*60*24*730) <= TIME_NOW then>2 Years</if>

but imo a plugin is better.
(2015-04-24, 07:59 PM)Akay Wrote: [ -> ]
(2015-04-20, 12:17 AM)Rakes Wrote: [ -> ]
$plugin->add_hook('postbit', 'x_run');


function x_run(&$post) {
      if($post['regdate'] > strtotime('-2 years'))  // Make a static int afterwards
                $post['the_display_bit'] = 'omg 2 years';
}

Then add {$post['the_display_bit']} to the postbit template.

or this in the template postbit or postbit_classic

<if $post['regdate']+(60*60*24*365) <= TIME_NOW then>1 Year</if>

<if $post['regdate']+(60*60*24*730) <= TIME_NOW then>2 Years</if>

but imo a plugin is better.

That doesn't make it over write the other one
(2015-06-12, 05:32 PM)Patchy the Pirate Wrote: [ -> ]
(2015-04-24, 07:59 PM)Akay Wrote: [ -> ]
(2015-04-20, 12:17 AM)Rakes Wrote: [ -> ]
$plugin->add_hook('postbit', 'x_run');


function x_run(&$post) {
      if($post['regdate'] > strtotime('-2 years'))  // Make a static int afterwards
                $post['the_display_bit'] = 'omg 2 years';
}

Then add {$post['the_display_bit']} to the postbit template.

or this in the template postbit or postbit_classic

<if $post['regdate']+(60*60*24*365) <= TIME_NOW then>1 Year</if>

<if $post['regdate']+(60*60*24*730) <= TIME_NOW then>2 Years</if>

but imo a plugin is better.

That doesn't make it over write the other one

<div align="center"><if $post['regdate']+(60*60*24*30) <= TIME_NOW then>1 month<elseif $post['regdate']+(60*60*24*60) <= TIME_NOW then>2 months</div></if>

should work
You don't know how to make it over write the other one.

I use it in my forum.
(2015-06-12, 07:25 PM)Lektz Wrote: [ -> ]You don't know how to make it over write the other one.

I use it in my forum.

Just use elseif statement. :fp:
(2015-06-12, 08:33 PM)Akay Wrote: [ -> ]
(2015-06-12, 07:25 PM)Lektz Wrote: [ -> ]You don't know how to make it over write the other one.

I use it in my forum.

Just use elseif statement. :fp:

I was referring to Pirate lol
(2015-06-13, 01:49 PM)Lektz Wrote: [ -> ]
(2015-06-12, 08:33 PM)Akay Wrote: [ -> ]
(2015-06-12, 07:25 PM)Lektz Wrote: [ -> ]You don't know how to make it over write the other one.

I use it in my forum.

Just use elseif statement. :fp:

I was referring to Pirate lol

I posted the solution, but nope, his forum is weird af since it can't handle elseif it seems like (threads went crazy n stuff) lol.