Advertisement
Guest User

Untitled

a guest
Jan 8th, 2014
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.66 KB | None | 0 0
  1. if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
  2.         // Register buttons for the relevant component templates
  3.         // Friends button
  4.         if ( bp_is_active( 'friends' ) )
  5.             add_action( 'bp_member_header_actions',    'bp_add_friend_button',           5 );
  6.  
  7.         // Activity button
  8.         if ( bp_is_active( 'activity' ) && bp_activity_do_mentions() )
  9.             add_action( 'bp_member_header_actions',    'bp_send_public_message_button',  20 );
  10.  
  11.         // Messages button
  12.         if ( bp_is_active( 'messages' ) )
  13.             add_action( 'bp_member_header_actions',    'bp_send_private_message_button', 20 );
  14.  
  15.         // Group buttons
  16.         if ( bp_is_active( 'groups' ) ) {
  17.             add_action( 'bp_group_header_actions',     'bp_group_join_button',           5 );
  18.             add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
  19.         }
  20.  
  21.         // Blog button
  22.         if ( bp_is_active( 'blogs' ) )
  23.             add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
  24.     }
  25. }
  26. add_action( 'after_setup_theme', 'bp_dtheme_setup' );
  27. endif;
  28.  
  29. if ( !function_exists( 'bp_dtheme_enqueue_scripts' ) ) :
  30. /**
  31.  * Enqueue theme javascript safely
  32.  *
  33.  * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_script
  34.  * @since BuddyPress (1.5)
  35.  */
  36. function bp_dtheme_enqueue_scripts() {
  37.  
  38.     // Enqueue the global JS - Ajax will not work without it
  39.     wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ), bp_get_version() );
  40.  
  41.     // Add words that we need to use in JS to the end of the page so they can be translated and still used.
  42.     $params = array(
  43.  
  44.         'my_favs'           => __( 'My Favorites', 'buddypress' ),
  45.  
  46.         'accepted'          => __( 'Accepted', 'buddypress' ),
  47.  
  48.         'rejected'          => __( 'Rejected', 'buddypress' ),
  49.  
  50.         'show_all_comments' => __( 'Show all comments for this thread', 'buddypress' ),
  51.  
  52.         'show_x_comments'   => __( 'Show all %d comments', 'buddypress' ),
  53.  
  54.         'show_all'          => __( 'Show all', 'buddypress' ),
  55.  
  56.         'comments'          => __( 'comments', 'buddypress' ),
  57.  
  58.         'close'             => __( 'Close', 'buddypress' ),
  59.  
  60.         'view'              => __( 'View', 'buddypress' ),
  61.  
  62.         'mark_as_fav'       => __( 'Favorite', 'buddypress' ),
  63.  
  64.         'remove_fav'        => __( 'Remove Favorite', 'buddypress' ),
  65.  
  66.         'unsaved_changes'   => __( 'Your profile has unsaved changes. If you leave the page, the changes will be lost.', 'buddypress' ),
  67.  
  68.     );
  69.     wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
  70.  
  71.     // Maybe enqueue comment reply JS
  72.     if ( is_singular() && bp_is_blog_page() && get_option( 'thread_comments' ) )
  73.         wp_enqueue_script( 'comment-reply' );
  74. }
  75. add_action( 'wp_enqueue_scripts', 'bp_dtheme_enqueue_scripts' );
  76. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement