Tagged: function

Event Espresso 4 – Helpful Functions

event-espresso-logo-600x213-black1-600x198

I’ve recently been working on a project using Event Espresso 4 and I’ve had to customize it quite extensively. I wrote a few functions that I think might be handy for others so I thought I would share them:

Get Event ID From Registration Code

I wrote this one to help me get the event information when a user clicks on a ‘cancel registration’ link. The reg code is more secure way to pass as a GET variable in a link than the user/event/registration id.

The Function

Usage Example

Get Event Date

This one is handy if you have the event id and you are just looking for the date of the event.

The Function

Usage Example

Get the Status of the Registration From Registration Code

This one can be used to see the status of a particular registration. I wrote it to provide confirmation that a registration had been cancelled in a custom built ‘cancellation journey’.

The Function

This function returns a status code:

“RAP” (registration status of approved. This is the default behavior.)
“RCN” (registration status of cancelled.)
“RDC” (registration status of declined.)
“RIC” (registration status of incomplete.)
“RNA” (registration status of not approved.)
“RPP” (registration status of pending payment.)

Usage Example

Get the Status of the Event From Registration ID

Same as above just using the Registration ID.

The Function

This function returns a status code:

“RAP” (registration status of approved. This is the default behavior.)
“RCN” (registration status of cancelled.)
“RDC” (registration status of declined.)
“RIC” (registration status of incomplete.)
“RNA” (registration status of not approved.)
“RPP” (registration status of pending payment.)

Usage Example

Get Registrant Details From Registration ID

This function gives you the all the registration details of a Registrant if you have the registration ID.

The Function

This function returns an object with ‘first_name’, ‘last_name’ and ’email’ as the parameters.

Usage Example

 

More

Multisite Post Duplicator

Last post I mentioned a wee function I has written to help me with copying posts and pages from one multisite to another. Well I have packaged it into a plugin and submitted it to WordPress. After a few days I got notice that they approved it!

banner-1544x500

Check it out on GitHub also:

FireShot Capture - magicstickuk_multisi_ - https___github.com_magicstickuk_multisite-post-duplicator

It doesn’t finish here though. I have several ideas for future features. Stay tuned!

More

Multisite: Copy a Page From One Site to Another

photo-1421977870504-378093748ae6

I’ve been working on a multisite recently and my client requested something off the cuff that made me gulp. They said “I take it we will be able to copy a page from one site to the other to save us having to replicate it manually?”

Coping a page on the same site is pretty straightforward and there are a multitude of plugins out there that make it a pretty easy process. However. Doing this across a mulitsite is different. Not a lot of plugins out there.

wpmaz says*For this to work full with advanced custom fields you need to ensure your custom fields setup on both sites are the same!
I thought I would share a function I wrote today to achieve this. This is pretty basic at the moment but gives the core functionality and works with Advanced Custom Fields too*!

I’m pretty happy with this, but think I might make a wee plugin for it!

More