Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

default picture in profile

edited December 2006 in Vanilla 1.0 Help
hello, is there an extension, or any other "trick" to set a default picture in every users profile? i don't want an empty div in the profiles which were not editet by their users. when the user choose his own profile picture the default has to be gone. thank you

Comments

  • I think you could probably make a simple extension that hooks on the people.php page and finds some hook in there. Once you've got it, get to the user object and you can probably just find a blank for the image and replace it.

    That's probably a 10 line extension if you can find the right hook.
  • The easiest way would be to search through all your users in the user table and replace empty Picture location with your default image. This would require you to check your user information periodically. An extension could be written from using the information in the account script, I believe.
  • The li class="Picture" doesn't show if you don't have a User Picture set, so you don't have any extraneous code to worry about there.

    But if you want a default image if none is set, an even easier way would be to adapt the template. You wouldn't need to touch the user tables.

    Make a copy of \themes\account_profile.php in a new folder of your own name and edit line 23 beginning:
      if ($this->User->Picture != "" && $this->User->Permission('PERMISSION_HTML_ALLOWED')) 
    so that you have an if user picture display own user pic else display standard pic.

    If you mean the gravatar, I believe that's called authIcon and you could apply the same principle for that too (also for the threads - see line 78 comments.php).

    Afterwards you need to set vanilla to use your new theme. It will then use your modified files instead of vanilla's own. By working on a copy on a new theme, you don't need to hack vanilla's own files and you won't have the problem of your files being overwritten when vanilla is updated.
  • okay. thank you for your answers. i just editet line 23 like this: if ($this->User->Picture != "/styles/default/standard.gif" && $this->User->Permission('PERMISSION_HTML_ALLOWED')) echo "<li class=\"Picture\" style=\"background-image: url('".$this->User->Picture."');\"> </li>"; the account_profile.php in "/themes/myownstyle/account_profile.php" the standard.gif in "/themes/myownstyle/styles/default/standard.gif" so the paths are okay i think. in profiles now a blank (transparent) placeholder is shown, but the standard.gif is not displayed.
  • I think the way you've done it each user pic has to be set as "/styles/default/standard.gif" so you would have to add that to each user for it to work. It's easier to check if it contains something (!= "") { then output own image } else { output standard image }.
This discussion has been closed.