Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/09/2013 01:59:32 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Introduce bp-notifications-actions.php to handle single notification status toggling.

  • Include new actions file in loader.
  • Tweak link output functions to make it moderately easier to debug the URL.
  • Introduce bp_notifications_mark_notification() to help with marking single notifications.
  • Fix bp_notifications_delete_notification() to work with new array argument pattern, introduced previously.
  • It's alive!

See #5148.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-notifications/bp-notifications-template.php

    r7540 r7543  
    661661    function bp_get_the_notification_mark_read_link() {
    662662
     663        // Get the URL with nonce, action, and id
     664        $url = wp_nonce_url( add_query_arg( array( 'action' => 'read', 'notification_id' => bp_get_the_notification_id() ), bp_get_notifications_unread_permalink() ), 'bp_notification_mark_read_' . bp_get_the_notification_id() );
     665
     666        // Start the output buffer
    663667        ob_start(); ?>
    664668
    665         <a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'read', 'id' => bp_get_the_notification_id() ), bp_get_notifications_unread_permalink() ), 'bp_notification_' . bp_get_the_notification_id() ); ?>" class="mark-read primary"><?php _e( 'Read', 'buddypress' ); ?></a>
     669        <a href="<?php echo esc_url( $url ); ?>" class="mark-read primary"><?php _e( 'Read', 'buddypress' ); ?></a>
    666670
    667671        <?php $retval = ob_get_clean();
     
    687691    function bp_get_the_notification_mark_unread_link() {
    688692
     693        // Get the URL with nonce, action, and id
     694        $url = wp_nonce_url( add_query_arg( array( 'action' => 'unread', 'notification_id' => bp_get_the_notification_id() ), bp_get_notifications_read_permalink() ), 'bp_notification_mark_unread_' . bp_get_the_notification_id() );
     695
     696        // Start the output buffer
    689697        ob_start(); ?>
    690698
    691         <a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'unread', 'id' => bp_get_the_notification_id() ), bp_get_notifications_read_permalink() ), 'bp_notification_' . bp_get_the_notification_id() ); ?>" class="mark-unread primary"><?php _e( 'Unread', 'buddypress' ); ?></a>
     699        <a href="<?php echo esc_url( $url ); ?>" class="mark-unread primary"><?php _e( 'Unread', 'buddypress' ); ?></a>
    692700
    693701        <?php $retval = ob_get_clean();
     
    746754        }
    747755
     756        // Get the URL with nonce, action, and id
     757        $url = wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'notification_id' => bp_get_the_notification_id() ), $link ), 'bp_notification_delete_' . bp_get_the_notification_id() );
     758
    748759        // Start the output buffer
    749760        ob_start(); ?>
    750761
    751         <a href="<?php echo wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'id' => bp_get_the_notification_id() ), $link ), 'bp_notification_' . bp_get_the_notification_id() ); ?>" class="delete secondary"><?php _e( 'Delete', 'buddypress' ); ?></a>
     762        <a href="<?php echo esc_url( $url ); ?>" class="delete secondary"><?php _e( 'Delete', 'buddypress' ); ?></a>
    752763
    753764        <?php $retval = ob_get_clean();
Note: See TracChangeset for help on using the changeset viewer.