Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

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

  • gabrieluno
    Participant

    @gabrieluno

    I’ll give up and use the typical mystery man, because I couldn’t adapt your plugin to load a local random avatar with the following code:

    'Avatar-folder/Avatar-name'.rand( 1 , 15 ).'.jpg'

    I’m sorry I bothered you @shanebp, thank you for your great work towards the bp community.


    gabrieluno
    Participant

    @gabrieluno

    As it was almost impossible for me to achieve what I wanted (due to my low knowledge), I switched to an easier alternative.

    Provide random avatars for users who did not upload an avatar, any of the codes below will work, but reloading the page reloads a different avatar. Would you know how to make the avatar save and not change when reloading the page? Greetings mate

    define ( 'BP_AVATAR_DEFAULT', 'uploads/Avatar-'.rand( 1 , 13 ).'.jpg' );

    $pics = array ('Avatar-1.jpg','Avatar-2.jpg','Avatar-3.jpg','Avatar-4.jpg');
    $picid = $pics[array_rand($pics,1)];
    define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . 'uploads/'. $picid);
    define( 'BP_AVATAR_DEFAULT_THUMB', BP_PLUGIN_URL . 'uploads/'. $picid );
    $picid = mt_rand(1, 15); //100 = No. of images
    define( 'BP_AVATAR_DEFAULT', BP_PLUGIN_URL . 'uploads/'.$picid.'.jpg' );
Viewing 2 replies - 1 through 2 (of 2 total)
Skip to toolbar