Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect to topic page by ID


  • vincenzon617
    Participant

    @vincenzon617

    Is there a way to redirect to a topic page via either a reply ID (from said page) or the topic ID itself?

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

  • Robin W
    Moderator

    @robin-w

    sorry – don’t understand the question.

    if you mean go to a topic then this is simply the url, which will depend on your permalink settings


    vincenzon617
    Participant

    @vincenzon617

    Hi Robin, this is for the activity feed in the user profiles that I have, and so there are many urls that I need. So what I was going to do was get the reply ID of the users reply (using the BuddyPress function bp_get_activity_item_id()) and then hopefully pass this into a function which takes the reply ID and ouputs the associated topic ID. Then with this topic ID I wanted to return the URL of the page which is linked to that topicID.

    Example to make it clearer:
    TopicID = 6507
    User replies to this topic -> replyID = 7809

    In activity section of profile:
    id-reply = get_reply_id() -> returns the value of 7809 (already have this function)
    id-topic = get_topic_id(id-reply) -> returns 6507 as that is the topic that the reply is in
    url-topic = get_topic_url(id-topic) -> retuns the url of the topic

    Hopefully that makes more sense above, I would like to know if there is a function similar to ‘get_topic_id’ and ‘get_topic_url’


    Robin W
    Moderator

    @robin-w

    $topic_url = bbp_get_topic_permalink( bbp_get_reply_topic_id( $reply_id ) );
    
    $forum_permalink = bbp_get_forum_permalink( $forum_id );

    two examples of what you might be after


    vincenzon617
    Participant

    @vincenzon617

    Just what I wanted! Thanks again Robin!


    Robin W
    Moderator

    @robin-w

    🙂

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