BuddyDev

Search

[Resolved] Featured Member: time limit option

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16283

    Thank you for the help Sanjay.

    Yes, you are right, you can either put the file or the whole folder in wp-content/plugins and it will work. It is just like a normal plugin. You will need to activate it too. It uses cron to remove users on hourly basis.

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on #16333

    Hello
    I tried several variants but never the display of “BP Featured Member” disappeared from the widget
    Last try with `private function get_interval() {
    return 1 * 60;
    } `
    I was wondering where is the variable DAY_IN_SECONDS?
    Regards

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16334

    Hi Herve,
    1. Tried several variant:- 60 means 60 seconds but the cron job will only remove it after an hour(It checks hourly). Also, only newer members marked after you change the time will have the new time.

    So, change it to say 120( 2 minutes), Mark a user as featured member after the change and check after an hour.

    DAY_IN_SECONDS is a constant that WordPress defines which is equivalent to 24*60*60( 86400) seconds.

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on #16337

    Hi Brajesh,
    Each time, I always waited several hours or a day !?
    Regards

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16338

    That would be strange. Is there any chance that WordPress Cron is disabled by your web host?

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on #16339

    Hi Brajesh,

    It works well even if it’s not every 3 minutes
    [16-Jul-2018 09:35:04 UTC] Test every 3 minutes
    [16-Jul-2018 10:01:03 UTC] Test every 3 minutes

    add_filter( 'cron_schedules', 'isa_add_every_three_minutes' );
    function isa_add_every_three_minutes( $schedules ) {
        $schedules['every_three_minutes'] = array(
                'interval'  => 180,
                'display'   => __( 'Every 3 Minutes', 'woffice' )
        );
        return $schedules;
    }
    // Schedule an action if it's not already scheduled
    if ( ! wp_next_scheduled( 'isa_add_every_three_minutes' ) ) {
        wp_schedule_event( time(), 'every_three_minutes', 'isa_add_every_three_minutes' ); // {  wp_schedule_event( time(), 'hourly', 'my_task_hook' );
    }
    // Hook into that action that'll fire every three minutes
    add_action( 'isa_add_every_three_minutes', 'every_three_minutes_event_func' );
    function every_three_minutes_event_func() {
              error_log("Test toutes les 3 mn");
    }

    Regards

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on #16341

    Re
    Perhaps interesting information:

    
    [16-Jul-2018 10:20:15 UTC] Test toutes les 3 mn
    [16-Jul-2018 10:59:47 UTC] Test toutes les 3 mn
    [16-Jul-2018 10:59:47 UTC] Erreur de la base de données WordPress You can't specify target table 'wpamo2_usermeta' for update in FROM clause pour la requête DELETE FROM wpamo2_usermeta WHERE ( meta_key='_is_featured' OR meta_key='_bpfm_featured_at_time' ) AND user_id IN ( SELECT user_id FROM wpamo2_usermeta WHERE meta_key = '_bpfm_featured_at_time'  AND CAST( meta_value AS UNSIGNED ) < 1531738727 ) faite par do_action_ref_array, WP_Hook->do_action, WP_Hook->apply_filters, BP_Featured_Member_Expirable_Membership->remove_featured
    

    but then why only now !?

    • This reply was modified 6 years, 4 months ago by Hervé.
  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16344

    Hi Herve,
    It seems there is a problem with the sql. We might have to break it into 2 queries instead of one.

    I will push an update. I am not sure why it is showing now, It should have shown the error earlier too.

  • Participant
    Level: Enlightened
    Posts: 126
    Hervé on #16378

    Hi Brajesh,
    It’s not every 3 minutes because there is no visit to this test site!
    no urgent but , am I in the list?
    regards

  • Keymaster
    (BuddyDev Team)
    Posts: 24623
    Brajesh Singh on #16410

    Hi Herve,
    I have fixed the query. Please use the updated plugin.
    https://github.com/buddydev/bp-featured-member-expirable-membership

    Regard
    Brajesh

You must be logged in to reply to this topic.

This topic is: resolved