Sharing Options for Events

Home Forums Calendar Products Events Calendar PRO Sharing Options for Events

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #945805
    Mark
    Participant

    Is there a plugin or a way to integrate sharing options into each event? I noticed that that is not an option that is given when you are setting up an event, and was wondering if there was a solution to this issue or if it’s in the works to add social media sharing options to the organizer settings.

    #945918
    George
    Participant

    Hey Mark,

    Thanks for reaching out. There are currently no plans to add social media sharing options to events by default, and, as far as I know, this is unlikely to ever be included in the plugin.

    Fortunately, there are many options out there to add this to your site. We don’t “officially” recommend or endorse any specific plugin, but many people use and love the Jetpack sharing module, so check out http://jetpack.me if you’re interested as well.

    Another option is to search for sharing-related plugins for free on the WordPress.org plugin repository, and find the one that works best for you. Check out an example search here → https://wordpress.org/plugins/search.php?type=term&q=sharing

    I hope that helps Mark! Best of luck with your project.

    Cheers,
    George

    #946000
    Mark
    Participant

    Thanks. Jetpack seems to have done the trick.

    But I also noticed that if I do enable sharing I cannot add my events via Google Calendar. Every event I have created, when I click on +Google Calendar it comes up as “Invalid Request”. I’ve tested it a few times, and it seems like I can’t add sharing AND have +Google Calendar at the same time. I’d like the ability to share events AND export to Google Calendar.

    On my events page (anccbellevue.org/events) I have currently kept Jetpack ON so you can see what I am talking about when it comes to the “Invalid Request”.

    #946072
    Mark
    Participant

    I just disabled the Jetpack sharing because that just seems to be the problem. I had Easy Social Share Buttons plugin installed already and that does not seem to interfere with the Google Calendar import function, but it does add code to the event detail.

    I searched through the forums and found this bit of code that helped strip some of the coding and markings from the even descriptions. Is there anything that I need to add to also make sure that the social sharing code doesn’t show up?
    —————
    add_filter( ‘tribe_google_calendar_parameters’, ‘remove_tags_from_gcal_links’ );

    function remove_tags_from_gcal_links( array $params ) {
    $cleaned = html_entity_decode( strip_tags( apply_filters( ‘the_content’, urldecode( $params[‘details’] ) ) ), ENT_QUOTES, ‘UTF-8’);
    $params[‘details’] = urlencode( $cleaned );

    return $params;
    }

    #946233
    George
    Participant

    Hey Mark,

    I’m sorry you’ve been having trouble here.

    Just to be clear – with Jetpack Sharing active and ‘Easy Social Share Buttons’ not active, you get the “Invalid Request” error?

    And without Jetpack Sharing active, and when ‘Easy Social Share Buttons’ is active, you do not get that “Invalid Request” error?

    This is an odd issue – in the meantime, can you post a screenshot of an example of exactly what Social Share code gets added to your Google event descriptions when you export them?

    Thanks,
    George

    #946240
    Mark
    Participant

    The invalid request error only happens with Jetpack ON, so I DISABLED the Jetpack share function and turned on Easy Social Share.

    I then went on your forums and found a code to strip the extra coding and markings that were popping up on the Google calendar description and all life was wonderful.

    But when I turn Easy Social Share ON and in the Google Calendar description, it adds the Easy Social Share code as following:

    Every 1st Sunday of the month, youth students (6th-12th grade) are invited to go out for lunch and hangout after service. It’s a casual environment where students get to mingle, build relationships with their leaders, share a meal together, and have a little fun outside of our regular group times. Activities and lunch spots vary each month, but if you would like to get notified about upcoming hangout locations and events, please sign up for our newsletter by registering your family.We can’t wait to spend some time with your students @Hangouts!Sign Up for Newsletters Share this with others via:FacebookTwitterPrintE-mail function essb_window1270294632(oUrl, oService) { essb_window_stat(oUrl, oService, 3832); essb_ga_tracking(oService, “bottom”, “http://anccbellevue.org/event/youth-hangouts/”); }; function essb_pinterenst1270294632() {essb_ga_tracking(“pinterest”, “bottom”, “http://anccbellevue.org/event/youth-hangouts/”); essb_pinterenst_stat(3832); };Share this with others via: FacebookTwitterPrintE-mail function essb_window4514479(oUrl, oService) { essb_window_stat(oUrl, oService, 3832); essb_ga_tracking(oService, “bottom”, “http://anccbellevue.org/event/youth-hangouts/”); }; function essb_pinterenst4514479() {essb_ga_tracking(“pinterest”, “bottom”, “http://anccbellevue.org/event/youth-hangouts/”); essb_pinterenst_stat(3832); };

    I tried other share plugins like Mashshare, and for some reason all the share functions insert some code into the event description. So I was wondering if there was a way to adjust the code or functions of the calendar to not include that last bit of code in the description.

    #946243
    Mark
    Participant

    This reply is private.

    #946259
    George
    Participant

    Hey Mark,

    It seems like that sharing-related code is only coming after the rest of your description content – do you find this to always be the case?

    If so, do you think that it would just be easiest to manually remove that chunk of extra text before “saving” the imported event to your Google Calendar? Writing code to filter this out is possible, but is extra complexity that may not be necessary if you agree.

    Let me know what you think,
    George

    #946295
    Mark
    Participant

    Yes, the sharing related code happens only after the rest of the description code. I can always delete the last portion, but I’m thinking about all the users out there who have to go through the trouble of doing that. If there is a code out there, it would be great to have… and I think others could benefit as well, since this seems to clash with other plugins as well. It’s a small detail, I can understand that, but if possible, it would be great to share events and have them export details in a fashion that is clean and organized.

    #946387
    Mark
    Participant

    So I did some testing today. I have a plugin called WP Super Cache. If it is ACTIVATED and cache is on, Google Calendar sharing does not work and I get the invalid request error.

    When I turn cache off, I can use the sharing function, but the whole code thing pops up.

    So it looks like I also cannot cache my page. Do you have any recommendations?

    #946388
    Mark
    Participant

    Sorry for all the updates, just trying to solve this issue as fast as possible. So, here is what I have been able to resolve.

    1) Caching is no longer a problem (webpage is set to have Cache ON now)
    2) No longer getting a invalid request or 400 error (Google calendar sharing is working)
    3) Only issue remaining is trying to get rid of the code that the sharing plugin (Easy Social Share and any other share plugin) inserts into the Google event details.

    Here is the code that I added to my functions.php to solve the first two issues:

    add_filter( ‘tribe_google_calendar_parameters’, ‘remove_tags_from_gcal_links’ );

    function remove_tags_from_gcal_links( array $params ) {
    $cleaned = html_entity_decode( strip_tags( apply_filters( ‘the_content’, urldecode( $params[‘details’] ) ) ), ENT_QUOTES, ‘UTF-8’);
    $params[‘details’] = urlencode( $cleaned );

    return $params;
    }

    /**
    * Shortens the event description used within Google Calendar links.
    *
    * The Events Calendar already truncates the event description before using it in Google
    * Calendar links – however some themes/other plugins may add additional markup/content
    * after this, expanding it back to too big a size to make for a valid request.
    *
    * @param array $properties
    * @return array
    */
    function truncate_gcal_description_late( array $properties ) {
    $details = $properties[‘details’];

    if ( strlen( $details ) > 996 ) {
    //Strip tags
    $details = strip_tags( $details );

    $url = get_permalink();
    $details = substr( $details, 0, 996 );

    //Only add the permalink if it’s shorter than 900 characters, so we don’t exceed the browser’s URL limits
    if ( strlen( $url ) < 900 ) {
    $details .= ‘ (View Full Event Description Here: ‘ . $url . ‘)’;
    }
    }

    $properties[‘details’] = $details;
    return $properties;
    }

    add_filter( ‘tribe_google_calendar_parameters’, ‘truncate_gcal_description_late’ );

    #946557
    George
    Participant

    Hey Mark,

    No worries about the updates, and to be honest, I forgot that the GCal export link was going to be used by many users at all – I have no idea why I thought this, but for some reason I was thinking that only you would be adding events via that Button. My brain is weird sometimes!

    So, yes, I agree with you that this is actually something important to fix.

    Did the code in your last reply here resolve these issues for you? Or do you still find the sharing code being added to your Google Calendar descriptions?

    If you still have extra “junk” getting pulled into your Google Calendar descriptions, can you copy and paste the contents of one of these descriptions into a Gist at http://gist.github.com, and share a link to that Gist? This is better than posting the code here on the forums just to ensure that if there’s HTML or something in it, the forum processing here doesn’t try to actually render it – on a Gist we’ll be able to see to the tags exactly as they are when imported to the GCal description field.

    Thanks for your patience Mark! I’m really sorry about some of confusion here earlier.

    Cheers,
    George

    #946585
    Mark
    Participant

    The code is still showing up. No worries on the misunderstanding. I was probably not describing the issue correctly. Any help in this area would be greatly appreciated!

    Here is the Gist: https://gist.github.com/anonymous/800b2a185ce4c0c96af3

    #946724
    George
    Participant

    Hey Mark,

    Thanks for being cool, I hope I can reward your patience by finally having written something that does what you’re looking for.

    So, to start, here’s what my exported gCal descriptions looked like – notice how while it’s not as much extra junk at the end as your descriptions, my JetPack buttons did add extra “Share This:”-style text to the descriptions → https://cloudup.com/cwXTaCaL4PG

    I modified the original code you shared here in this support ticket, and you can find my modified function in this Gist here → https://gist.github.com/ggwicz/98f3845c81fb7624871f

    With that code, basically it looks for the string ‘Share this with others via:’ in the description being passed to it, and cuts off anything from that string onwards – this hopefully will work well for you, especially since the extra Sharing Buttons junk is only at the end of the descriptions. Note, however, that if for some odd reason any of your descriptions have the text “Share this with others via:” in their body content, everything after that will be stripped.

    To change what string is matched, just change what’s found in the $to_remove variable. For example, for me I just set that variable to “Share this:”, and now look at how my gCal descriptions look compared to the screenshot above → https://cloudup.com/cAnMbPWyG8c

    Nice!

    Now, one last thing is that you seem to want to add links to “full descriptions” at the end of your gCal short descriptions, which will get cut off with the current code solution I shared above. If you do need a link like this, you can still just add some PHP code to add text to the $trimmed variable – which is the description with all the “Share this:” junk removed – and then set it equal to $params[‘details’].

    You’ll have to take the reins on tweaking the rest of the code to get that just right, but here’s an example of another modified version of that function to show you how I would do it → https://gist.github.com/momnt/b70ce73e26a6ac42dba7

    Here’s how that looks when exported to gCal → https://cloudup.com/cFMtwjUGb1r

    Okay, there’s a lot here…take your time and go through all the information, screenshots, and code here, play around with stuff, and let me know if it helps! 🙂

    Cheers,
    George

    • This reply was modified 10 years, 6 months ago by George.
    #946810
    Mark
    Participant

    Code worked brilliantly!!! You’re awesome!

    As for the second set of instructions, I’m not so clear on that one, but I’ll get a guy who knows code to work on that! Thanks!!!!

Viewing 15 posts - 1 through 15 (of 16 total)
  • The topic ‘Sharing Options for Events’ is closed to new replies.