Link URLs append slash to end

Home Forums Calendar Products Events Calendar PRO Link URLs append slash to end

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1009536
    Adam
    Participant

    I added this snippet into functions.php so that clicking the link opens the web site link of the event:

    /*
    * This changes the event link to the event website URL if that is set.
    * NOTE: Comment out the add_filter() line to disable this function.
    */
    function tribe_set_link_website ( $link, $postId ) {
    $website_url = tribe_get_event_website_url( $postId );

    // Only swaps link if set
    if ( !empty( $website_url ) ) {
    $link = $website_url;
    }
    return $link;
    }
    add_filter( ‘tribe_get_event_link’, ‘tribe_set_link_website’, 100, 2 );

    This appends a slash to the end, which generates an invalid URL.
    How can I remove the URL? It isn’t coming as in this filter and seems to be added later.

    /civicrm/?page=CiviCRM&q=civicrm/event/info&reset=1&id=6/

    #1009726
    Cliff
    Member

    Hi Adam. Thanks for your question.

    So I can be clear what you’re attempting to do, are you wanting to replace the link in the Calendar view so it links to the single event’s website field URL instead of linking to the single event itself?

    If not, please clarify exactly where you’re wanting to replace the link.

     

    #1009898
    Adam
    Participant

    When clicking the link to view the calendar entry, I want it to go to the external link (as we’re integrating with CiviCRM events). It works, apart from the URL having a slash on the end of it (which then generates an incorrect URL).

    #1010121
    Cliff
    Member

    Adam,

    Maybe it’d help to change $link = $website_url; to $link = trim( $website_url, '/' );

    I hope this helps you get it figured out, but I do need to remind you that we can point you in the right direction toward customizations, but we cannot provide support for custom code or integrations, per our “scope of support” Terms.

    I’d love to hear if you got it figured out. And, if you do, you’re welcome to post the code here for others to possibly benefit from in the future.

    Thank so much for your understanding and for being a valued customer!

    #1014878
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Link URLs append slash to end’ is closed to new replies.