Skip to:
Content

BuddyPress.org

Changeset 1688


Ignore:
Timestamp:
08/24/2009 08:45:17 PM (17 years ago)
Author:
apeatling
Message:

Added global action confirmation JS for use on delete links, or any sensitive action links. Use class="confirm" in your html anchor tags.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-cssjs.php

    r1687 r1688  
    5656?>
    5757    <style type="text/css">
    58         ul#adminmenu li.toplevel_page_bp-core .wp-menu-image a { background-image: url( <?php echo $bp->core->image_base . '/admin_menu_icon.png' ?> ) !important; background-position: -1px -32px; }
     58        ul#adminmenu li.toplevel_page_bp-core .wp-menu-image a { background-image: url( <?php echo BP_PLUGIN_URL . '/bp-core/images/admin_menu_icon.png' ?> ) !important; background-position: -1px -32px; }
    5959        ul#adminmenu li.toplevel_page_bp-core:hover .wp-menu-image a { background-position: -1px 0; }
    6060        ul#adminmenu li.toplevel_page_bp-core .wp-menu-image a img { display: none; }
     
    6363}
    6464add_action( 'admin_head', 'bp_core_admin_menu_icon_css' );
     65   
     66function bp_core_confirmation_js() {
     67?>
     68    <script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( '<?php _e( 'Are you sure?', 'buddypress' ) ?>' ) ) return true; else return false; }); });</script>
     69<?php
     70}
     71add_action( 'wp_head', 'bp_core_confirmation_js', 100 );
    6572
    6673/**
  • trunk/bp-forums.php

    r1636 r1688  
    99require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-templatetags.php' );
    1010require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-filters.php' );
    11 require ( BP_PLUGIN_DIR . '/bp-forums/bp-forums-cssjs.php' );
    1211
    1312function bp_forums_setup() {
  • trunk/bp-forums/bp-forums-bbpress.php

    r1652 r1688  
    118118        bb_update_option( 'uri', BB_URL );
    119119    }
    120    
    121     add_action( 'wp_head', 'bp_forums_add_js' );
    122    
     120
    123121    register_shutdown_function( create_function( '', 'do_action("bb_shutdown");' ) );
    124122}
  • trunk/bp-forums/bp-forums-templatetags.php

    r1655 r1688  
    415415            $links .= '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . '/close', 'bp_forums_close_topic' ) . '">' . __( 'Close', 'buddypress' ) . '</a> ' . $seperator . ' ';
    416416
    417         $links .= '<a id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . '/delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
     417        $links .= '<a class="confirm" id="topic-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . '/delete', 'bp_forums_delete_topic' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
    418418
    419419        return $links;
     
    696696
    697697        $links  = '<a href="' . wp_nonce_url( bp_get_the_topic_permalink() . $topic_template->post->id . '/post/' . $topic_template->post->post_id . '/edit/', 'bp_forums_edit_post' ) . '">' . __( 'Edit', 'buddypress' ) . '</a> ' . $seperator . ' ';
    698         $links .= '<a id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . '/post/' . $topic_template->post->post_id . '/delete/', 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
     698        $links .= '<a class="confirm" id="post-delete-link" href="' . wp_nonce_url( bp_get_the_topic_permalink() . '/post/' . $topic_template->post->post_id . '/delete/', 'bp_forums_delete_post' ) . '">' . __( 'Delete', 'buddypress' ) . '</a>';
    699699
    700700        return $links;
  • trunk/bp-themes/bp-sn-framework/messages/index.php

    r1655 r1688  
    5050                           
    5151                            <td width="10%">
    52                                 <a href="<?php bp_message_thread_delete_link() ?>" title="<?php _e("Delete Message", "buddypress"); ?>" class="delete"><?php _e("Delete", "buddypress"); ?></a> &nbsp;
     52                                <a href="<?php bp_message_thread_delete_link() ?>" title="<?php _e("Delete Message", "buddypress"); ?>" class="delete confirm"><?php _e("Delete", "buddypress"); ?></a> &nbsp;
    5353                                <input type="checkbox" name="message_ids[]" value="<?php bp_message_thread_id() ?>" />
    5454                            </td>
  • trunk/bp-themes/bp-sn-framework/messages/notices.php

    r1655 r1688  
    4343
    4444                        <td width="4%">
    45                             <a href="<?php bp_message_activate_deactivate_link() ?>"><?php bp_message_activate_deactivate_text() ?></a>
    46                             <a href="<?php bp_message_notice_delete_link() ?>" title="<?php _e("Delete Message", "buddypress"); ?>"><?php _e("Delete", "buddypress"); ?></a>
     45                            <a href="<?php bp_message_activate_deactivate_link() ?>" class="confirm"><?php bp_message_activate_deactivate_text() ?></a>
     46                            <a href="<?php bp_message_notice_delete_link() ?>" class="confirm" title="<?php _e("Delete Message", "buddypress"); ?>"><?php _e("Delete", "buddypress"); ?></a>
    4747                        </td>
    4848                    </tr>
  • trunk/bp-themes/bp-sn-framework/messages/sentbox.php

    r1655 r1688  
    4545
    4646                        <td width="10%">
    47                             <a href="<?php bp_message_thread_delete_link() ?>" title="<?php _e("Delete Message", "buddypress"); ?>" class="delete"><?php _e("Delete", "buddypress"); ?></a> &nbsp; 
     47                            <a href="<?php bp_message_thread_delete_link() ?>" title="<?php _e("Delete Message", "buddypress"); ?>" class="delete confirm"><?php _e("Delete", "buddypress"); ?></a> &nbsp; 
    4848                            <input type="checkbox" name="message_ids[]" value="<?php bp_message_thread_id() ?>" />
    4949                        </td>
  • trunk/bp-wire/bp-wire-templatetags.php

    r1655 r1688  
    364364        if ( ( $wire_posts_template->wire_post->user_id == $bp->loggedin_user->id ) || $bp->is_item_admin || is_site_admin() ) {
    365365            if ( $bp->wire->slug == $bp->current_component || $bp->profile->slug == $bp->current_component ) {
    366                 return apply_filters( 'bp_get_wire_delete_link', '<a href="' . wp_nonce_url( $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id, 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
     366                return apply_filters( 'bp_get_wire_delete_link', '<a class="confirm" href="' . wp_nonce_url( $bp->displayed_user->domain . $bp->wire->slug . '/delete/' . $wire_posts_template->wire_post->id, 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
    367367            } else {
    368                 return apply_filters( 'bp_get_wire_delete_link', '<a href="' . wp_nonce_url( site_url( $bp->{$bp->current_component}->slug . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id ), 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
     368                return apply_filters( 'bp_get_wire_delete_link', '<a class="confirm" href="' . wp_nonce_url( site_url( $bp->{$bp->current_component}->slug . '/' . $uri . '/wire/delete/' . $wire_posts_template->wire_post->id ), 'bp_wire_delete_link' ) . '">[' . __('Delete', 'buddypress') . ']</a>' );
    369369            }
    370370        }
Note: See TracChangeset for help on using the changeset viewer.