Advertisement
Guest User

Untitled

a guest
Feb 6th, 2012
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. if ( is_user_logged_in() ) {
  2. get_currentuserinfo();
  3. global $user_level, $user_identity;
  4. global $current_user;
  5.  
  6. //Vai buscar o id do utilizador logado
  7. $current_user = wp_get_current_user();
  8.  
  9. $key = 'fileira';
  10. $single = true;
  11. echo ('Benvindo(a) <a href="' . get_settings('home') . '/wp-admin/profile.php">' . $user_identity . '</a> ');
  12.  
  13. //Vai buscar o valor do campo fileira
  14. $user_last = get_user_meta( $current_user->ID, $key, $single );
  15.  
  16. //obter o nome das categorias
  17. $categories = get_categories( $args );
  18. foreach ($categories as $category) {
  19. $nome = $category->cat_name;
  20. }
  21.  
  22. //Comparar o valor do campo fileira com o nome das fileiras/categorias
  23. if($user_last == $nome) {
  24.  
  25. //mostra o link para a fileira
  26. echo ('<a href="' . get_settings('home') . '/posts/category/'.$user_last.'">' . $user_last . '</a> ');
  27. }
  28.  
  29. else
  30. {
  31. //mostra só o valor do campo da fileira, sem link
  32. echo '<p>Fileiras: '. $user_last . '</p>';
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement