Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New speakers block #925

Merged
merged 61 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b14c692
Adds company logo to Speakers sidebar
cjyabraham Jul 16, 2024
47f0ff6
Duplicates Speakers block to create new block
cjyabraham Jul 16, 2024
47afc16
Clone speakers block other files
cjyabraham Jul 16, 2024
907f6c3
Adapting Speakers block 2
cjyabraham Jul 16, 2024
556d3d0
strip out unneeded options
cjyabraham Jul 16, 2024
52d421e
Bulid the new block
cjyabraham Jul 17, 2024
a0340df
Added new speaker fields
cjyabraham Jul 18, 2024
64851b9
Add help text
cjyabraham Jul 18, 2024
c3b02c7
Moved CNCF people design in to new speaker block
cjyabraham Jul 19, 2024
21fa7cb
Get the modal working
cjyabraham Jul 19, 2024
0dd497d
got the company logo showing
cjyabraham Jul 19, 2024
e633646
got the close image to show
cjyabraham Jul 19, 2024
aefd8f6
respect block width setting
cjyabraham Jul 21, 2024
30eed48
open social links in new tabs to be consistent with lfevents conventions
cjyabraham Jul 21, 2024
c5b4f2a
Fix social hover colors
cjyabraham Jul 21, 2024
443d14d
tweak designs
cjyabraham Jul 22, 2024
0c65dee
update comments
cjyabraham Jul 22, 2024
af2379f
amp up the name
cjyabraham Jul 22, 2024
79cea08
remove social links on tile
cjyabraham Jul 26, 2024
dc4b262
got the tiles looking good
cjyabraham Jul 26, 2024
37a7112
fixed image in modal
cjyabraham Jul 26, 2024
9eb5289
get things centered
cjyabraham Jul 26, 2024
9ad8eac
fix modal on mobile
cjyabraham Jul 26, 2024
453326a
style tweaks
cjyabraham Jul 26, 2024
a72f08c
fix image margin
cjyabraham Jul 26, 2024
276f7db
Fix image alt text
cjyabraham Jul 26, 2024
27bf88a
Add sched data bits
cjyabraham Aug 12, 2024
21691af
Got the sync with sched working and schedule showing in Speaker's modal
cjyabraham Aug 12, 2024
31780b4
Styled the schedule
cjyabraham Aug 12, 2024
5d37554
added venue
cjyabraham Aug 12, 2024
5516dea
improve the check
cjyabraham Aug 12, 2024
a9705fb
run the sync
cjyabraham Aug 12, 2024
e61a818
fixed errors with import
cjyabraham Aug 12, 2024
a93ba2a
turn of manual sync
cjyabraham Aug 12, 2024
9ed8926
fix code sniff
cjyabraham Aug 13, 2024
e94d045
Style tweaks
cjyabraham Aug 13, 2024
8012bd7
minor tweaks
cjyabraham Aug 13, 2024
b54a528
Only show active sessions; link directly to session
cjyabraham Aug 14, 2024
917ae22
styling tweaks
cjyabraham Aug 14, 2024
576eb36
link to bookmark on page
cjyabraham Aug 14, 2024
cccc1a4
Swaps in dnd-kit for react-beautiful-dnd to fix sort issue (fixes #929)
cjyabraham Aug 15, 2024
a59b3bb
Fixed issue with hidden select drop-down on speakers block (fixes #933)
cjyabraham Aug 19, 2024
f9f5319
Merge branch 'main' into new-speakers
cjyabraham Aug 20, 2024
2817809
Add a way to trigger Sched sync from Settings
thetwopct Aug 20, 2024
eac8715
Move timestamp update outside of loops
cjyabraham Aug 21, 2024
dd6ff82
fixed hardcoded event id
cjyabraham Aug 21, 2024
e8cabab
fixed update_post_meta command which automatically strips slashes
cjyabraham Aug 21, 2024
c9c1444
#934 Removing hardcoded LMFP URL
thetwopct Aug 21, 2024
001cb49
Rename, refactor, optimise
thetwopct Aug 21, 2024
c8d2c02
#935 fix npm run dev to keep watching files
thetwopct Aug 21, 2024
b9a3e49
Add generic speaker image
thetwopct Aug 21, 2024
1b9f089
Update PHPCS to include SB2
thetwopct Aug 21, 2024
0f21a3b
Improve accessibility of menu, #673
thetwopct Aug 22, 2024
ecfc327
Improve display of outlines site-wide, #673
thetwopct Aug 22, 2024
8e806bf
Additional accessibility improvements, #637
thetwopct Aug 22, 2024
cab1978
Update Speakers Block design
thetwopct Aug 22, 2024
547b12c
Improving Admin screen for Speakers
thetwopct Aug 22, 2024
054cf92
Style Tweaks
thetwopct Aug 23, 2024
86be553
Darken the background a touch
cjyabraham Aug 23, 2024
c07e463
Updates to speakers block 2
thetwopct Aug 29, 2024
3123956
Block makes use of event Sched ID
thetwopct Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
die;
}
$args = array(
'post_type' => 'page',
'post_parent' => 0,
'meta_query' => array(
'post_type' => 'page',
'post_parent' => 0,
'meta_query' => array(
array(
'key' => 'lfes_event_has_passed',
'compare' => '!=',
Expand All @@ -39,10 +39,10 @@

while ( $the_query->have_posts() ) {
$the_query->the_post();
$sched_event_id = get_post_meta( get_the_ID(), 'lfes_sched_event_id', true );
$sched_event_api_key = get_post_meta( get_the_ID(), 'lfes_sched_event_api_key', true );
$sched_event_id = get_post_meta( get_the_ID(), 'lfes_sched_event_id', true );
$sched_event_api_key = get_post_meta( get_the_ID(), 'lfes_sched_event_api_key', true );

$url = 'https://' . $sched_event_id . '.sched.com/api/session/export?api_key=' . $sched_event_api_key . '&format=json&strip_html=Y&custom_data=Y';
$url = 'https://' . $sched_event_id . '.sched.com/api/session/export?api_key=' . $sched_event_api_key . '&format=json&strip_html=Y&custom_data=Y';
$data = wp_remote_get( $url );
if ( is_wp_error( $data ) || ( wp_remote_retrieve_response_code( $data ) != 200 ) ) {
return false;
Expand All @@ -67,12 +67,12 @@
foreach ( $speakers as $username => $speaker ) {
// Step throught the speaker array and jsonify each element.
// Write that string to the speaker's postmeta using the event_id as the meta key.
$args = array(
'post_type' => 'lfe_speaker',
'meta_query' => array(
$args = array(
'post_type' => 'lfe_speaker',
'meta_query' => array(
array(
'key' => 'lfes_speaker_sched_username',
'value' => $username,
'key' => 'lfes_speaker_sched_username',
'value' => $username,
),
),
);
Expand All @@ -82,6 +82,7 @@
$speaker_query->the_post();
$speaker_id = get_the_ID();
update_post_meta( $speaker_id, $sched_event_id, json_encode( $speaker ) );
update_option( 'lfevents_sync_sched_last_run', current_time( 'timestamp' ) );
cjyabraham marked this conversation as resolved.
Show resolved Hide resolved
}
wp_reset_postdata(); // Restore original Post Data.
}
Expand Down
75 changes: 70 additions & 5 deletions web/wp-content/themes/lfevents/library/lfe-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function lfe_settings_page() {
function lfe_faster_np_checkbox_display() {
?>
<!-- Here we are comparing stored value with 1. Stored value is 1 if user checks the checkbox otherwise empty string. -->
<input type='checkbox' name='lfe-faster-np-checkbox' value='1'
<input type="checkbox" name="lfe-faster-np-checkbox" value="1"
<?php checked( 1, get_option( 'lfe-faster-np-checkbox' ), true ); ?> />
<p class='description'>
Check this box to speed up the Nested Pages tool. When checked, the hidden Events will not be accessible.
Expand Down Expand Up @@ -76,7 +76,7 @@ function lfe_generic_staff_image_display() {
<div class="image-preview-wrapper">
<img
src="<?php echo esc_url( wp_get_attachment_url( $generic_staff_image_id ) ); ?>"
class="image-preview"
class="image-preview" height="200" width="200"
data-id="lfe-generic-staff-image-id">
</div>

Expand All @@ -93,15 +93,14 @@ class="clear_upload_image_button button" value="Remove image" />
<?php
}


/**
* Options page callback.
*/
function lfe_options_page() {
?>
<div class='wrap'>
<div class="wrap">
<h1>LF Events Options</h1>
<form method='post' action='options.php'>
<form method="post" action="options.php">
<?php
settings_fields( 'lfe_options_section' );

Expand All @@ -110,6 +109,72 @@ function lfe_options_page() {
submit_button();
?>
</form>
<hr>
<h2>Sched Sync</h2>
<?php lfe_sync_sched_button_display(); ?>
</div>
<?php
}

/**
* Sched Sync Button Display
*/
function lfe_sync_sched_button_display() {
$last_run_time = get_option( 'lfevents_sync_sched_last_run' );
$timezone = get_option( 'timezone_string' ) ?? null;
?>
<form method="post" action="">
<?php wp_nonce_field( 'lfe_sync_sched_nonce_action', 'lfe_sync_sched_nonce' ); ?>
<input type="hidden" name="lfe_sync_sched_action" value="1">
<input type="submit" class="button-primary" value="Run Sched Sync Now">
</form>
<p>
The Sched schedule syncs twice per day. This button triggers the sync to run now.
</p>
<?php if ( $last_run_time ) : ?>
<p class="description"><strong>Last sync:</strong>
<?php
echo esc_html( gmdate( 'F j, Y, g:i a', $last_run_time ) );
if ( $timezone ) {
echo ' (' . esc_html( $timezone ) . ')';
}
?>
</p>
<?php else : ?>
<p class="description"><strong>Last sync:</strong> Never run</p>
<?php
endif;
}

/**
* Sched Sync request processing
*/
function lfe_handle_sync_sched() {
if ( isset( $_POST['lfe_sync_sched_action'] ) && current_user_can( 'manage_options' ) ) {
if ( isset( $_POST['lfe_sync_sched_nonce'] ) ) {
$nonce = sanitize_text_field( wp_unslash( $_POST['lfe_sync_sched_nonce'] ) );

if ( ! wp_verify_nonce( $nonce, 'lfe_sync_sched_nonce_action' ) ) {
wp_die( 'Nonce verification failed.' );
}
} else {
wp_die( 'Nonce is missing.' );
}

$admin = new LFEvents_Admin( 'lfevents', LFEVENTS_VERSION );
$admin->sync_sched();
add_action( 'admin_notices', 'lfe_sync_sched_success_notice' );
}
}
add_action( 'admin_init', 'lfe_handle_sync_sched' );

/**
* Sched Sync request success handler
*/
function lfe_sync_sched_success_notice() {
?>
<div class="notice notice-success is-dismissible">
<p>Sched sync successfully triggered. If Last Sync time updates, the sync request has been successful.</p>
</div>
<?php
}