Skip to:
Content
Pages
Categories
Search
Top
Bottom

Need help with homepage Widgets for logged-in users


  • dashik
    Participant

    @dashik

    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:

    View post on imgur.com

    Thanks!

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

  • r-a-y
    Keymaster

    @r-a-y

    You’d have to manually call the widget in question and call the ZIP code from the xprofile field of the logged-in user.

    You wouldn’t be able to set this from the WP backend.


    dashik
    Participant

    @dashik

    The zip code isn’t coming from their xprofile field….it’s coming straight from the widget settings.

    The weather widget example…that’s just a hacked default widget i repurposed/renamed. 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 :)


    r-a-y
    Keymaster

    @r-a-y

    Like I said, you’d need to create an xprofile field called “Zip Code”.

    And then you’ll need to manually call the weather widget using the manual WP widget function call (i forget what this is at the moment) and pass the logged-in user’s “Zip Code” (provided they have filled it in). You can definitely pass arguments / settings to widgets manually.

    I’d imagine you would create an xprofile field named “Zip Code”, otherwise how else are you going to grab the logged-in user’s zip code?


    dashik
    Participant

    @dashik

    ohhhh, i see what you’re saying. that could actually work! not 100% ideal but i think i could make it work. good idea :)

    thanks!


    dashik
    Participant

    @dashik

    how do i call an xprofile field inside of bp-core-widgets.php? i’m guessing that falls outside the profile loop right?

    i’ve tried various methods but no luck yet.


    stwc
    Participant

    @stwc

    I use a plugin called widget logic that allows some sophisticated conditional display of widget stuff. You might find that it helps you in getting this work…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Need help with homepage Widgets for logged-in users’ is closed to new replies.
Skip to toolbar