Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/13/2010 01:08:31 AM (14 years ago)
Author:
johnjamesjacoby
Message:

Committing patch from #2566 for easier review and testing. Adds BP_Button class and associated template tags. Also includes code formatting fixes, phpdoc, widget fixes when friends component is disabled, and possibly the kitchen sink.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/bp-activity/bp-activity-templatetags.php

    r3245 r3260  
    922922        global $bp;
    923923
    924         return apply_filters( 'bp_get_send_public_message_link', $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) );
     924        if ( bp_is_my_profile() || !is_user_logged_in() )
     925            return false;
     926
     927        return apply_filters( 'bp_get_send_public_message_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->activity->slug . '/?r=' . bp_core_get_username( $bp->displayed_user->user_id, $bp->displayed_user->userdata->user_nicename, $bp->displayed_user->userdata->user_login ) ) );
     928    }
     929
     930/**
     931 * bp_send_public_message_button( $args )
     932 *
     933 * Output button for sending a public message
     934 *
     935 * @param array $args
     936 */
     937function bp_send_public_message_button( $args = '' ) {
     938    echo bp_get_send_public_message_button( $args );
     939}
     940    /**
     941     * bp_get_send_public_message_button( $args )
     942     *
     943     * Return button for sending a public message
     944     *
     945     * @param array $args
     946     * @return string
     947     */
     948    function bp_get_send_public_message_button( $args = '' ) {
     949        $defaults = array(
     950            'id'                => 'public_message',
     951            'component'         => 'activity',
     952            'must_be_logged_in' => true,
     953            'block_self'        => true,
     954            'wrapper_id'        => 'post-mention',
     955            'link_href'         => bp_get_send_public_message_link(),
     956            'link_title'        => __( 'Mention this user in a new public message, this will send the user a notification to get their attention.', 'buddypress' ),
     957            'link_text'         => __( 'Mention this User', 'buddypress' )
     958        );
     959
     960        $button = wp_parse_args( $args, $defaults );
     961
     962        // Filter and return the HTML button
     963        return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $button ) );
    925964    }
    926965
Note: See TracChangeset for help on using the changeset viewer.