Skip to:
Content
Pages
Categories
Search
Top
Bottom

Suggested Posts Plugin (for Multisite Preferably)


  • Nahum
    Participant

    @nahummadrid

    I have just started my quest of finding a way to suggest posts to members by way of a widget based on xprofile information.

    Let’s say I have a “Interests” field for entering member’s favorite topics, I’d like to be able to put a widget in their logged in profile to show them sitewide blog posts related to those “Interests”, something like a “Just for you” recommendation widget.

    Has anyone come across something like this, if not would love to get a conversation going about how we would start doing something like this. Whether it’s something we can do ourselves or even if someone would be willing create something like this for hire.

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

  • r-a-y
    Keymaster

    @r-a-y

    You want to search sitewide blog posts? That would be taxing!

    An efficient method would be to use the activity loop and filter by blog posts and the “search_terms” paramater (which in this case would be your xprofile field).

    One problem with this approach is blog posts, by default, are truncated when they are saved as an activity stream item, so your xprofile field might not match the blog post if the post content is cut off.

    An alternative method is having a sitewide blog that aggregates all your blog post data and passing your search term directly to that blog’s post loop. However, this is the “taxing” method I was speaking of because you’ll have to use the switch_to_blog() function and that uses a significant amount of DB queries.


    Nahum
    Participant

    @nahummadrid

    thanks @r-a-y

    has anyone brought in tags meta into the activity loop’s items? I think as you said, activity loop should be less taxing but I tend to use the switch_to_blog regardless of taxation. :)

    I do have sitewide tags in place and that might be the option I’m looking for. Am I going to insert the xprofile comma seperated terms into wp search of posts?

    As for s_w_b function being so taxing…I’ve read that everywhere! But I haven’t seen solutions to making it less “taxing” I never understood why it exists if its so bad. I use it all the time for things because there’s no better way to work with sitewide posts that I’ve seen, the activity loop blog posts is too limiting as far as customizing.


    r-a-y
    Keymaster

    @r-a-y

    Adding post tags to activity meta sounds like an idea. Though, you’ll still need to craft a DB query to pull only activity blog items that match your tags.

    Re: switch_to_blog() queries – see:
    https://mu.wordpress.org/forums/topic/15951


    Nahum
    Participant

    @nahummadrid

    Update:
    @r-a-y thanks again, I’m looking into it more. I’ve found this plugin https://buddypress.org/community/groups/buddypress-activity-tags/home/ but unfortunately I haven’t been able to get that plugin to work so I will dig in more to see how to add tags to blog post activity items.


    Nahum
    Participant

    @nahummadrid

    @r-a-y I have something working but it’s real dirty looking… wondering if someone sees this and can offer a much neater way of going about this. maybe it will inspire someone to make an advanced plugin because this is a very interesting function of xprofile fields driving the content received by members i would think.

    `

    <?php global $bp;
    if (bp_has_members(‘include=’.$bp->loggedin_user->id)):
    while ( bp_members() ) : bp_the_member();
    $suggestions = bp_get_member_profile_data( ‘field=Interests’ );
    $nosuggestions = bp_get_profile_field_data((‘field=Interests’) == “”);
    endwhile; endif; ?>

    Suggested Posts

    • <a href="”>

    `

    I’d also like to add a way to recognize no suggestions and display a message that says no suggestions available.

    Anyway this is for loggedin user and multisite feed but it can be done on a single blog just by removing the switch_to and restore_current.


    Nahum
    Participant

    @nahummadrid

    …ah and I forgot to mention the previous was based on making profile field work as the tags in the query.

    one of the things I think an advance version would do is use the Interest field’s terms as ?s= search terms so that posts’ content body can be taken into a account.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Suggested Posts Plugin (for Multisite Preferably)’ is closed to new replies.
Skip to toolbar