Support

Home Forums Event Espresso Premium Change the default Twitter/Facebook message?

Change the default Twitter/Facebook message?

Posted: February 13, 2014 at 1:08 pm


Ronald Aoki

February 13, 2014 at 1:08 pm

3.8.1, 3.1.36.4.P, New, N/A.

Hello,

Just wondering if a way to easily change the default Twitter/Facebook message has been addressed? Would like to replace the @EE with a custom message.

Thanks in advance.


Nikki

  • Support Staff

February 13, 2014 at 4:23 pm

Hi Ronald,

You can change the message in plugins/espresso-social/espresso-social.php about line 295.

You may find this thread helpful as well: https://eventespresso.com/topic/change-twitter-message/

Thanks.


Ronald Aoki

February 14, 2014 at 7:44 pm

Thanks, Nikki. Creating a custom plugin with the provided code worked like a charm. However, I don’t see where to delete/change the default “via @EventEspresso” part of the text. Any further suggestions?

Thanks in advance.


Dean

February 17, 2014 at 1:01 am

Hi,

In the espresso-social/espresso-social.php file on line 297 it reads

$button .= '" data-via="' . $espresso_twitter['espresso_twitter_username'];

commenting this out or removing it will remove the via @EventEspresso.

Please note that this is a core file so your changes will be over written when the plugin is updated.

To stop that you could add the function espresso_twitter_button() to a custom plugin or custom functions file and edit it there as this function is Pluggable http://codex.wordpress.org/Pluggable_Functions


Ronald Aoki

February 18, 2014 at 8:15 pm

Thank you Dean. That’s a great suggestion. I know how to create a custom plugin via:

https://gist.github.com/joshfeck/6737395

…but what code should I paste into the custom plugin so that I can edit that out? Would it be just those two lines that you provided, or would I need to copy over the entire .php file?

Please advise.

Thank you.


Dean

February 20, 2014 at 3:24 am

Hi,

You should copy over the function outline below

function espresso_twitter_button($event_id) {
		global $espresso_twitter;

		//Build the URl to the page
		$registration_url = espresso_reg_url($event_id); //get_option('siteurl') . '/?ee='. $event_id;

		// new button
		if (is_ssl()) {
			$button = '<a href="https://twitter.com/share"';
		} else {
			$button = '<a href="http://twitter.com/share"';
		}
		$button .= 'class="twitter-share-button" data-url="' . $registration_url;
		$button .= '" data-count="' . $espresso_twitter['espresso_twitter_count_box'];
		$button .= '" data-via="' . $espresso_twitter['espresso_twitter_username'];
		$button .= '" data-lang="' . $espresso_twitter['espresso_twitter_lang'];
		if (is_ssl()) {
			$button .= '">Tweet</a><script type="text/javascript" src="https://platform.twitter.com/widgets.js"></script>';
		} else {
			$button .= '">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>';
		}
		// all done!
		return $button;
	}

That can then be edited accordingly.


Ronald Aoki

February 22, 2014 at 4:44 am

Thank you, Dean. I created a .php plugin and inserted the above code as per:

http://ottopress.com/2011/creating-a-site-specific-snippets-plugin/

While the plugin file did show up in my plugin area, It did not activate when trying to activate it. Maybe I copied your function code wrong. What looks wrong below?

<?php
/*
Plugin Name: Custom Via Twitter Message for Event Espresso
Plugin URI: http://github.com/
Description: This plugin will override the via @ Event Espresso
Version: 1.0
Author: Me
License: GPLv2
*/

function espresso_twitter_button($event_id) {
global $espresso_twitter;

//Build the URl to the page
$registration_url = espresso_reg_url($event_id); //get_option(‘siteurl’) . ‘/?ee=’. $event_id;

// new button
if (is_ssl()) {
$button = ‘https://twitter.com/share“&#039;;
} else {
$button = ‘http://twitter.com/share“&#039;;
}
$button .= ‘class=”twitter-share-button” data-url=”‘ . $registration_url;
$button .= ‘” data-count=”‘ . $espresso_twitter[‘espresso_twitter_count_box’];
$button .= ‘” data-via=”‘ . $espresso_twitter[‘espresso_twitter_username’];
$button .= ‘” data-lang=”‘ . $espresso_twitter[‘espresso_twitter_lang’];
if (is_ssl()) {
$button .= ‘”>Tweet<script type=”text/javascript” src=”</script>&#039″ rel=”nofollow”>https://platform.twitter.com/widgets.js“></script>&#039;;
} else {
$button .= ‘”>Tweet<script type=”text/javascript” src=”</script>&#039″ rel=”nofollow”>http://platform.twitter.com/widgets.js“></script>&#039;;
}
// all done!
return $button;
}


Dean

February 24, 2014 at 3:21 am

Hi Ronald,

One of my colleagues pointed out a much simpler way to do this:

In your Admin dashboard go to Event Espresso > Social Media > Twitter Settings and change the Twitter username…

I must apologise for leading you up the wrong path with this, when a simple option change would have resolved it.


Ronald Aoki

February 24, 2014 at 8:33 pm

No problem, Dean. I appreciate all of your help. Thank you to your colleague as well. That was much easier. I just deleted the username completely in the settings and now the tweet just shows my custom message and the class URL. Awesome! Case closed.

The support post ‘Change the default Twitter/Facebook message?’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso