• Resolved autox420

    (@autox420)


    Result: https://i.imgur.com/GOuP9Ic.png
    functions.php

    add_action('asgarosforum_after_post_author', 'my_function_asgaros_cabinet', 10, 1);
    function my_function_asgaros_cabinet($author_id) {
      echo '</br><img src="https://i.imgur.com/bgwZcHq.png" /></br>';

    I would like to put user description instead of an image.
    Get it from user profile ( all users has descriptions in my wordpress )
    Get_description_that_specific_user

    So it looks like this: https://i.imgur.com/BU0VFkN.png

    Can someone help?

    • This topic was modified 7 years ago by autox420.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Asgaros

    (@asgaros)

    Add this code to your themes functions.php file:

    add_action('asgarosforum_after_post_author', 'my_function_asgaros_cabinet', 10, 1);
    function my_function_asgaros_cabinet($author_id) {
      $userData = $this->getUserData($author_id);
      
      if (!empty($userData) && !empty($userData->description) {
        echo $userData->description;
      }
    }
    Thread Starter autox420

    (@autox420)

    HTTP ERROR 500

    Cant get into the site if i use that code.

    • This reply was modified 7 years ago by autox420.
    Plugin Author Asgaros

    (@asgaros)

    add_action('asgarosforum_after_post_author', 'my_function_asgaros_cabinet', 10, 1);
    function my_function_asgaros_cabinet($author_id) {
      $userData = getUserData($author_id);
      
      if (!empty($userData) && !empty($userData->description) {
        echo $userData->description;
      }
    }
    Thread Starter autox420

    (@autox420)

    That was exactly the same code as before.

    HTTP ERROR 500

    Cant get into the site if i use that code.

    Plugin Author Asgaros

    (@asgaros)

    It was not the same code as before.

    Before:

    $userData = $this->getUserData($author_id);

    After:

    $userData = getUserData($author_id);

    Here is another try:

    add_action('asgarosforum_after_post_author', 'my_function_asgaros_cabinet', 10, 1);
    function my_function_asgaros_cabinet($author_id) {
      $userData = get_userdata($author_id);
      
      if (!empty($userData) && !empty($userData->description) {
        echo $userData->description;
      }
    }
    Thread Starter autox420

    (@autox420)

    Last code same problem

    HTTP ERROR 500

    Plugin Author Asgaros

    (@asgaros)

    I missed a parenthesis. Writing code on the smartphone is not a good idea. Now it should work for sure.

    add_action('asgarosforum_after_post_author', 'my_function_asgaros_cabinet', 10, 1);
    function my_function_asgaros_cabinet($author_id) {
      $userData = get_userdata($author_id);
    
      if (!empty($userData) && !empty($userData->description)) {
        echo $userData->description;
      }
    }
    Thread Starter autox420

    (@autox420)

    Yes its working! Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘User description under avatar’ is closed to new replies.