petet_uk
Forum Replies Created
-
Ha, that was easy. Go to my-bookings.php. Copy. Paste into my-events.php and then hide “Events I’m attending” menu.
Cheers Marcus.
Forum: Plugins
In reply to: [Plugin: Events Manager] Sub nav creation on Events navigation (Buddypress)I eventually fixed this by hooking my function into the wp_loaded action.
My first problem was that I had my code running from mu-plugins, which runs before events manager and therefore it couldn’t find it.I move the code into functions.php and then added it to the wp_loaded action.
Thanks for your help Marcus.
Forum: Plugins
In reply to: [Plugin: Events Manager] Sub nav creation on Events navigation (Buddypress)Hi Marcus,
Thanks, I’ve tried that by adding a priority of 12 and it didn’t have any effect. Also tried it with priority 100 with no difference.
I’m using var_dump($bp->events); to see the contents of the object, just to prove it exists, but nothing is outputted because it still hasn’t created the events object, even with a priority of 100 on the bp_setup_nav action.add_action( 'bp_setup_nav', 'my_invites_setup_nav', 100 );
If you’ve got any other suggestions, I would really appreciate them because I’m at a bit of a loss as to why it’s being run before the $bp->events object is created.
Forum: Plugins
In reply to: [Plugin: Events Manager] Sub nav creation on Events navigation (Buddypress)Thanks for that. It’s hitting the final else clause, which confirms that the events object hasn’t yet been created.
do_action on line 12 has been removed, but it was an idle line anyway.The code is being run before the events plugin is initialised, and therefore I need to somehow run it after.
Forum: Plugins
In reply to: [Plugin: Events Manager] Sub nav creation on Events navigation (Buddypress)Update from the moderation, code can be found at https://pastebin.com/BM8adpdH
The events object is created as a child of the global $bp, but I think somehow my code above is being run before the the events object is created. Therefore, I don’t think I’m tying it to the right action.
It’s just trial and error really. Once you get to know the plugins you are working with, you know which ones are affected by a go live process and what you have to do.
Key is as Paul says, back up your database first. If you don’t know how to do it through phpmyadmin, there are plenty of plugins out there but I wouldn’t be able to recommend one to you as I usually do direct SQL dumps.
Good luck.
Yeah I usually go into phpmyadmin or something like it, but you can do most with the below SQL statement
UPDATE wp_posts SET post_content = REPLACE(post_content, 'test.mysite.com', 'www.mysite.com') WHERE post_content LIKE '%test.mysite.com%'; UPDATE wp_options SET option_value = REPLACE(option_value, 'test.mysite.com', 'www.mysite.com') WHERE option_value LIKE '%test.mysite.com%';
Be wary with the wp_options query though, as you have any rows in wp_options with serialised arrays in there containing URLs and it changes the URLs, it will corrupt the serialised array. (cForms II is one that I’ve had fun with in the past).
Found the solution now. I was plugging in to the wrong hook. Instead onf init, I am now using wp_head and all is fine.
If anyone needs it, the full code is as follows.
add_action( 'wp_head', 'my_em_setup_nav' ); function my_em_setup_nav(){ global $bp, $current_user; if(!$current_user->wp_capabilities['administrator']){ bp_core_remove_subnav_item('events','my-events'); bp_core_remove_subnav_item('events','my-locations'); bp_core_remove_subnav_item('events','my-bookings'); } }