Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP Activity Fields


  • lkhlc
    Participant

    @lkhlc

    Howdy and Happy mom’s day to the ah… moms…
    Hopefully there is someone in this community who knows the answer to these questions.

    1: How to list all most recent activity with the full body, not just truncataed to make a title.
    2: How to get the original post ID number
    3: How to get the original post author ID?

    I’ve been using this:

    function getFeed($feed_url){
        $content = file_get_contents($feed_url);
        $x = new SimpleXMLElement($content);
    
        for ($i=0; $i<=100; $i++){
            $entry = $x->channel->item[$i];
    if ($entry){
                $link = $entry->link;
                $page_id = $entry->ID;
                $user = bp_get_activity_id();
                $title = $entry->title;
    	    $object = $entry->object;
    	    $content = $entry->activity_comment;
    	    $tags = $entry->tag;
    if ($title){
    
    echo $user.",".$page_id.",".$title.",".$link.",".$content.",".$tags."<br>\n";
        }
        }
        }
    }
    
    getFeed($feed_url);

    user, content tags page id do not generate anything only title and link work
    and the title is truncated from the body (need the body) and the URL is not
    the permalink its the straight /p/ number treatment.

    4: How do I get real permalinks to work in the activity stream?

    Yeah I know its too much but I hope someone has already solved this.

    Thanks for reading!

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

  • shanebp
    Moderator

    @shanebp

    bp_get_activity_id() only works in the stack used for activity loops.
    You seem to be parsing some feed file.
    Perhaps you could show an example of the contents of item[$i].


    lkhlc
    Participant

    @lkhlc

    Thanks for the response!
    That is a collection of different attempts seeking more than the few fields offered as it is parsing a standard wordpress rss feed
    $link = $entry->link; and $title = $entry->title;
    are the only two giving up any data.

    <item>
    <guid isPermaLink="false">[num]</guid>
    <title>Truncted body</title>
    <link>[domain_name]/my-stream/p/86/</link>
    <pubDate>Thu, 05 May 2022 18:33:15 +0000</pubDate>
    <content:encoded>
    <![CDATA[ <p>Good Post</p> ]]>
    </content:encoded>
    </item>

    If acquiring the ID of the original is possible the rest can easily follow but so far finding that elusive ID has been a tiny bit frustrating 😉 Would just love to find out how to change the link to a permalink as well.

    Thank you again.


    shanebp
    Moderator

    @shanebp

    If this is the slug my-stream, you could look for that slug in your database.
    Or perhaps /86/ is the post_id.
    Or look up the post ID based on the title – but titles may not be unique.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar