Skip to:
Content
Pages
Categories
Search
Top
Bottom

Displaying Content of Custom Field in Activity Stream

  • @justbishop

    Member

    I have my users using a custom field to display thumbnail images for their blog posts (long story) on a 3.0.1 Multiuser install. Is there any way to display these instead of the user’s avatar for their blog posts in the main site activity stream? I can’t seem to find a template file where this would be possible? I tried the following, but it’s not seeming to have any effect. I’m guessing because I need to somehow pull custom field info into the stream?

    http://pastebin.com/HPSMnB2A

Viewing 19 replies - 1 through 19 (of 19 total)
  • @justbishop

    Member

    bump :)

    @nahummadrid

    Participant

    @nuprn1

    Participant

    $post->ID would not be valid in that case – for a blog post:

    ‘item_id’ => $blog_id,
    ‘secondary_item_id’ => $post_id,

    @justbishop

    Member

    Thanks guys :)

    @nuprn1: I *think* I understand what you mean, but I’m not quite sure how I’d implement the code changes you posted. I’m leaning my way around this stuff, so here’s my comical stab in the dark so that you don’t feel like I’m just asking you to do it for me! I’d really appreciate further guidance (because I know that my changes are way wrong, lol!)

    http://pastebin.com/4VVxgira

    @nuprn1

    Participant

    very close! – use the template tags

    bp_get_activity_item_id()
    bp_get_activity_secondary_item_id()

    but as a side note – i don’t know about get_post_meta and realm of MS (you might have to switch the current blog) which is why i pulled out the blog_id info

    @justbishop

    Member

    I just did a happy dance in my chair over being “very close” :D

    OK, I’m gonna give this a try, wish me luck. I hope I don’t have to start messing with switching the blog:

    http://pastebin.com/rZVr3cQf

    @justbishop

    Member

    @nuprn1: eek! That gave me this error about entry.php:

    Parse error: syntax error, unexpected T_DOUBLE_ARROW in path/stuff/here/entry.php on line [whatever line the double arrows were on, lol]

    @nuprn1

    Participant

    @justbishop

    Member

    I know this is going to sound idiotic, but…which part is the value? $blog_id and $post_id? :blush:

    ping @nuprn1

    @justbishop

    Member

    Also, what would be the correct values? As you can see, I’ve hit the point of being completely lost as to where to go next, lol!

    @nuprn1

    Participant

    get_post_meta( bp_get_activity_secondary_item_id(), ‘thumbnail’, true)

    but have a read about this – if you have pull info from a user’s blog post. so to switch, you’ll need to pass in bp_get_activity_item_id() (which is the blog_id)
    https://codex.wordpress.org/WPMU_Functions/switch_to_blog

    @justbishop

    Member

    @nuprn1: thanks so much, I’ve been working with the Sitewide Tags plugin so much lately that I forgot about having to do a switch!

    OK, so, I’m still pretty lost, but I did try :/
    http://pastebin.com/ShsCiyFC

    @nuprn1

    Participant

    switch_to_blog( bp_get_activity_item_id() )

    but only to throw another kink into this experiment you’ll need to check the bp_get_activity_type() == ‘new_blog_post’ prior to switching and pulling meta data

    @justbishop

    Member

    @nuprn1: sargbhnes;rkgubser OK, how does this look?

    http://pastebin.com/SakeDa4r

    I feel like I’m missing something important!

    @justbishop

    Member

    Bah, OK, this is still displaying the person’s avatar for blog posts, rather than the value of the custom field :(

    http://pastebin.com/LBWYbGQT

    @justbishop

    Member

    ping @nuprn1

    I hate to bug you again, but IDK if anyone else could pick this up in the middle of the situation and understand where it should be headed, lol!

    @nuprn1

    Participant

    unfortunately at the moment i do not have the time to code and investigate exactly what needs to be done

    @justbishop

    Member

    Well thanks for helping me get this far :)

    Anyone else maybe have a minute to look over my code and see if I’m missing something?

    @sakarya

    Participant

    Thanks @justbishop i’ve edited my entry.php and it’s look very well now. http://bp.sinavdansinava.com/
    And my entry.php is here: http://pastebin.com/VZ1hNBT0

Viewing 19 replies - 1 through 19 (of 19 total)
  • The topic ‘Displaying Content of Custom Field in Activity Stream’ is closed to new replies.
Skip to toolbar