Support

Home Forums Event Espresso Premium Disable Links on My Events page without editing core files

Disable Links on My Events page without editing core files

Posted: May 12, 2014 at 6:24 am

Viewing 13 reply threads


Simon Barnett

May 12, 2014 at 6:24 am

Is it possible to disable the links to events on the My Events page without editing core files?

Currently the link goes to the event itself. I’d rather it simply display the event title – no hyperlink.

I couldn’t find a corresponding template file or setting to change it. If it means editing core files, then so be it, but worth asking first.

http://jobza.co.za/wp-content/uploads/2014/05/Screen-Shot-2014-05-12-at-2.09.27-PM.png


Dean

May 12, 2014 at 6:46 am

Hi Simon,

There is no option for removing those, so you have 3 choices:

1) Copy the event_espresso_my_events function from the my_events_page.php file to a custom_functions.php file in the uploads/espresso folder or to a custom plugin and edit there (recommended)

http://codex.wordpress.org/Pluggable_Functions

2) Edit the event_espresso_my_events function directly in the core file (not recommended).

3) Use JavaScript to disable the links.


Simon Barnett

May 12, 2014 at 7:20 am

First option sounds great. I’m digging around in the EE plugin.. can’t seem to find my_events_page.php. What’s the file path?


Tony

  • Support Staff

May 12, 2014 at 7:37 am

Hi Simon,

my_events_page.php is not actually a part of Event Espresso core.

It is included within the WP_Members Add-on, you’ll find it within:

wp-content/plugins/espresso-members/my_events_page.php

Hope that helps ๐Ÿ™‚


Simon Barnett

May 12, 2014 at 8:13 am

Thanks Tony and Dean.. making some headway. So looking at function event_espresso_my_events() I don’t see how it turns the event title in the My Events page into a hyperlink, although I do see an $event_link variable defined lower down in that file – not sure I should touch that, though..


Tony

  • Support Staff

May 12, 2014 at 8:22 am

You’ll need to change Line 170:

<td class="post-title page-title column-title"><strong><?php echo $event_link?></strong></td>

Change that to:

<td class="post-title page-title column-title"><strong><?php echo stripslashes_deep($event->event_name);?></strong></td>

That will then only output the event name, rather than the link.


Simon Barnett

May 12, 2014 at 8:48 am

Ah, I see.. the function takes up almost the whole file. Sorry, was visually mis-aligning my curly braces.

I’ve pasted the modified* event_espresso_my_events function into /uploads/espresso/custom_files.php

My titles are still links. Am I missing something?
(should EE automatically detect that file, like it does with templates?)

* from the beginning of the original code I removed if (!function_exists('event_espresso_my_events')) { and from the end I removed everything after `//Create a shortcode to place on a page
function event_espresso_my_events_fview(){`


Tony

  • Support Staff

May 12, 2014 at 8:55 am

Sorry, that’s a typo.

The file should be named custom_functions.php and is included within the Custom Files Add-on (to explain where the typo has come from) I’ll amend Deans post as to not cause confusion in the future.

Once you rename that file it should work correctly.


Simon Barnett

May 12, 2014 at 9:02 am

Thanks Tony,
I’ll have to get go-ahead from my client to purchase that add-on, or try another method. I’ll let you know if / when it’s working.


Tony

  • Support Staff

May 12, 2014 at 9:05 am

Hi Simon,

You do not need to purchase the Add-on, just simply rename your current custom_files.php file to custom_functions.php

The Custom Files reference was just to explain where _files.php come from.


Simon Barnett

May 12, 2014 at 9:49 am

Thanks Tony, custom_functions.php is a useful feature.
It’s picking up the file now, but won’t load anything beyond my page title, and kills the WordPress admin bar, so I’m digging around in the function for an html or php error. I’ve tried copy-pasting the function* several times, and checking for extra / missing closing curly braces.

* up to line 224, and removing the opening if statement


Simon Barnett

May 12, 2014 at 10:01 am

Here’s the full custom_functions.php:
http://pastebin.com/z6WC1kZZ


Tony

  • Support Staff

May 12, 2014 at 10:17 am

Hi Simon,

Apologies, I have found the issue.

On line 8 of your function you’ll find:

require_once('user_vars.php');

Change that to:

require_once(EVENT_ESPRESSO_MEMBERS_DIR . 'user_vars.php');

That function is looking for the file user_vars.php within the same directory of the function itself (wp-content/uploads/espresso/)

That change forces it to use the correct directory. (alternatively you could copy user_vars.php to the same directory although the fix above will continue to use updated versions when released)

I have created a ticket to include either this or a similar fix within newer versions of the Members Add-on.


Simon Barnett

May 12, 2014 at 10:22 am

Spot on! – all working now.. Thanks so much Tony : )


Tony

  • Support Staff

May 12, 2014 at 10:27 am

No Problem ๐Ÿ™‚

Viewing 13 reply threads

The support post ‘Disable Links on My Events page without editing core files’ 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