Change the Blogs MU home static picture with dynamic pictures

Hey Everyone,

I'd like to change the static picture (the main picture from home page left to join button) with random pictures from members album. I use BP Album+

So, for each refresh on home page we should see a different picture. Is there a solution for that?

Many thanks!

  • Mason

    Hiya crotariu,

    I don't have a lot of experience with this plugin, but my thought is that if it records the image url somewhere in the database you'd need to write a to select a random variable from this table.

    Then re-code the theme to display one of the random image selected in the query.

    It'd take a bit of work, but a developer should be able to do this for you. We don't have anything set up for this scenario.

    You could post a job listing or contact a developer through their profile here:
    https://premium.wpmudev.org/wpmu-jobs/

    Thanks!

  • crotariu

    Hi Richie,

    I tried the code but there is no changes.

    For functions.php... your code should be inserted at the top like the following, right?

    <?php
    ///////////////////////////////////////////////////////////////////////////////////
    /// using bp album+ for featured images - buddypress only
    ///////////////////////////////////////////////////////////////////////////////////

    if($bp_existed == 'true') {
    function bp_album_featured_images_gallery() {
    global $wpdb;

    $bp_album_feat_img = $wpdb->get_results("SELECT * FROM " . $wpdb->base_prefix . "bp_album WHERE privacy = '0' ORDER BY RAND() ASC LIMIT 1");
    if($bp_album_feat_img) {
    foreach($bp_album_feat_img as $myalbum ) { ?>
    <img width="100%" src="<?php echo WP_CONTENT_URL . '/blogs.dir/' . $myalbum->owner_id . $myalbum->pic_org_url; ?>" />
    <?php } }
    }
    }

    ////////////////////////////////////////////////////////////////////////////////
    // load text domain
    ////////////////////////////////////////////////////////////////////////////////
    define('TEMPLATE_DOMAIN', 'blogs-mu');
    // Uncomment this to test your localization, make sure to enter the right language code.

    function init_theme_localization( $locale ) {
    // return WP_LANG;
    return "en_EN";
    }
    // add_filter('locale','init_theme_localization');

    if( function_exists( 'load_theme_textdomain' ) ) {
    load_theme_textdomain( TEMPLATE_DOMAIN, TEMPLATEPATH . '/languages/');
    }
    ..................

    I appreciate your help...

    Thanks a lot!!!!

  • crotariu

    Hey Richie,

    Still no change...

    To be honest... I'm not longer interested in this feature because it may not be a good idea for my conversion (there can be good pictures and bad pictures) but if you want to close this topic with a solution... let me know and I'll test them.

    Btw, here is how the code looks at the end of functions.php.
    .........................................................
    add_action('admin_head', 'mytheme_wp_blogsmu_head');

    ///////////////////////////////////////////////////////////////////////
    /// load functions
    ///////////////////////////////////////////////////////////////////////

    include( TEMPLATEPATH . '/_inc/functions/services-functions.php');

    ///////////////////////////////////////////////////////////////////////////////////
    /// using bp album+ for featured images - buddypress only
    ///////////////////////////////////////////////////////////////////////////////////

    if($bp_existed == 'true') {
    function bp_album_featured_images_gallery() {
    global $wpdb;

    $bp_album_feat_img = $wpdb->get_results("SELECT * FROM " . $wpdb->base_prefix . "bp_album WHERE privacy = '0' ORDER BY RAND() ASC LIMIT 1");
    if($bp_album_feat_img) {
    foreach($bp_album_feat_img as $myalbum ) { ?>
    <img width="100%" src="<?php echo WP_CONTENT_URL . '/blogs.dir/' . $myalbum->owner_id . $myalbum->pic_org_url; ?>" />
    <?php } }
    }
    }

    ?>

    Thanks!!