Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Default Avatar for User

Viewing 2 replies - 1 through 2 (of 2 total)

  • James
    Participant

    @janismo

    what I want is to have set of default avatars, with random one for every user.

    idea was to have additional function:

    `function randnum() {
    // Range creates an array from a range (in this case 1 – 10)
    $b = range(1,10);
    // So the array looks like – array(1,2,3,4,5,6,7,8,9,10)
    shuffle($b);
    $r = array_values($b);
    echo $r[rand(1,10)];
    }`

    this function will generate random number from 1-10 and path in code from link would look like:

    `return get_stylesheet_directory_uri() .’/_inc/images/image-‘ . randnum() . ‘.png’;`

    Result is that first function generates number (works), but in every part of BP (widget, content etc.) number for particular user is different + number from . randnum() . is not taken as part of path, but is displayed in frontend as link.


    James
    Participant

    @janismo

    If someone, who actually understands at least something from php would point on mistake, it would be highly appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change Default Avatar for User’ is closed to new replies.
Skip to toolbar