Need help with homepage Widgets for logged-in users

Ok, so I have four blocks available for widgets on the “logged-in” version of our homepage.

Since the “admin” is the one assigned the main blog account — the widgets work fine as long as i’m logged in as admin and I’m adding widgets through that account. But that doesn’t really do me any good for what I’m trying to do.

What I’d like to do is instead of the homepage relying on the information fed in from the admin blog’s widget settings — I want it to pull from the LOGGED-IN USER’S settings.

So, every logged in user would see something different depending on their widget settings.

I have a weather widget, for example, that pulls data from accuweather.com. Inside that widget is a zip code field. So I want this homepage widget to pull the zip code from whoever is logged in’s widget settings.

This is what the blocks look like:

http://i.imgur.com/jj3w2.gif

Thanks!

  • photomentor
    • WPMU DEV Initiate

    Thanks for the reply Andrew…that’s what I figured.

    But I’m fairly certain I can figure it out if I knew where to look :slight_smile:

    Do you have any idea as to where I should start?

    Just to be clear:

    The weather widget example is just a hacked version of the BP_Core_Welcome_Widget i repurposed. I think it had one option text field (max members) which i just renamed to zip code.

    Again, it works beautifully logged in as admin but not otherwise.

    WPMU out of the box (rightfully so) pulls widgets on a blog-to-blog basis.

    What I’m looking for in this instance is for WPMU to pull these widgets on a per logged-in-user basis.

    Hope that makes sense :slight_smile:

    Here’s what my code in bp-core-widgets.php looks like. Bolded code is what bring the zip code into the widget’s url string.

    I have a feeling this is alright….and that I will need to look at some other files to control the logged-in user thing.


    class BP_Core_Welcome_Widget extends WP_Widget {

    function bp_core_welcome_widget() {

    parent::WP_Widget( false, $name = __( ‘Weather Widget’, ‘buddypress’ ) );

    }

    function widget($args, $instance) {

    extract( $args );

    ?>

    <?php echo $before_widget; ?>

    <?php if ( $instance ) : ?>

    <div style=’width: 180px; height: 150px; background-image: url( http://vortex.accuweather.com/adcbin/netweather_v2/backgrounds/blue_180x150_bg.jpg ); background-repeat: no-repeat; background-color: #346797;’ ><div id=’NetweatherContainer’ style=’height: 138px;’ ><script src=’http://netweather.accuweather.com/adcbin/netweather_v2/netweatherV2ex.asp?partner=netweather&tStyle=whteYell&logo=1&zipcode=<?php echo attribute_escape( stripslashes( $instance ) ) ?>&lang=eng&size=8&theme=blue&metric=0&target=_self’></script></div><div style=’text-align: center; font-family: arial, helvetica, verdana, sans-serif; font-size: 10px; line-height: 12px; color: #FFFFFF;’ >Weather Forecast | Weather Maps</div></div>

    <?php endif; ?>

    <?php

    }