• Hello

    I’d ask if is it possible to easily make integration of groups and events?

    I have added such function to views/admin.php

    /**
    	 * Metabox for the group.
    	 *
    	 * @param int $id Groups to choose
    	 * @param mixed $default The default value for this
    	 *
    	 * @since 0.1
    	 */
    	function metabox_group( $id, $default ) {
    		global $post;
    
    		$author = $post->post_author;
    
    	?>
    		<label for = 'ep-<?php echo $id; ?>-input'><?php _e('Connected to group', 'eventpress') ?></label>
    		<select name = 'ep-meta[<?php echo $id; ?>]'>
    	<?
    
    		$groups = groups_get_user_groups( $author );
    		foreach($groups[groups] as $key=>$eachgroup){
    			$temp = new BP_Groups_Group($eachgroup);
    
    			foreach ($temp->admins as $key2=>$eachadmin){
    
    				if (($eachadmin->user_id == $author)&&(($eachadmin->is_mod==1)||($eachadmin->is_admin==1)))
    					{
    					?>
    						<option value = '<?php echo $temp->slug ?>'><?php echo $temp->name ?></option>
    					<?
    					}
    			};
    		}
    	?>
    
    		</select>
    	<?php
    	}

    and modified:

    function metabox() {
    		global $post;
    
    		$grid = Array(
    				Array(
    					Array(
    						'width' => 10,
    						'id' => 'group',
    						'contents' => Array(&$this, 'metabox_group')
    					)
    				),
    
    	(...rest of code...)

    and in file controllers/wp.php modified fallowing function:
    function save_meta( $eventid, $event ) {
    by adding:

    if ( !empty( $meta['group'] ) )
    						$group = esc_html( $meta['group'] );

    and:
    $metalist = Array( 'limitreg', 'venue', 'group', 'startreg', 'stopreg', 'start', 'end', 'map', 'latlong', 'confirmreg');

    It works fine, but I would get listing of chosen group by such such URL:
    http://site/events/my_group
    or
    http://site/my_group/events

    Please, write how to do it?

Viewing 1 replies (of 1 total)
  • Plugin Author kunalb

    (@kunalb)

    I’m aiming to get this feature in by 0.2 (in 0.1.4 or 0.1.5, most probably) — the way you’re doing it is simply associating a meta value with the group, but this won’t restrict registration of an event to members of a group OR auto join members to a group on registering (which is the slightly trickier part).

    As for adding support to get the URLs, I’m not too sure about how the groups API works or what hooks are used, but ideally you should be able to get http://site/groups/my_group/events/ by adding a new subnav menu to the groups tab:

    $user_domain = ( !empty( $bp->displayed_user->domain ) ) ? $bp->displayed_user->domain : $bp->loggedin_user->domain;
    		bp_core_new_subnav_item( Array(
    				'name' => 'Events',
    				'slug' => events,
    				'parent_slug' => <the groups slug>,
    				'position' => 30,
    				'screen_function' => <add in function here>
    				'parent_url' => <same>
    		) );

    and then go to a add a function to load the index.php template from bpcp themes (see the bpcp/controllers.php and bpcp/views.php files to see) with a query_posts call before loading the template to get all events related to that group.

    Hope this helps; though I wouldn’t recommend directly modifying EventPress core. I should be shipping 0.1.2.2 with a few more bugfixes soon — a week or so, so if you can achieve this with a few hooks then just tell me which you need so I can add them in and you don’t lose these changes when you upgrade.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: EventPress] Events for group’ is closed to new replies.