Changeset 9846
- Timestamp:
- 05/06/2015 11:42:53 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-loader.php
r9825 r9846 40 40 buddypress()->plugin_dir, 41 41 array( 42 'adminbar_myaccount_order' => 50 42 'adminbar_myaccount_order' => 50, 43 'features' => array( 'star' ) 43 44 ) 44 45 ); … … 68 69 ); 69 70 71 // Conditional includes 72 if ( bp_is_active( $this->id, 'star' ) ) { 73 $includes[] = 'star'; 74 } 75 70 76 parent::includes( $includes ); 71 77 } … … 167 173 ); 168 174 175 if ( bp_is_active( $this->id, 'star' ) ) { 176 $sub_nav[] = array( 177 'name' => __( 'Starred', 'buddypress' ), 178 'slug' => bp_get_messages_starred_slug(), 179 'parent_url' => $messages_link, 180 'parent_slug' => $this->slug, 181 'screen_function' => 'bp_messages_star_screen', 182 'position' => 11, 183 'user_has_access' => bp_core_can_edit_settings() 184 ); 185 } 186 169 187 $sub_nav[] = array( 170 188 'name' => __( 'Sent', 'buddypress' ), … … 243 261 'href' => trailingslashit( $messages_link . 'inbox' ) 244 262 ); 263 264 // Starred 265 if ( bp_is_active( $this->id, 'star' ) ) { 266 $wp_admin_nav[] = array( 267 'parent' => 'my-account-' . $this->id, 268 'id' => 'my-account-' . $this->id . '-starred', 269 'title' => __( 'Starred', 'buddypress' ), 270 'href' => trailingslashit( $messages_link . bp_get_messages_starred_slug() ) 271 ); 272 } 245 273 246 274 // Sent Messages -
trunk/src/bp-messages/bp-messages-template.php
r9830 r9846 1291 1291 <option value="unread"><?php _e( 'Mark unread', 'buddypress' ); ?></option> 1292 1292 <option value="delete"><?php _e( 'Delete', 'buddypress' ); ?></option> 1293 <?php 1294 /** 1295 * Action to add additional options to the messages bulk management dropdown. 1296 * 1297 * @since BuddyPress (2.3.0) 1298 */ 1299 do_action( 'bp_messages_bulk_management_dropdown' ); 1300 ?> 1293 1301 </select> 1294 1302 <input type="submit" id="messages-bulk-manage" class="button action" value="<?php esc_attr_e( 'Apply', 'buddypress' ); ?>"> -
trunk/src/bp-templates/bp-legacy/buddypress-functions.php
r9838 r9846 177 177 'messages_send_reply' => 'bp_legacy_theme_ajax_messages_send_reply', 178 178 ); 179 180 // Conditional actions 181 if ( bp_is_active( 'messages', 'star' ) ) { 182 $actions['messages_star'] = 'bp_legacy_theme_ajax_messages_star_handler'; 183 } 179 184 180 185 /** … … 308 313 wp_enqueue_script( $asset['handle'] . '-password-verify', $asset['location'], $dependencies, $this->version); 309 314 } 315 316 // Star private messages 317 if ( bp_is_active( 'messages', 'star' ) && bp_is_user_messages() ) { 318 wp_localize_script( $asset['handle'], 'BP_PM_Star', array( 319 'strings' => array( 320 'text_unstar' => __( 'Unstar', 'buddypress' ), 321 'text_star' => __( 'Star', 'buddypress' ), 322 'title_unstar' => __( 'Starred', 'buddypress' ), 323 'title_star' => __( 'Not starred', 'buddypress' ), 324 'title_unstar_thread' => __( 'Remove all starred messages in this thread', 'buddypress' ), 325 'title_star_thread' => __( 'Star the first message in this thread', 'buddypress' ), 326 ), 327 'is_single_thread' => (int) bp_is_messages_conversation(), 328 'star_counter' => 0, 329 'unstar_counter' => 0 330 ) ); 331 } 310 332 } 311 333 … … 1688 1710 exit; 1689 1711 } 1712 1713 /** 1714 * AJAX callback to set a message's star status. 1715 * 1716 * @since BuddyPress (2.3.0) 1717 */ 1718 function bp_legacy_theme_ajax_messages_star_handler() { 1719 if ( false === bp_is_active( 'messages', 'star' ) || empty( $_POST['message_id'] ) ) { 1720 return; 1721 } 1722 1723 // Check nonce 1724 check_ajax_referer( 'bp-messages-star-' . (int) $_POST['message_id'], 'nonce' ); 1725 1726 // Check capability 1727 if ( ! is_user_logged_in() || ! bp_core_can_edit_settings() ) { 1728 return; 1729 } 1730 1731 if ( true === bp_messages_star_set_action( array( 1732 'action' => $_POST['star_status'], 1733 'message_id' => (int) $_POST['message_id'], 1734 'bulk' => ! empty( $_POST['bulk'] ) ? true : false 1735 ) ) ) { 1736 echo '1'; 1737 die(); 1738 } 1739 1740 echo '-1'; 1741 die(); 1742 } -
trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/messages-loop.php
r9840 r9846 62 62 do_action( 'bp_messages_inbox_list_header' ); ?> 63 63 64 <?php if ( bp_is_active( 'messages', 'star' ) ) : ?> 65 <th scope="col" class="thread-star"><span class="message-action-star"><span class="icon"></span> <span class="screen-reader-text"><?php _e( 'Star', 'buddypress' ); ?></span></span></th> 66 <?php endif; ?> 67 64 68 <th scope="col" class="thread-options"><?php _e( 'Actions', 'buddypress' ); ?></th> 65 69 </tr> … … 107 111 */ 108 112 do_action( 'bp_messages_inbox_list_item' ); ?> 113 114 <?php if ( bp_is_active( 'messages', 'star' ) ) : ?> 115 <td class="thread-star"> 116 <?php bp_the_message_star_action_link( array( 'thread_id' => bp_get_message_thread_id() ) ); ?> 117 </td> 118 <?php endif; ?> 109 119 110 120 <td class="thread-options"> -
trunk/src/bp-templates/bp-legacy/buddypress/members/single/messages/single.php
r9830 r9846 70 70 <span class="activity"><?php bp_the_thread_message_time_since(); ?></span> 71 71 72 <?php if ( bp_is_active( 'messages', 'star' ) ) : ?> 73 <div class="message-star-actions"> 74 <?php bp_the_message_star_action_link(); ?> 75 </div> 76 <?php endif; ?> 77 72 78 <?php 73 79 -
trunk/src/bp-templates/bp-legacy/css/buddypress-rtl.css
r9832 r9846 1449 1449 } 1450 1450 1451 .message-metadata { 1452 position: relative; 1453 } 1454 .message-star-actions { 1455 position: absolute; 1456 left: 0; 1457 top: 0; 1458 } 1459 a.message-action-star, 1460 a.message-action-unstar { 1461 text-decoration: none; 1462 outline: none; 1463 } 1464 a.message-action-star { 1465 opacity: .7; 1466 } 1467 a.message-action-star:hover { 1468 opacity: 1; 1469 } 1470 .message-action-star span.icon:before, 1471 .message-action-unstar span.icon:before { 1472 font-family: dashicons; 1473 font-size: 18px; 1474 } 1475 .message-action-star span.icon:before { 1476 color: #aaa; 1477 content: "\f154"; 1478 } 1479 .message-action-unstar span.icon:before { 1480 color: #FCDD77; 1481 content: "\f155"; 1482 } 1483 1451 1484 /*-------------------------------------------------------------- 1452 1485 3.10 - Extended Profiles -
trunk/src/bp-templates/bp-legacy/css/buddypress.css
r9828 r9846 1449 1449 } 1450 1450 1451 .message-metadata { 1452 position: relative; 1453 } 1454 .message-star-actions { 1455 position: absolute; 1456 right: 0; 1457 top: 0; 1458 } 1459 a.message-action-star, 1460 a.message-action-unstar { 1461 text-decoration: none; 1462 outline: none; 1463 } 1464 a.message-action-star { 1465 opacity: .7; 1466 } 1467 a.message-action-star:hover { 1468 opacity: 1; 1469 } 1470 .message-action-star span.icon:before, 1471 .message-action-unstar span.icon:before { 1472 font-family: dashicons; 1473 font-size: 18px; 1474 } 1475 .message-action-star span.icon:before { 1476 color: #aaa; 1477 content: "\f154"; 1478 } 1479 .message-action-unstar span.icon:before { 1480 color: #FCDD77; 1481 content: "\f155"; 1482 } 1483 1451 1484 /*-------------------------------------------------------------- 1452 1485 3.10 - Extended Profiles -
trunk/src/bp-templates/bp-legacy/js/buddypress.js
r9829 r9846 1578 1578 jq('#messages-bulk-manage').attr('disabled', jq(this).val().length <= 0); 1579 1579 }); 1580 1581 /* Star action function */ 1582 starAction = function() { 1583 var link = jq(this); 1584 1585 jq.post( ajaxurl, { 1586 action: 'messages_star', 1587 'message_id': link.data('message-id'), 1588 'star_status': link.data('star-status'), 1589 'nonce': link.data('star-nonce'), 1590 'bulk': link.data('star-bulk') 1591 }, 1592 function(response) { 1593 if ( 1 === parseInt( response, 10 ) ) { 1594 if ( 'unstar' === link.data('star-status') ) { 1595 link.data('star-status', 'star'); 1596 link.removeClass('message-action-unstar').addClass('message-action-star'); 1597 link.find('.bp-screen-reader-text').text( BP_PM_Star.strings.text_star ); 1598 1599 if ( 1 === BP_PM_Star.is_single_thread ) { 1600 link.prop('title', BP_PM_Star.strings.title_star ); 1601 } else { 1602 link.prop('title', BP_PM_Star.strings.title_star_thread ); 1603 } 1604 1605 } else { 1606 link.data('star-status', 'unstar'); 1607 link.removeClass('message-action-star').addClass('message-action-unstar'); 1608 link.find('.bp-screen-reader-text').text(BP_PM_Star.strings.text_unstar); 1609 1610 if ( 1 === BP_PM_Star.is_single_thread ) { 1611 link.prop('title', BP_PM_Star.strings.title_unstar ); 1612 } else { 1613 link.prop('title', BP_PM_Star.strings.title_unstar_thread ); 1614 } 1615 } 1616 } 1617 }); 1618 return false; 1619 }; 1620 1621 /* Star actions */ 1622 jq('#message-threads').on('click', 'td.thread-star a', starAction ); 1623 jq('#message-thread').on('click', '.message-star-actions a', starAction ); 1624 1625 /* Star bulk manage - Show only the valid action based on the starred item. */ 1626 jq('#message-threads td.bulk-select-check :checkbox').on('change', function() { 1627 var box = jq(this), 1628 star = box.closest('tr').find('.thread-star a'); 1629 1630 if ( box.prop('checked') ) { 1631 if( 'unstar' === star.data('star-status') ) { 1632 BP_PM_Star.star_counter++; 1633 } else { 1634 BP_PM_Star.unstar_counter++; 1635 } 1636 } else { 1637 if( 'unstar' === star.data('star-status') ) { 1638 BP_PM_Star.star_counter--; 1639 } else { 1640 BP_PM_Star.unstar_counter--; 1641 } 1642 } 1643 1644 if ( BP_PM_Star.star_counter > 0 && parseInt( BP_PM_Star.unstar_counter, 10 ) === 0 ) { 1645 jq('option[value="star"]').hide(); 1646 } else { 1647 jq('option[value="star"]').show(); 1648 } 1649 1650 if ( BP_PM_Star.unstar_counter > 0 && parseInt( BP_PM_Star.star_counter, 10 ) === 0 ) { 1651 jq('option[value="unstar"]').hide(); 1652 } else { 1653 jq('option[value="unstar"]').show(); 1654 } 1655 }); 1656 1657 /** Notifications **********************************************/ 1580 1658 1581 1659 /* Selecting/Deselecting all notifications */
Note: See TracChangeset
for help on using the changeset viewer.