Forum Replies Created
-
AuthorPosts
-
Lou
ParticipantHmm, typed a rather lengthy reply on how I got this to work, but it seems to have disappeared. Maybe because I edited it twice? Tried to repost and was told it was a duplicate, so hopefully it will show up eventually.
Lou
ParticipantI was able to get the css method to work. It required using actions invoked at the start of the event add and event list functions by Main.php. I’m documenting this here in case anyone else has similar needs. Note my theme is “steeps” (https://github.com/louking/steeps) so all of the functions and classes start with steeps_
This behavior can be seen at https://sandbox.steeplechasers.org/events/community/add
functions.php – add to the bottom
/** * For The Events Calendar: Community Events, on the event page, check for some special conditions. This is * being done to control display of "before html" content */ if ( is_plugin_active('the-events-calendar-community-events/tribe-community-events.php') ) { $ce_event_class = 'steeps-ce-class-unknown'; // adapted from Tribe__Events__Community__Main.get_submitted_event (Main.php) function steeps_get_submitted_event() { if ( empty( $_POST[ 'community-event' ] ) ) { return array(); } if ( ! check_admin_referer( 'ecp_event_submission' ) ) { return array(); } $submission = $_POST; return $submission; } // adapted from Tribe__Events__Community__Main.doEventForm (Main.php) // this action is invoked before community/edit processing function steeps_ce_determine_class_edit ( $id ) { global $ce_event_class; if ( $id ) { $tribe_event_id = $id = intval( $id ); } else { $tribe_event_id = null; } if ( $tribe_event_id ) { $event = get_post( intval( $tribe_event_id ) ); } // special class if logged out // NOTE: assumes allow anonymous submissions configured as false if ( ! is_user_logged_in() ) { $ce_event_class = 'steeps-ce-class-logged-out'; // logged in } else { $submission = steeps_get_submitted_event(); if (! empty( $submission )) { $ce_event_class = 'steeps-ce-class-submitted'; } else { $ce_event_class = 'steeps-ce-class-empty-form'; } } } add_action( 'tribe_community_before_event_page', 'steeps_ce_determine_class_edit', 11 ); // adapted from Tribe__Events__Community__Main.doMyEvents (Main.php) // this action is invoked before community/list processing function steeps_ce_determine_class_list ( ) { global $ce_event_class; // special class if logged out if ( ! is_user_logged_in() ) { $ce_event_class = 'steeps-ce-class-logged-out'; // logged in } else { $ce_event_class = 'steeps-ce-class-list'; } } add_action( 'tribe_ce_before_event_list_page', 'steeps_ce_determine_class_list', 11 ); function steeps_before_html ( $string ) { global $ce_event_class; return '<div class="steeps-ce-before-html ' . $ce_event_class . '">' . $string . '</div>'; // return '<div class=steeps-ce-before-html>' . $string . '</div>'; } add_filter( 'tribe_events_before_html', 'steeps_before_html' ); // after html is noop for now function steeps_after_html( $string ) { return $string; } add_filter( 'tribe_events_after_html', 'steeps_after_html' ); }style.css – add to the bottom
/* * before html styling */ .tribe-events-before-html ul li { line-height: inherit; margin: 0 0 0 0; } .tribe-events-before-html table { border-collapse: collapse; } .tribe-events-before-html table, .tribe-events-before-html th, .tribe-events-before-html td { /*border: 1px solid black;*/ padding: 3px; } body.tribe_community_edit .steeps-ce-class-logged-out > form#loginform { margin-top: 21px; } body.tribe_community_edit .steeps-ce-class-logged-out > .register { margin-bottom: 21px; } /* * the events calendar - before html configuration * selective for month view, community events add, community events list * requires steeps-event-community-xxxx class to be used in before or after html configuration */ body.events-gridview .steeps-event-month-view { display: initial !important; /* display only on month view */ } body.tribe_community_edit .steeps-ce-class-logged-out .steeps-event-community-logged-out, body.tribe_community_list .steeps-ce-class-logged-out .steeps-event-community-logged-out { display: initial !important; /* display when logged out ( edit and list views) */ } body.tribe_community_edit .steeps-ce-class-logged-out > p, body.tribe_community_list .steeps-ce-class-logged-out > p { display: none; /* hide default text when logged out ( edit and list views) */ } body.tribe_community_edit .steeps-ce-class-empty-form .steeps-event-community-add { display: initial !important; /* display only on community add empty form */ } body.tribe_community_edit .steeps-ce-class-submitted .steeps-event-community-add-submitted { display: initial !important; /* display only on community add after submission */ }example “before html” events display configuration (with angle brackets replaced with square brackets)
[div class="steeps-event-month-view" style="display: none;"] To request that your event be added to the Steeplechasers Events calendar, please click on [a href="https://steeplechasers.org/events/community/add"]Add Event[/a]. To find events for which volunteers are needed, under Event Category, check Course Marking and Finish Line, and click SUBMIT. If you see a race you can help at, send email to [a href="mailto:[email protected]"][email protected][/a]. (If you don't see Event Category, try clicking 'Show Filters' first). [/div] [div class="steeps-event-community-add" style="display: none;"] Race Directors should use this form to request that local running events (within 75 miles of Frederick, MD) be placed on our calendar. Please provide the following [table] [tr][th]Field[/th][th]Description[/th][/tr] [tr][td]EVENT TITLE[/td][td]Race Name[/td][/tr] [tr][td]EVENT DESCRIPTION[/td][td]Any text you'd like included in the race description, e.g., a little bit about why you're putting on this race, what it benefits, how to register -- registration URL, link to flyer, etc[/td][/tr] [tr][td]EVENT TIME & DATE[/td][td]Race Date and Time[/td][/tr] [tr][td]EVENT IMAGE[/td][td]Optionally add an image to your event[/td][/tr] [tr][td]VENUE DETAILS[/td][td]Race Location - please search first as the venue may already exist[/td][/tr] [tr][td]ORGANIZER DETAILS[/td][td]Organizer Name (required), Organizer Email (required), Organizer Phone (optional). Again please search first as the organizer may already exist[/td][/tr] [tr][td]EVENT WEBSITE[/td][td]Race Website - this website should give information about the race and most likely also links to registration site[/td][/tr] [/table] [/div] [div class="steeps-event-community-add-submitted" style="display:none;"] Your submission will be reviewed before publishing -- this process can take several days. [b]Note:[/b] FSRC reserves the right to choose which races are published. [/div] [div class="steeps-event-community-logged-out" style="display:none;"] You need to be logged in to edit or list events. If you have an account, please log in below, otherwise please register using the "Register" link beneath the LOG IN button. [/div]-
This reply was modified 8 years, 9 months ago by
Lou. Reason: add link to example site
Lou
ParticipantI was given alternative guidance earlier about how to use css to achieve my goals.
In any case, I looked at the code in the edit-event.php file but don’t see how the login is rendered, nor how the ‘event submitted’ text is rendered.
What template(s) do these renderings originate from?
July 4, 2017 at 3:27 am in reply to: different html before specific views, on view by view basis? #1315773Lou
ParticipantI hadn’t considered the last alternative of different classes which are controlled by view. This seems the best way to go for me, as the text is then configurable rather than hard coded in functions.php or the template.
Thanks!
July 3, 2017 at 2:08 pm in reply to: different html before specific views, on view by view basis? #1315623Lou
ParticipantYes I’m talking about https://theeventscalendar.com/extensions/display-custom-html-specific-calendar-views/ . When installed it shows up as “The Events Calendar Extension: Selectively Show HTML Boxes” in the plugins list.
With this extension I can set the html before the month view, or set the html before the community event edit view using Events > Settings > Display > Advanced Template Settings > Add HTML before event content. Actually there’s a set of checkboxes after “Show HTML before on” and I can set the same html before multiple views.
Problem is I need the html before month view to be different from the html before community event edit view. So I guess I need to use the solution I mentioned.
Also can you tell me where is the documentation on available actions, like tribe_events_community_section_after_title?
June 20, 2017 at 2:47 pm in reply to: noob questions – field visibility, categories, security #1300764Lou
ParticipantAwesome, thanks!
June 20, 2017 at 2:17 pm in reply to: noob questions – field visibility, categories, security #1300745Lou
ParticipantThanks. Yes was talking about the community/add page. We decided to simply hide the custom fields and categories with css for now. I’ll visit the user voice page to ask for or upvote these features.
June 17, 2017 at 1:10 pm in reply to: noob questions – field visibility, categories, security #1299671Lou
Participant(should have searched about google maps, just saw https://theeventscalendar.com/support/forums/topic/google-map-toggle-on-community-events-submission/#dl_post-1295667)
June 17, 2017 at 1:01 pm in reply to: noob questions – field visibility, categories, security #1299670Lou
Participantalso noticed there’s no way to set to show google maps link. It would be nice to allow that to be configurable by the administrator
June 17, 2017 at 11:29 am in reply to: Conflict with 'Toggle wpautop' plugin makes Community Events unusable #1299658Lou
ParticipantActually https://sandbox.steeplechasers.org/events/community/list was garbled with a lot of extra [br] tags. I had to modify my code to check for tribe_is_community_my_events_page() as well.
/** * Detect plugin. For use on Front End only. See https://codex.wordpress.org/Function_Reference/is_plugin_active */ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); /** * Special processing to avoid conflicts between Toggle wpautop and The Events Calendar Community Events. * An alternate solution would be to make this occur first and update_post_meta( $post_id, '_lp_disable_wpautop', 1 ) * but that is a bit less direct. However this assumes understanding of Toggle wpautop internals. */ if ( is_plugin_active('toggle-wpautop/toggle-wpautop.php') && is_plugin_active('the-events-calendar-community-events/tribe-community-events.php') ) { if ( ! function_exists( 'steeps_the_post' ) ) : function steeps_the_post( $post ) { // remove wpautop for tribe community events // without this extra <p> tags are generated in these pages by Toggle wpautop plugin, causing javascript errors if ( tribe_is_community_edit_event_page() || tribe_is_community_my_events_page() ) { remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); } } endif; // steeps_the_post add_action( 'the_post', 'steeps_the_post', 11 ); // needs to be higher priority than the_post in LP_Toggle_wpautop.__construct }June 17, 2017 at 6:53 am in reply to: Conflict with 'Toggle wpautop' plugin makes Community Events unusable #1299575Lou
ParticipantThanks for the idea. I was able to resolve the conflict by adding the following code in my theme’s functions.php file. Note I could do this only because I have complete control of my theme. Casual theme and plugin users would have to figure out another way to get this workaround into their system.
/** * Detect plugin. For use on Front End only. See https://codex.wordpress.org/Function_Reference/is_plugin_active */ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); /* ** Special processing to avoid conflicts between Toggle wpautop and The Events Calendar Community Events. ** An alternate solution would be to make this occur first and update_post_meta( $post_id, '_lp_disable_wpautop', 1 ) ** but that is a bit less direct. However this assumes understanding of Toggle wpautop internals. */ if ( is_plugin_active('toggle-wpautop/toggle-wpautop.php') && is_plugin_active('the-events-calendar-community-events/tribe-community-events.php') ) { if ( ! function_exists( 'steeps_the_post' ) ) : function steeps_the_post( $post ) { // remove wpautop for tribe community events // without this extra <p> tags are generated in these pages by Toggle wpautop plugin, causing javascript errors if ( tribe_is_community_edit_event_page () ) { remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); } } add_action( 'the_post', 'steeps_the_post', 11 ); // needs to be higher priority than the_post in LP_Toggle_wpautop.__construct endif; // steeps_the_post }June 16, 2017 at 2:28 pm in reply to: Conflict with 'Toggle wpautop' plugin makes Community Events unusable #1299387Lou
ParticipantI will try this. I’m a bit murky about what happens when and how to hook my function in, but I will do some research. I will report back my results.
June 16, 2017 at 3:14 am in reply to: Conflict with 'Toggle wpautop' plugin makes Community Events unusable #1299007Lou
ParticipantLooks like toggle-wpautop.php has the following, so my need is to set _lp_disable_wpautop into the post metadata for the ‘post’ which is the event editor (and any other community events views). Please tell me what is the best way to do this.
function the_post( $post ) { if ( get_post_meta( $post->ID, '_lp_disable_wpautop', true ) ) { remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt', 'wpautop' ); } else { if ( ! has_filter( 'the_content', 'wpautop' ) ) { add_filter( 'the_content', 'wpautop' ); } if ( ! has_filter( 'the_excerpt', 'wpautop' ) ) { add_filter( 'the_excerpt', 'wpautop' ); } } } -
This reply was modified 8 years, 9 months ago by
-
AuthorPosts
