• Resolved khoich

    (@khoich)


    Hello,

    I try to perform my own actions using an ‘expire_users_expired’ hook.
    But have no idea how to use it with wp_set_object_terms?

    I try to add this in functions.php but it does not work.

    function myhandle_on_expire( $expired_user ) {
    		wp_set_object_terms('22', NULL, 'recommend');
    }
    add_action( 'expire_users_expired', 'myhandle_on_expire' );

    Please suggest. Thanks in advance.

    http://ww.wp.xz.cn/extend/plugins/expire-users/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Ben Huson

    (@husobj)

    Please explain what you are trying to do when a user expires.
    It looks like you are trying to disassociate a post with ID 22 from a taxonomy?

    Thread Starter khoich

    (@khoich)

    Yes, I’m trying to disassociate a post with ID 22 from a taxonomy as you said.
    But not successful with my code. Post ID 22 still associate with taxonomy after the user expired. Did I use the ‘expire_users_expired’ hook in a wrong way?

    Thread Starter khoich

    (@khoich)

    OMG. It’s my fault, I try to install the new wordpress and test again.
    Everything is working perfectly according to my wish.
    Maybe something went wrong in my code.
    Thanks for your kind help and thanks for the great plugins.

    Hi other time Ben!

    The Fist sorry for my English, i’m Sspanish and my English is not very good.
    The second thing, thanks for your plugin, it’s great.

    I don’t know how tu use the expire_user_expired hook. I need make 2 things, the first:

    I’m using your plugin for change the role of the user an i need change the expiration meta_key on user to N, if this value it’s set to Y the user can’t login on the web.

    I try with this code on functions.php

    function my_expire_users_expired( $user ) {
            $wpdb->query("UPDATE $wpdb->usersmeta SET meta_value = 'N' WHERE user_id = $expired_user AND meta_key = '_expire_user_expired'");
    }

    Where I write the add_action? If i put the add_action code on fucntions.php the wordpress don’t work.

    The second thing to make when user expired is submit a form with ajax, but this I will make when the first will be OK.

    Thanks other time!

    Plugin Author Ben Huson

    (@husobj)

    The action should work fine in your functions.php file:

    function my_expire_users_expired( $user ) {
    	update_user_meta( $user->user_id, '_expire_user_expired', 'N' );
    }
    add_action( 'expire_users_expired', 'my_expire_users_expired' );

    Don’t work πŸ™

    I put your code at the end of the functions.php

    I have wordpress 3.7.1 es_ES, Expire users plugins

    I need download anything else?

    Plugin Author Ben Huson

    (@husobj)

    Is the role changing OK?
    Try:

    function my_expire_users_expired( $user ) {
    	$user->remove_expire_date();
    	$user->save_user();
    }
    add_action( 'expire_users_expired', 'my_expire_users_expired' );

    Yes, the role is changin OK. I needed follow this steps for the cron 4 days ago.

    If i write your code

    function my_expire_users_expired( $user ) {
    	$user->remove_expire_date();
    	$user->save_user();
    }
    add_action( 'expire_users_expired', 'my_expire_users_expired' );

    in /wp-includes/functions.php the web don’t works, only show a white color. No error, no text, nothing only the white color. If I del the add_action line on fuctions.php the web works but when the user expire nothing happens.

    Thanks πŸ˜‰

    Plugin Author Ben Huson

    (@husobj)

    It should be in your theme’s function.php file in /wp-content/themes/your-theme

    Yes! It’s solved πŸ˜‰

    The code must be in function.php of our theme.

    Thanks!

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

The topic ‘expire_users_expired hook’ is closed to new replies.