lesd1315 (@lesd1315)

Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • @lesd1315

    Participant

    Thank you – I wasn’t aware of all the tools for bbPress. That solves the problem.

    @lesd1315

    Participant

    <?php

    register_activation_hook(__FILE__, ‘bbpress_topic_scheduler’);

    add_action(‘bbpress_daily_event’, ‘bbpress_delete_old_topics’);

    function bbpress_topic_scheduler() {
    wp_schedule_event(time(), ‘daily’, ‘bbpress_daily_event’);
    }

    function bbpress_delete_old_topics() {
    // Auto delete old topics
    $topics_query = array(
    ‘author’ => 0,
    ‘show_stickies’ => false,
    ‘parent_forum’ => ‘any’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1
    );

    if ( bbp_has_topics( $topics_query ) )
    while( bbp_topics() ) {
    bbp_the_topic();
    $topic_id = bbp_get_topic_id();
    $topic_date = strtotime( get_post( $topic_id, ‘post_date’, true ) );
    $forum_id = bbp_get_topic_forum_id($topic_id);

    if ($topic_date = strtotime( ‘-90 days’) && $forum_id == 17777 )
    bbp_delete_topic( $topic_id ); }
    }
    ?>

    @lesd1315

    Participant

    I get the following error using the code in my functions.php file

    PHP Warning: strtotime() expects parameter 1 to be string, object given

    the line cited in the above warning is
    $topic_date = strtotime( get_post( $topic_id, 'post_date', true ) );

Viewing 3 replies - 1 through 3 (of 3 total)