Exemplo n.º 1
0
 /**
  * Status column
  *
  * @since BuddyDrive (1.0)
  * @param array $item A singular item (one full row)
  * @uses get_post_meta() to get item's privacy
  * @uses buddydrive_get_group_avatar() to get the avatar of the group the BuddyItem is attached to
  *
  */
 function column_status($item = array())
 {
     $privacy = get_post_meta($item['ID'], '_buddydrive_sharing_option', true);
     $status_desc = '';
     if (!empty($privacy)) {
         switch ($privacy) {
             case 'private':
                 $status_desc = '<i class="icon bd-icon-lock"></i> ' . __('Private', 'buddydrive');
                 break;
             case 'password':
                 $status_desc = '<i class="icon bd-icon-key"></i> ' . __('Password protected', 'buddydrive');
                 break;
             case 'public':
                 $status_desc = '<i class="icon bd-icon-unlocked"></i> ' . __('Public', 'buddydrive');
                 break;
             case 'friends':
                 $status_desc = '<i class="icon bd-icon-users"></i> ' . __('Friends only', 'buddydrive');
                 break;
             case 'groups':
                 $avatar = buddydrive_get_group_avatar($item['ID']);
                 $status_desc = $avatar;
                 break;
         }
     }
     echo apply_filters_ref_array('buddydrive_admin_get_item_status', array($status_desc, $privacy));
 }
/**
 * Displays the privacy of an item
 *
 * @uses buddydrive_get_item_privacy() to get the privacy option
 * @uses buddydrive_get_group_avatar() to get the group avatar of the group the item is attached to
 * @uses buddydrive_get_item_id() to get the id of the item
 */
function buddydrive_item_privacy()
{
    $status = buddydrive_get_item_privacy();
    switch ($status['privacy']) {
        case 'private':
            echo '<a title="' . __('Private', 'buddydrive') . '"><i class="icon bd-icon-lock"></i></a>';
            break;
        case 'public':
            echo '<a title="' . __('Public', 'buddydrive') . '"><i class="icon bd-icon-unlocked"></i></a>';
            break;
        case 'friends':
            echo '<a title="' . __('Friends', 'buddydrive') . '"><i class="icon bd-icon-users"></i></a>';
            break;
        case 'password':
            echo '<a title="' . __('Password protected', 'buddydrive') . '"><i class="icon bd-icon-key"></i></a>';
            break;
        case 'groups':
            if (!empty($status['group'])) {
                echo buddydrive_get_group_avatar(buddydrive_get_item_id());
            } else {
                _e('Group', 'buddydrive');
            }
            break;
        default:
            do_action('buddydrive_default_item_privacy');
            break;
    }
}
/**
 * Displays the privacy of an item
 *
 * @uses buddydrive_get_item_privacy() to get the privacy option
 * @uses buddydrive_get_group_avatar() to get the group avatar of the group the item is attached to
 * @uses buddydrive_get_item_id() to get the id of the item
 */
function buddydrive_item_privacy()
{
    $status = buddydrive_get_item_privacy();
    switch ($status['privacy']) {
        case 'private':
            echo '<a title="' . __('Private', 'buddydrive') . '"><i class="icon bd-icon-lock"></i></a>';
            break;
        case 'public':
            echo '<a title="' . __('Public', 'buddydrive') . '"><i class="icon bd-icon-unlocked"></i></a>';
            break;
        case 'friends':
            echo '<a title="' . __('Friends', 'buddydrive') . '"><i class="icon bd-icon-users"></i></a>';
            break;
        case 'password':
            echo '<a title="' . __('Password protected', 'buddydrive') . '"><i class="icon bd-icon-key"></i></a>';
            break;
        case 'groups':
            if (!empty($status['group'])) {
                echo buddydrive_get_group_avatar(buddydrive_get_item_id());
            } else {
                _e('Group', 'buddydrive');
            }
            break;
        default:
            /**
             * Hook here to output the content for your custom privacy options
             * 
             * @since 1.3.3
             * 
             * @param array $status The privacy status.
             */
            do_action('buddydrive_default_item_privacy', $status);
            break;
    }
}