Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/29/2008 10:26:10 PM (17 years ago)
Author:
apeatling
Message:

Introduced functions and settings to determine whether or not a user can post to a wire. When a user is not a member of a group, they can now no longer see the post to wire input box.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-wire/bp-wire-templatetags.php

    r359 r367  
    1414    var $total_wire_post_count;
    1515   
     16    var $can_post;
     17   
    1618    var $table_name;
    1719   
    18     function bp_wire_posts_template( $item_id ) {
     20    function bp_wire_posts_template( $item_id, $can_post ) {
    1921        global $bp;
    2022       
     
    3335        $this->wire_posts = $this->wire_posts['wire_posts'];
    3436        $this->wire_post_count = count($this->wire_posts);
     37       
     38        $this->can_post = $can_post;
    3539       
    3640        $this->pag_links = paginate_links( array(
     
    9195}
    9296
    93 function bp_has_wire_posts( $item_id = null ) {
     97function bp_has_wire_posts( $item_id = null, $can_post = true ) {
    9498    global $wire_posts_template, $bp;
    9599   
     
    97101        return false;
    98102       
    99     $wire_posts_template = new BP_Wire_Posts_Template( $item_id );     
     103    $wire_posts_template = new BP_Wire_Posts_Template( $item_id, $can_post );       
    100104    return $wire_posts_template->has_wire_posts();
    101105}
     
    111115}
    112116
    113 function bp_wire_get_post_list( $bp_wire_item_id = null, $bp_wire_title = null, $bp_wire_empty_message = null ) {
    114     global $bp_item_id, $bp_wire_header, $bp_wire_msg;
    115 
    116     if ( !$bp_wire_item_id )
    117         return false;
    118    
    119     if ( !$bp_wire_empty_message )
    120         $bp_wire_empty_message = __("There are currently no wire posts.");
    121    
    122     if ( !$bp_wire_title )
    123         $bp_wire_title = __('Wire');
     117function bp_wire_get_post_list( $item_id = null, $title = null, $empty_message = null, $can_post = true ) {
     118    global $bp_item_id, $bp_wire_header, $bp_wire_msg, $bp_wire_can_post;
     119
     120    if ( !$item_id )
     121        return false;
     122   
     123    if ( !$message )
     124        $empty_message = __("There are currently no wire posts.");
     125   
     126    if ( !$title )
     127        $title = __('Wire');
    124128   
    125129    /* Pass them as globals, using the same name doesn't work. */
    126     $bp_item_id = $bp_wire_item_id;
    127     $bp_wire_header = $bp_wire_title;
    128     $bp_wire_msg = $bp_wire_empty_message;
     130    $bp_item_id = $item_id;
     131    $bp_wire_header = $title;
     132    $bp_wire_msg = $empty_message;
     133    $bp_wire_can_post = $can_post;
    129134   
    130135    load_template( TEMPLATEPATH . '/wire/post-list.php' );
     
    144149    global $bp_wire_msg;
    145150    echo $bp_wire_msg;
     151}
     152
     153function bp_wire_can_post() {
     154    global $bp_wire_can_post;
     155    return $bp_wire_can_post;
    146156}
    147157
     
    188198
    189199function bp_wire_get_post_form() {
    190     if ( is_user_logged_in() )
     200    global $wire_posts_template;
     201   
     202    if ( is_user_logged_in() && $wire_posts_template->can_post )
    191203        load_template( TEMPLATEPATH . '/wire/post-form.php' );     
    192204}
Note: See TracChangeset for help on using the changeset viewer.