Changeset 386
- Timestamp:
- 02/06/2014 11:26:14 PM (13 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page
- Files:
-
- 3 edited
-
TODO.txt (modified) (4 diffs)
-
classes/wordcamp-coming-soon-page.php (modified) (1 diff)
-
views/template-coming-soon.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/TODO.txt
r383 r386 1 1 High priority: 2 wccsp_image_id3 2 contact form bug 4 3 confirmation that contact form was sent … … 6 5 make work consistently with any theme 7 6 warn user that image preview won't update until they save settings 7 refactor get_contact_form_shortcode() once https://github.com/Automattic/jetpack/issues/102 is fixed 8 8 9 9 … … 11 11 add color pickers 12 12 update image preview after they pick new but before they save/refresh 13 customize image size in template13 add admin notice if missing page w/ contact form or it's not published 14 14 contact form shortcode - lookup email from wordcamp cpt instead of admin email? 15 15 internationalize 16 16 any other TODOs in code 17 customize image size in template 17 18 18 19 19 20 Low priority: 20 21 styles … … 23 24 contact form submitted to latest post url instead of current page (if on home page) 24 25 make dashes/underscores consistent in html element ids/names 26 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wordcamp-coming-soon-page.php
r381 r386 137 137 138 138 /** 139 * Generate the contact form shortcode string 140 * 141 * @return string 139 * Retrieve the contact form shortcode string 140 * 141 * We can't just create an arbitrary shortcode because of https://github.com/Automattic/jetpack/issues/102. Instead we have to use a form that's tied to a page. 142 * This is somewhat fragile, though. It should work in most cases because the first $page that contains [contact-form] will be the one we automatically create 143 * when the site is created, but if the organizers delete that and then add multiple forms, the wrong form could be displayed. The alternative approaches also 144 * have problems, though, and #102 should be fixed relatively soon, so hopefully this will be good enough until it can be refactored. 145 * todo Refactor this once #102-jetpack is fixed. 146 * 147 * @return string|false 142 148 */ 143 149 public function get_contact_form_shortcode() { 144 $shortcode = sprintf( 145 "[contact-form to='%s' subject='%s contact request'] 146 [contact-field label='Name' type='name' required='1' /] 147 [contact-field label='Email' type='email' required='1' /] 148 [contact-field label='Comment' type='textarea' required='1' /] 149 [/contact-form]", 150 get_bloginfo( 'name' ), 151 get_option( 'admin_email' ) 152 ); 150 $contact_form_shortcode = false; 151 $shortcode_regex = get_shortcode_regex(); 153 152 154 return $shortcode; 153 $all_pages = get_posts( array( 154 'post_type' => 'page', 155 'post_status' => 'any', 156 'posts_per_page' => -1, 157 ) ); 158 159 foreach ( $all_pages as $page ) { 160 preg_match_all( '/' . $shortcode_regex . '/s', $page->post_content, $matches, PREG_SET_ORDER ); 161 162 foreach ( $matches as $shortcode ) { 163 if ( 'contact-form' === $shortcode[2] ) { 164 global $post; 165 $post = $page; 166 setup_postdata( $post ); 167 168 ob_start(); 169 echo do_shortcode( $shortcode[0] ); 170 $contact_form_shortcode = ob_get_clean(); 171 172 wp_reset_postdata(); 173 break; 174 } 175 } 176 } 177 178 return $contact_form_shortcode; 155 179 } 156 180 } // end WordCamp_Coming_Soon_Page -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/views/template-coming-soon.php
r383 r386 37 37 <h2>Contact the Organizers</h2> 38 38 39 <?php echo do_shortcode( $contact_form_shortcode ); ?>39 <?php echo $contact_form_shortcode; ?> 40 40 </div> 41 41 <?php endif; ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)