2 specific issues about extending
-
Hello,
I am trying to create 2 functionalities and i would like to ask for your help please.
1. Trying to get all users with WP_User_Query that have not been active for last 60 days
// Get the contributors and administrators who haven't logged in for 60 days $args = array( 'role__in' => array( 'contributor', 'administrator' ), 'meta_key' => 'last_activity', // this is a meta_key storing the last time the user was logged in by buddypress in 'Y-m-d H:i:s' format 'meta_query' => array( array( 'key' => 'last_activity', 'value' => date('Y-m-d H:i:s', strtotime( "-60 days" )), // what am i doing wrong? 'compare' => '<', 'type' => 'DATE' // Let WordPress know we're working with date ) ) ); $remind_users = new WP_User_Query( $args );
-What am i doing wrong on the comparison?
2. Send en email notification to specific users when there is a sidewide notice on our website.
function important_notification() { $notification = '' . bp_get_message_notice_text( $notice->message ) . ''; $args = array( 'meta_key' => '_is_featured' ); $members = get_users( $args ); foreach( $members as $member ) { $user_id = $member->ID; $member_account = bp_core_get_user_domain( $user_id ); $first_name = $member->first_name; $email_subject = 'Important information'; $message = sprintf( 'Hello %1$s,' , $first_name ) . "<br><br>"; $message .= sprintf( 'We have an important information for you:' ) ."<br><br>"; $message .= sprintf( '<i>%1$s</i>' , $notification ) ."<br><br>"; $message .= sprintf( 'Please login <a href="%1$s" target="_blank">to your account</a> to remove the information if you want.' , $member_account ) ."<br><br>"; wp_mail( $member->user_email, $email_subject, $message ); } } add_action( 'xxxxxxxx', 'important_notification');
-Will the
$notification = '' . bp_get_message_notice_text( $notice->message ) . '';
get the message text of the sidewide notice?
-In which action could i hook this function in order to send an email when admin will publish a sidewide notification?
add_action( ‘xxxxxxxx’, ‘important_notification’);Thank you very much for your time.
- You must be logged in to reply to this topic.