Making WordPress.org


Ignore:
Timestamp:
03/29/2018 11:03:20 PM (8 years ago)
Author:
coreymckrill
Message:

WordCamp tickets: Avoid permissions issue when generating email link

The notification emails for life-threatening allergies and special
accommodations are supposed to include a link to the attendee post, so the
organizer can find necessary details to follow up. However, using
get_edit_post_link() doesn't work when a non-site admin buys a ticket,
because the function checks if the current user can edit the post. This
generates the link manually instead.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php

    r6966 r6978  
    209209        $current_wordcamp = get_wordcamp_post();
    210210        $wordcamp_name    = get_wordcamp_name( get_wordcamp_site_id( $current_wordcamp ) );
     211        $post_type_object = get_post_type_object( $attendee->post_type );
     212        $attendee_link    = add_query_arg( 'action', 'edit', admin_url( sprintf( $post_type_object->_edit_link, $attendee->ID ) ) );
    211213        $handbook_link    = 'https://make.wordpress.org/community/handbook/wordcamp-organizer/planning-details/selling-tickets/life-threatening-allergies/';
    212214        $support_email    = 'support@wordcamp.org';
     
    229231            );
    230232
    231             $message_line_1 =  wp_strip_all_tags( __( 'The following attendee has indicated that they have a life-threatening allergy. Please note that this information is confidential.', 'wordcamporg' ) );
     233            $message_line_1 = wp_strip_all_tags( __( 'The following attendee has indicated that they have a life-threatening allergy. Please note that this information is confidential.', 'wordcamporg' ) );
    232234
    233235            $message_line_2 = wp_strip_all_tags( __( 'Please follow the procedure outlined in the WordCamp Organizer Handbook to ensure the health and safety of this event\'s attendees.', 'wordcamporg' ) );
     
    239241                "%s\n\n%s\n\n%s\n\n%s",
    240242                $message_line_1,
    241                 get_edit_post_link( $attendee, 'plaintext' ), // Link to attendee post's Edit screen.
     243                esc_url_raw( $attendee_link ), // Link to attendee post's Edit screen.
    242244                $message_line_2,
    243245                $handbook_link // Link to page in WordCamp Organizer Handbook.
Note: See TracChangeset for help on using the changeset viewer.