Title: for events manager
Last modified: August 20, 2016

---

# for events manager

 *  [mp3_dinle](https://wordpress.org/support/users/mp3_dinle/)
 * (@mp3_dinle)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/)
 * is it possible to modify cubepoints for evets manager plugin
 * if user booking any event get point?
 * [http://wordpress.org/extend/plugins/cubepoints/](http://wordpress.org/extend/plugins/cubepoints/)

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/for-events-manager/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/for-events-manager/page/2/?output_format=md)

 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201765)
 * Of course. The best thing about CubePoints is that you can add your own modules
   to it allowing you to hook into most plugins. Have a look at the existing modules
   in CubePoints and see if you can create a new one that hooks into your desired
   plugin.
 *  Thread Starter [mp3_dinle](https://wordpress.org/support/users/mp3_dinle/)
 * (@mp3_dinle)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201767)
 * yes i looked them but i could not found about events manager plugin
 * For example
    if member join any event get points if member maybe join event get
   half points not join get minus points 🙂
 * And also user can rate events and locations
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201818)
 * None of the modules that comes with CubePoints can accomplish this by default.
   You would need to make a custom module that hooks into your plugin. If you can
   post the link to the plugin you are using I could have a look and see if we can
   make you a custom module.
 *  Thread Starter [mp3_dinle](https://wordpress.org/support/users/mp3_dinle/)
 * (@mp3_dinle)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201819)
 * yes sure
 * [http://wordpress.org/extend/plugins/events-manager/](http://wordpress.org/extend/plugins/events-manager/)
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201820)
 * Ok so I made you a very simple module that will award points when a booking is“
   Approved” and remove these points if an already “Approved” booking is changed
   to cancelled or rejected (or any other status).
 * If you feel comfortable with PHP it shouldn’t be hard to add further features
   like when a user is “Maybe” joining etc.
 * Please note that I have not used this plugin before today so I do not know how
   you can have a “maybe joining” feature.
 * Installation:
    1. Create a file and name it event_manager.php 2. Copy the code
   bellow into this file and save. 3. Upload to wp-content/plugins/cubepoints/modules/
   folder 4. Activate the “Event Points” module just as you do with any other module
   5. Under “Config” set how many points a user gets for a booking and save. Done.
 *     ```
       <?php
       /** Event Manager Module */
       cp_module_register( __( 'Event Points' ) , 'eventpoints' , '1.0', 'dbm', 'http://www.merovingi.com', 'http://www.merovingi.com' , __( 'This module lets you award points for interacting with the Event Manager Plugin' ), 1 );
       /**
        * Add Setting when installing
        */
       add_action( 'cp_module_eventpoints_activate', 'cp_module_eventpoints_install' );
       function cp_module_eventpoints_install(){
       	add_option( 'cp_module_eventpoints_join', 10 );
       }
   
       if ( cp_module_activated( 'eventpoints' ) ) {
       	/**
       	 * Module Config
       	 */
       	add_action( 'cp_config_form', 'cp_module_eventpoints_config' );
       	function cp_module_eventpoints_config()
       	{ ?>
       		<br />
       		<h3><?php _e( 'Event Manager' ); ?></h3>
       		<table class="form-table">
   
       			<tr valign="top">
       				<th scope="row"><label for="cp_module_eventpoints_join"><?php _e( 'Points for Attending Event' ); ?>:</label></th>
       				<td valign="middle"><input type="text" id="cp_module_eventpoints_join" name="cp_module_eventpoints_join" value="<?php echo get_option( 'cp_module_eventpoints_join' ); ?>" size="30" /></td>
       			</tr>
   
       		</table>
       	<?php
       	}
   
       	/**
       	 * Save Points Settings
       	 */
       	add_action( 'cp_config_process', 'cp_module_eventpoints_config_process' );
       	function cp_module_eventpoints_config_process()
       	{
       		$cp_module_eventpoints_join = (int) $_POST['cp_module_eventpoints_join'];
   
       		update_option( 'cp_module_eventpoints_join', $cp_module_eventpoints_join );
       	}
   
       	/**
       	 * Adjust CubePoints Log Descriptions
       	 */
       	add_action( 'cp_logs_description', 'cp_admin_logs_desc_eventpoints', 10, 4 );
       	function cp_admin_logs_desc_eventpoints( $type, $uid, $points, $data )
       	{
       		if ( $type != 'eventpoints' ) { return; }
   
       		$data = unserialize( $data );
       		$post = get_post( $data['event_id'] );
       		$user = get_user_by('id', $uid );
       		if ( $data['action'] == 'join' )
       			echo  'Awarded points for attending <a href="' . get_permalink( $post->ID ) . '">' . $post->post_title . '</a>.';
       		elseif ( $data['action'] == 'remove' )
       			echo 'Removed points due to booking changed from "Approved".';
       	}
   
       	/**
       	 * Add Booking
       	 * If bookings gets automatically approved we add points using this filter.
       	 */
       	add_filter( 'em_bookings_add', 'cp_module_eventpoints_hook_add', 10, 2 );
       	function cp_module_eventpoints_hook_add( $result, $booking )
       	{
       		// If bookings get automatically approved and booking was successfully added, add points
       		if ( get_option( 'dbem_bookings_approval' ) == 0 && $result === true ) {
   
       			$points_for_joining = get_option( 'cp_module_eventpoints_join' );
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'join' );
       			cp_points( 'eventpoints', $booking->person_id, $points_for_joining, serialize($data) );
   
       		}
   
       		return $result;
       	}
       	/**
       	 * Approve Booking
       	 * If bookings gets approved by admin we add points using this filter.
       	 */
       	add_filter( 'em_booking_set_status', 'cp_module_eventpoints_hook_set_status', 10, 2 );
       	function cp_module_eventpoints_hook_set_status( $result, $booking )
       	{
       		$points_for_joining = get_option( 'cp_module_eventpoints_join' );
   
       		// If the new status is 'approved', add points
       		if ( $booking->booking_status == 1 && $booking->previous_status != 1 ) {
   
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'join' );
       			cp_points( 'eventpoints', $booking->person_id, $points_for_joining, serialize($data) );
   
       		}
       		// Else if status got changed from previously 'approved', remove points given
       		elseif ( $booking->booking_status != 1 && $booking->previous_status == 1 ) {
   
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'remove' );
       			cp_points( 'eventpoints', $booking->person_id, 0-$points_for_joining, serialize($data) );
   
       		}
   
       		return $result;
       	}
       }
       ?>
       ```
   
 *  [hkairsoftpo](https://wordpress.org/support/users/hkairsoftpo/)
 * (@hkairsoftpo)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201889)
 * Hi Gabriel,
 * I’m also looking for integration with events manager, while this should work 
   for booking an event, I was wondering if you could help make something that works
   for also creating an event. Currently I have events set up as posts, but creating
   an event does not assign points for some reason – maybe it needs to be a custom
   post? I saw your reply to another person regarding custom posts but I’m not much
   of a coder so don’t know how to make sense of it: [http://www.wpquestions.com/question/show/id/2756](http://www.wpquestions.com/question/show/id/2756)
 * Would highly appreciate your help!
 * Thanks
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201890)
 * For CubePoints to give points for Published posts the following has to be met:
 * – The Post has not received points before. (if you publish a post, get points
   and later make it a draft and then re-publish, the second time you will not get
   points).
    – More then zero points must be granted when publishing points.
 * If you are publishing a **private** post you will not get points it seems. You
   will find the hook that awards points in cp_hooks.php on line 75.
 *  [vulneratum](https://wordpress.org/support/users/vulnertum/)
 * (@vulnertum)
 * [13 years, 1 month ago](https://wordpress.org/support/topic/for-events-manager/#post-3201894)
 * Is there a way to award points to users submitting events (in the default manner)?
 *  [Blindacme](https://wordpress.org/support/users/blindacme/)
 * (@blindacme)
 * [13 years ago](https://wordpress.org/support/topic/for-events-manager/#post-3201898)
 * Hi Gabriel, you are a saint for going out of your way to provide the snippet 
   above.
 * I would like to modify your snippet above so that if someone says they are attending
   the event then they would be deducted the amount of points for attending an event(
   could vary)..
 * Im stuck because it seems your website has been down and I have been continuously
   trying it for the past week, although I know what happened to it, I hope you 
   get back online soon but with all of that being said I cant find anything anywhere
   on how to actually “spend” your points because it all takes me to your forum 
   which is currently down.
 * How can I set up the above to deduct points if a user decides to attend an event
   and where could I define the amount of points it costs for each event?
 * I am fairly comfortable with PHP so any direction would be nice since I cant 
   seem to get on your site to find out how the spending mechanism works.
 * Thanks in advance
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years ago](https://wordpress.org/support/topic/for-events-manager/#post-3201899)
 * Hey Blindacme.
 * Not sure what you mean with the website being down. For the record CubePoints
   is not my plugin, it’s just a plugin I have a lot of experience with.
 * I have included bellow the code modified to deduct points.
    Furthermore I changed
   it so it will first see if the post (event) has a custom post meta called “cubepoints_cost”.
   If it does, that amount is deducted / refunded. If not, the default settings 
   under “Config” is used instead.
 * If you set a positive number under “Config”, it will automatically change this
   into a negative value but you should be able to save a negative value under Config.
 *     ```
       <?php
       /** Event Manager Module */
       cp_module_register( __( 'Event Points' ) , 'eventpoints' , '1.0', 'dbm', 'http://www.merovingi.com', 'http://www.merovingi.com' , __( 'This module lets you award points for interacting with the Event Manager Plugin' ), 1 );
       /**
        * Add Setting when installing
        */
       add_action( 'cp_module_eventpoints_activate', 'cp_module_eventpoints_install' );
       function cp_module_eventpoints_install(){
       	add_option( 'cp_module_eventpoints_join', 10 );
       }
   
       if ( cp_module_activated( 'eventpoints' ) ) {
       	/**
       	 * Module Config
       	 */
       	add_action( 'cp_config_form', 'cp_module_eventpoints_config' );
       	function cp_module_eventpoints_config()
       	{ ?>
       		<br />
       		<h3><?php _e( 'Event Manager' ); ?></h3>
       		<table class="form-table">
   
       			<tr valign="top">
       				<th scope="row"><label for="cp_module_eventpoints_join"><?php _e( 'Points for Attending Event' ); ?>:</label></th>
       				<td valign="middle"><input type="text" id="cp_module_eventpoints_join" name="cp_module_eventpoints_join" value="<?php echo get_option( 'cp_module_eventpoints_join' ); ?>" size="30" /></td>
       			</tr>
   
       		</table>
       	<?php
       	}
   
       	/**
       	 * Save Points Settings
       	 */
       	add_action( 'cp_config_process', 'cp_module_eventpoints_config_process' );
       	function cp_module_eventpoints_config_process()
       	{
       		$cp_module_eventpoints_join = (int) $_POST['cp_module_eventpoints_join'];
   
       		update_option( 'cp_module_eventpoints_join', $cp_module_eventpoints_join );
       	}
   
       	/**
       	 * Adjust CubePoints Log Descriptions
       	 */
       	add_action( 'cp_logs_description', 'cp_admin_logs_desc_eventpoints', 10, 4 );
       	function cp_admin_logs_desc_eventpoints( $type, $uid, $points, $data )
       	{
       		if ( $type != 'eventpoints' ) { return; }
   
       		$data = unserialize( $data );
       		$post = get_post( $data['event_id'] );
       		$user = get_user_by('id', $uid );
       		if ( $data['action'] == 'join' )
       			echo  'Awarded points for attending <a href="' . get_permalink( $post->ID ) . '">' . $post->post_title . '</a>.';
       		elseif ( $data['action'] == 'remove' )
       			echo 'Removed points due to booking changed from "Approved".';
       	}
   
       	/**
       	 * Add Booking
       	 * If bookings gets automatically approved we add points using this filter.
       	 */
       	add_filter( 'em_bookings_add', 'cp_module_eventpoints_hook_add', 10, 2 );
       	function cp_module_eventpoints_hook_add( $result, $booking )
       	{
       		// If bookings get automatically approved and booking was successfully added, add points
       		if ( get_option( 'dbem_bookings_approval' ) == 0 && $result === true ) {
   
       			// If a custom post meta is set use that cost.
       			$custom_cost = get_post_meta( $booking->event->post_id, 'cubepoints_cost', true );
       			if ( empty( $custom_cost ) )
       				$custom_cost = get_option( 'cp_module_eventpoints_join' );
   
       			// Make sure it is a negative number since we want to deduct
       			if ( $custom_cost > 0 )
       				$custom_cost = '-' . $custom_cost;
   
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'join' );
       			cp_points( 'eventpoints', $booking->person_id, $custom_cost, serialize( $data ) );
   
       		}
   
       		return $result;
       	}
       	/**
       	 * Approve Booking
       	 * If bookings gets approved by admin we add points using this filter.
       	 */
       	add_filter( 'em_booking_set_status', 'cp_module_eventpoints_hook_set_status', 10, 2 );
       	function cp_module_eventpoints_hook_set_status( $result, $booking )
       	{
       		// If a custom post meta is set use that cost.
       		$cost = get_post_meta( $booking->event->post_id, 'cubepoints_cost', true );
       		if ( empty( $cost ) )
       			$cost = get_option( 'cp_module_eventpoints_join' );
   
       		// If the new status is 'approved', add points
       		if ( $booking->booking_status == 1 && $booking->previous_status != 1 ) {
   
       			// Make sure it is a negative number since we want to deduct
       			if ( $cost > 0 ) $cost = '-' . $cost;
   
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'join' );
       			cp_points( 'eventpoints', $booking->person_id, $cost, serialize( $data ) );
   
       		}
       		// Else if status got changed from previously 'approved', remove points given
       		elseif ( $booking->booking_status != 1 && $booking->previous_status == 1 ) {
   
       			// Make sure the value is positive to refund
       			$cost = abs( $cost );
   
       			$data = array( 'event_id' => $booking->event->post_id, 'action' => 'remove' );
       			cp_points( 'eventpoints', $booking->person_id, $cost, serialize( $data ) );
   
       		}
   
       		return $result;
       	}
       }
       ?>
       ```
   
 *  [Blindacme](https://wordpress.org/support/users/blindacme/)
 * (@blindacme)
 * [13 years ago](https://wordpress.org/support/topic/for-events-manager/#post-3201900)
 * Thanks, I just noticed you were not the original developer, which makes you even
   more awesome for helping so many people out with this, but yes – their site has
   been down for awhile and I just got cubepoints and was not able to find anything
   on deducting points.
 * Thanks for your help I will work with it and see if I get it working for my needs..
 * BTW kudos on your site man, Looks great! love the design
 *  [Blindacme](https://wordpress.org/support/users/blindacme/)
 * (@blindacme)
 * [13 years ago](https://wordpress.org/support/topic/for-events-manager/#post-3201901)
 * Gabriel, may I pick your brain for just one more thing? I was told I should use
   the em_booking_get_price filter similar to the one below.. I just dont know how
   I could easily incorporate this into the module so that I dont have to use custom
   fields but things are kind of automatic.
 * I figured with your experience with cubepoints this could be an easy question
   for you to answer and I really, really appreciate all the help your giving as
   I start to understand things.
    ** Here is a sample filter –
 *     ```
       function my_em_booking_get_price($content){
                       $content .= "Hello!";
               return $content;
       }
       add_filter('em_booking_get_price','my_em_booking_get_price');
       ```
   
 * **Here is another example of the filter I found online just in case it helps –**
 *     ```
       function my_em_booking_price($format = false, $EM_Booking){
        $discount = 1; //no discount
        if( $EM_Booking->booking_spaces > 2 ){
               $discount = 0.75; //25% discount
        }
        $price = $EM_Ticket->price * $discount;
        if($format){
               return em_get_currency_symbol().number_format($price,2);
        }
        return $price;
       }
       add_action('em_booking_get_price', 'my_em_booking_price', 10, 2);
       ```
   
 *  [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * (@designbymerovingi)
 * [13 years ago](https://wordpress.org/support/topic/for-events-manager/#post-3201902)
 * So what exactly are you looking for? Do you want to deduct the amount an event
   costs?
 *  [evalesco](https://wordpress.org/support/users/evalesco/)
 * (@evalesco)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201910)
 * This is so awesome. It is EXACTLY what I am looking for (using cubepoints to 
   pay for events). You are a saint!
 * Thanks Gabriel!
 *  [evalesco](https://wordpress.org/support/users/evalesco/)
 * (@evalesco)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/for-events-manager/#post-3201911)
 * Although, all of the sudden it stopped working. I think it happened after the
   last Buddypress update. When I purchase something using Cubepoints points are
   no longer deducted. Can you make any sense of this? Thanks!

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/for-events-manager/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/for-events-manager/page/2/?output_format=md)

The topic ‘for events manager’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cubepoints_8ba995.svg)
 * [CubePoints](https://wordpress.org/plugins/cubepoints/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cubepoints/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cubepoints/)
 * [Active Topics](https://wordpress.org/support/plugin/cubepoints/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cubepoints/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cubepoints/reviews/)

 * 17 replies
 * 7 participants
 * Last reply from: [myCred](https://wordpress.org/support/users/designbymerovingi/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/for-events-manager/page/2/#post-3201914)
 * Status: not resolved