Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

How to change userpic path

edited March 2012 in Vanilla 2.0 - 2.8

Hi,

I have two vanilla sites running off of the same database. One is using a fullsite theme and one is using a mobile device theme. Addresses are site.com and m.site.com . Both are vanilla-core-2-0-18-2

This is working perfectly except for the user pics.

On both sites Im using the IndexPhoto plugin to display the users avatar on the front page. If the user uploaded their pic using the full site then the pic is stored in site.com/uploads/userpics/##/name.jpg. On the mobile site it tries to access the pic at m.site.com/uploads/userpics/##/name.jpg which of course isnt there.

The visa versa is true too.

My question is how can I change the mobile site to upload pics to the full sites userpic folder and then reference that folder when displaying the images?

Answers

  • ToddTodd Vanilla Staff

    I'd recommend symlinking the folders so they are the same. We do have a constant defined as PATH_UPLOADS which could work, but I don't think we've tested changing it before.

    To change that constant try the following:

    1. Make a file called conf/bootstrap.before.php.
    2. Add the following to the file:
    <?php
    define('PATH_UPLOADS', <directory name>);
    
  • @Matt79

    I'm sure you know this, but just in case...

    Vanilla defaults to a mobile theme when accessed by an appropriate device.

    Could you not just edit the mobile theme to suit your needs?

  • Thanks guys. I tried creating the bootstrap.before.php file but it still did not work. Still references the original path. I cleared the cache just to be sure too.

    When I load up the full site on a mobile device it doesn't look any different. Would be a great feature if I could nominate a Full theme and a Mobile them in Vanilla2. @whu66 have you done this previously? I could not see any options in Vanilla2 to nominate what is the mobile theme to use.

    I'll try syncing the folders and post how I go

  • edited March 2012

    Ok got it working. I just setup a cron job to run every hour:

    cp -urp /home/nrlfox/public_html/uploads/* /home/nrlfox/public_html/mobile/uploads/

    Works a treat.

    http://nrlfantasyfoxsports.com/

    http://m.nrlfantasyfoxsports.com/

    EDIT: Actually I realised its only the userpics directory that will change. Images uploaded to posts are referenced ok.

    cp -urp /home/nrlfox/public_html/uploads/userpics/* /home/nrlfox/public_html/mobile/uploads/userpics/

  • AoleeAolee ✭✭
    edited March 2012

    i +1 tod's suggestion, symbolic link is the best option you got :)

  • lucluc ✭✭

    Matt79 said:

    When I load up the full site on a mobile device it doesn't look any different. Would be a great feature if I could nominate a Full theme and a Mobile them in Vanilla2. @whu66 have you done this previously? I could not see any options in Vanilla2 to nominate what is the mobile theme to use.

    I've done this previously (even if you access this specific forum vf.org, it does go to mobile theme), but actually, there's nothing to do.

    There's a regex to find out if you're coming from a mobile device and then it displays it.

    Which device are you using?

    To know the configuration to change from the default mobile theme, check the comment there:
    http://vanillaforums.org/addon/green_mobile-theme

  • @Matt79

    My site displays a mobile version to all identified devices.

    As @luc says, it should work 'out of the box', assuming you have the mobile theme folder in your themes folder.

    If not, just download Vanilla again, and upload the themes/mobile folder, and you should see it working.

    All you would have to do then was edit the mobile theme.

  • great job , i hava do this too . haha thx

Sign In or Register to comment.