Guest User

Untitled

a guest
Feb 21st, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. add_action('wp', function() {
  2.  
  3. if( is_author() ) {
  4.  
  5. global $authordata;
  6.  
  7. $user_ip = $_SERVER['REMOTE_ADDR'];
  8. $meta = get_user_meta( $curauth->ID, 'wcpf-count', TRUE );
  9. $meta = '' !== $meta ? explode( ',', $meta ) : array();
  10. $meta = array_filter( array_unique( $meta ) );
  11.  
  12. if( ! in_array( $user_ip, $meta ) ) {
  13.  
  14. array_push( $meta, $user_ip );
  15. update_user_meta( $curauth->ID, 'wcpf-count', '1' );
  16.  
  17. } } });
Add Comment
Please, Sign In to add comment