Forum Replies Created

Viewing 15 replies - 1 through 15 (of 19 total)
  • Thread Starter tjsherlock

    (@tjsherlock)

    Thanks, but no dice.

    Thread Starter tjsherlock

    (@tjsherlock)

    Thank you. Yes I have done this already. But your suggestion does not actually set the value of the sale_price property in the WC_Product class. Debug it, and you shall see.

    Thread Starter tjsherlock

    (@tjsherlock)

    I seemed to have successfully added the boolean for ‘approval required’ and the field with the values of ‘pending’, ‘granted’, ‘denied’.

    Next I would like to add a registration page before the payment page. I thought that duplication the payment code with ‘new’ registration would allow me to have registration page. No luck. For some reason the field I added in the general page to select a page for registration is being saved. So, I’m missing something. I just dont’ know what.

    I can’t seem to get the registration page saved to the ‘ib_educator_settings’ options on the wp_options table.

    Thread Starter tjsherlock

    (@tjsherlock)

    Previously educatorteam said:

    /**
    * Fired right before the submitted course payment/registration form is processed.
    */
    do_action( ‘ib_educator_before_payment’ );

    I’m not sure how to use this flag or action. The value appears to be removed from the array, $wp_filter.

    is this simply marking a point in the process or workflow,which is removed from the array when arrived at?

    So once I’ve arrived at this point, can I then check for the value of approval_status and then some how create an entry and perhaps present a registration page in stead of a payment page?

    Thread Starter tjsherlock

    (@tjsherlock)

    Previously educatorteam said

    If the “ib_educator_access_status” filter returns “forbidden”, a student shouldn’t be able to register/pay.

    I could set ib_educator_access_status = ‘forbidden’ if approval status does not equal ‘granted’.
    However I still need to be able to create an entry that holds the approval status.

    Thread Starter tjsherlock

    (@tjsherlock)

    I’ve added a checkbox to the course page: ‘approval required’.
    Based on this I’ve added a property to entry: ‘approval status’, which has three potential values: pending (default), granted, denied.

    I’ve figured out which table needs to be updated to add this entry property, however it’s not yet clear to me which table to update for the checkbox in the course, which is essentially a wp_post of type ib_educator_course.

    I’m having troubling with recoding the workflow. I would like to the ‘register’ link to actually go to a registration page and not a payment page. I would also like to be able to instantiate an entry before having to pay for the course.

    The entry would have an approval_status of ‘pending’. Once the courses requested are reviewed the school director or a faculty member would edit that course changing the approval status to either ‘granted’ or ‘denied. Once granted the user would be allowed to move to the payment page.

    Any suggestions in achieving this workflow would be greatly appreciated.

    Thread Starter tjsherlock

    (@tjsherlock)

    I made some changes to eventorganiser_public_fullcalendar in my local copy.

    I discovered that the category event filter was being stored under $request[‘tax_query’][0][‘terms’]. This allowed me to limit the available event category colors to the categories in the filter.

    Please see code snippet below. Please let me know if I am violating any rules of the plugin code or WP coding standards.

    //Include venue if this is set
    			$venue = eo_get_venue($post->ID);
    
    			if($venue && !is_wp_error($venue)){
    				$event['className'][]= 'venue-'.eo_get_venue_slug($post->ID);//deprecated. use eo-event-venue-{slug}
    				$event['venue']=$venue;
    			}
    
    //Added this
    //Event category filter
                $filters = $request['tax_query'][0][terms];
                $cat_color = '';
    
    			//Event categories
    			$terms = get_the_terms( $post->ID, 'event-category' );//compare against fc event category filter
    			$event['category']=array();
    			if($terms):
    				foreach ($terms as $term):
                        if($filters): //Added $filters loop tjs 2015 Nov 10
                          foreach($filters as $filter)://Added $filters loop tjs 2015 Nov 10
                            if($term->slug===$filter){ //Added $filters loop tjs 2015 Nov 10
                            $event['category'][]= $term->slug;
                            $event['className'][]='category-'.$term->slug;//deprecated. use eo-event-cat-{slug}
    
                            $cat_color = eo_get_category_color($term); //Added tjs 2015 Nov 10 Setting to last category color by default
                            }
                          endforeach;
                        endif;
    				endforeach;
    			endif;
    
    			//Event tags
    			if( eventorganiser_get_option('eventtag') ){
    				$terms = get_the_terms( $post->ID, 'event-tag' );
    				$event['tags'] = array();
    				if( $terms && !is_wp_error( $terms ) ):
    					foreach ($terms as $term):
    						$event['tags'][]= $term->slug;
    						$event['className'][]='tag-'.$term->slug;//deprecated. use eo-event-tag-{slug}
    					endforeach;
    				endif;
    			}
    
    			//Event colour
    			$event['textColor'] = '#ffffff'; //default text colour
    			/*if( eo_get_event_color() ) {
    				$event['color'] = eo_get_event_color();
    				$event['textColor'] = eo_get_event_textcolor( $event['color'] );
    			}*/
    
                if($cat_color) {//Added tjs 2015 Nov 12
                  	$event['color'] = $cat_color;
    				$event['textColor'] = eo_get_event_textcolor( $event['color']);
                }
    Thread Starter tjsherlock

    (@tjsherlock)

    I’m considering adding a new flag (approval_required) to the entry.
    It will be below prerequisites.

    The additional statuses mentioned above would be available once approvalj_required is checked. I don’t know if these should be added to the ‘status’ field in the side column, or if an additional field should be created in the side column.

    Thread Starter tjsherlock

    (@tjsherlock)

    I’m not yet sure how to go about having the page display all courses requested needing approval. Any suggestions how to go about that would be helpful. Perhaps I can duplicate the page for my-courses. And break it up into sections:
    approval pending,
    approval granted
    approval denied

    It seems that there is a step ‘missing’. In the current workflow, the registration link is actually the payment page. It would make more sense to me if there were an actual registration page before payment. I could then perhaps take advantage of that to save requested courses before it hits the payment page.

    Thread Starter tjsherlock

    (@tjsherlock)

    Thank you. That was very helpful.

    I’m considering adding additional statuses:
    approval pending
    approval denied
    approval granted

    Please see: https://wordpress.org/support/topic/allow-student-to-register-after-guidance-counselor-approval?replies=4#post-7444529 .

    Thread Starter tjsherlock

    (@tjsherlock)

    the function eventorganiser_public_fullcalendar found in event-organiser-ajax.php pulls in event categories associated with an event. It disregards the event category filter applied to the calendar. It then selects an event color instead of the relevant category color.

    I would like to rework this method to take into consideration the event category filter when displaying a category color associated with an event.

    Thread Starter tjsherlock

    (@tjsherlock)

    Can I modify the function, page_styles( ), in event-organiser-calender.php to return a list of event-category terms limited to the filter applied in the shortcode, eo_fullcalendar? One argument is ‘category’ or ‘event_category’ with a list of permitted categories.

    /**
    	 * Prints page styles
    	 */
    	function page_styles(){
    		$css = '';
    		if ( $terms = get_terms( 'event-category', array( 'hide_empty' => 0 ) ) ):
    			foreach ( $terms as $term ):
    				$slug = sanitize_html_class( $term->slug );
    				$color = esc_attr( eo_get_category_color( $term ) ); //tjs 2015 Nov 5
    				$css .= ".cat-slug-{$slug} span.ui-selectmenu-item-icon{ background: {$color}; }\n";
    			endforeach;
    		endif;
    
    		wp_enqueue_style( 'eo_calendar-style' );
    		wp_enqueue_style( 'eventorganiser-style' );
    		//See trac ticket: https://core.trac.wordpress.org/ticket/24813
    		if( ( !defined( 'SCRIPT_DEBUG' ) || !SCRIPT_DEBUG ) && version_compare( get_bloginfo( 'version' ), '3.7', '<' ) ){
    			$css = "<style type='text/css'>\n" . $css . "</style>";
    		}
    
    		wp_add_inline_style( 'eo_calendar-style', $css );
    	}
    Thread Starter tjsherlock

    (@tjsherlock)

    So, in an effort, to hunt down the code that moves the date forward after clicking the next button, I used Netbeans+XDebug. This is very frustrating because using the debugger seems to prevent the data refresh. Data only refreshes when I run the plugin without debugging.

    So, again, it would be appreciated if someone in the know pointed me to the relevant code.

    Thread Starter tjsherlock

    (@tjsherlock)

    I figured out that the numbers of dates is hardcoded in the sql query in the file, event-organiser-ajax.php and the function eventorganiser_widget_agenda. I changed the LIMIT from 4 to 5 to and reset the first date displayed to be the Monday closest to the current date.

    However, when I click the next button to look at the next 5, nothing happens. So, clearly, I broke something. Any clue to help me reduce my wheel-spinning time?

    Thanks.

    function eventorganiser_widget_agenda() {
    
    /*. .  .  */
    $query['order'] = ($query['direction'] <1? 'DESC' : 'ASC');
    
    $query['quantity'] = 5; /* suggested code */
    
    		$key = 'eo_ag_'.md5(serialize($query)).get_locale();
    		$agenda = get_transient('eo_widget_agenda');
    		if( $agenda && is_array($agenda) && isset($agenda[$key]) ){
    			echo json_encode($agenda[$key]);
    			exit;
    		}
    
    		if( 'day' == $query['mode'] ){
    			//Day mode
    
                           $week_start_day = (int) get_option('start_of_week');  /* suggested code */
                           $event_day = (int) $today->format('w'); /* suggested code */
                           $week_start_date = $today->modify('- '.$event_day.' days');   /* suggested code */
    
    			$selectDates="SELECT DISTINCT StartDate FROM {$wpdb->eo_events}";
    			$whereDates = " WHERE {$wpdb->eo_events}.StartDate".( $query['order']=='ASC' ? " >= " : " <= ")."%s ";
    			$whereDates .= " AND {$wpdb->eo_events}.StartDate >= %s ";
    
                $orderlimit = "ORDER BY  {$wpdb->eo_events}.StartDate {$query['order']} LIMIT ".$query['quantity'];  /* suggested code */
    
                $dates = $wpdb->get_col($wpdb->prepare($selectDates.$whereDates.$orderlimit, $week_start_date, $week_start_date->format('Y-m-d')));  /* suggested code */
    
    /*. .  . */
                      }
    }
    Thread Starter tjsherlock

    (@tjsherlock)

    Nevermind. I just realized I had the textbox set to ‘visual’ instead of ‘text’. Switching to ‘text’ fixed my problem.

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