Plugin Directory

Changeset 3170781


Ignore:
Timestamp:
10/17/2024 02:30:16 PM (18 months ago)
Author:
codeverse93
Message:

Version 1.1

Location:
rsvp-manager/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • rsvp-manager/trunk/README.md

    r3164704 r3170781  
    55Requires at least: 4.7.19
    66Tested up to: 6.6.1
    7 Stable tag: 1.0
     7Stable tag: 1.1
    88Requires PHP: 7.4.19
    99License: GPLv3
     
    8686== Changelog ==
    8787
    88 = 1.0 =
     88= 1.1   - 17.10.2024 =
     89
     90#### New Features
     91- **Reciprocal Attendee Associations**:
     92    - Added a new option to enable reciprocal (mutual) associations between attendees. When attendee X is associated with attendee Y, Y is automatically associated with X.
     93    - Introduced the "Reciprocal Association" checkbox in the attendee creation/edit screen to control this behavior.
     94
     95= 1.0   - 07.10.2024 =
    8996* Initial release of the plugin with core functionality for managing RSVPs for a private event.
  • rsvp-manager/trunk/admin/actions/manage-attendee.php

    r3164462 r3170781  
    4848
    4949        // update the related attendees if there were changes
     50        $is_mutual_association = isset($_POST['mutual_association']);
    5051        $related_attendee_ids = isset($_POST['related_attendee_ids']) ? sanitize_text_field(wp_unslash($_POST['related_attendee_ids'])) : null;
    5152        if ($related_attendee_ids !== null) {
     
    5455                $ids = array_map('intval', $related_attendees_array);
    5556                if ($ids !== null) {
    56                     RelatedAttendeesHandler::get_instance()->save_related_attendees($attendee_id, $ids);
     57                    RelatedAttendeesHandler::get_instance()->save_related_attendees($attendee_id, $ids, $is_mutual_association);
    5758                }
    5859            }
  • rsvp-manager/trunk/admin/pages/info.php

    r3164462 r3170781  
    3030       
    3131        <h2>Version</h2>
    32         <p>Current Version: 1.0</p>
     32        <p>Current Version: 1.1</p>
    3333    </div>
    3434    <?php
  • rsvp-manager/trunk/css/related-attendees-styles.css

    r3164462 r3170781  
    4444    background-color: #cfcfcf;
    4545}
     46
     47.mutual_association_container {
     48    margin-top: 15px;
     49}
  • rsvp-manager/trunk/database/handlers/related_attendees_handler.php

    r3164462 r3170781  
    2828    }
    2929
    30     function save_related_attendees($main_attendee_id, $related_attendee_ids) {
     30    function save_related_attendees($main_attendee_id, $related_attendee_ids, $is_mutual_association) {
    3131        // First we remove the already related attendees for the main attendee.
    3232        $this->delete_related_attendees($main_attendee_id);
     
    4343            // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- The query is already safely prepared. No chaching is used for now.
    4444            $wpdb->query($query);
     45        }
     46
     47        if ($is_mutual_association) {
     48            $this->save_mutual_associations($main_attendee_id, $related_attendee_ids);
     49        }
     50    }
     51
     52    /**
     53     * For the related attendees of the main attendee, saves the main attendee as related attendee.
     54     */
     55    private function save_mutual_associations($main_attendee_id, $related_attendee_ids) {
     56        global $wpdb;
     57        $table_name = RelatedAttendeesTable::TABLE_NAME;
     58        foreach ($related_attendee_ids as $related_attendee_id) {
     59            // phpcs:ignore WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.DirectQuery -- Caching is not used. We have a custom db table here so we have to use a direct query.
     60            $wpdb->query($wpdb->prepare(
     61                // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- The query is already safely prepared.
     62                "INSERT IGNORE INTO {$table_name} (main_attendee_id, related_attendee_id) VALUES (%d, %d)",
     63                $related_attendee_id,
     64                $main_attendee_id
     65            ));
    4566        }
    4667    }
Note: See TracChangeset for help on using the changeset viewer.