Changeset 1112

Show
Ignore:
Timestamp:
05/21/08 19:27:26 (6 months ago)
Author:
so1o
Message:

add options to set anonymous user text

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • bb-anonymous-posting/trunk/bb-anonymous-posting.php

    r1109 r1112  
    55Description: Allows anonymous users to add posts and topics 
    66Author: Aditya Naik 
    7 Version: 2.2 
     7Version: 2.3 
    88Author URI: http://www.adityanaik.com/ 
    99*/ 
     
    130130 
    131131// this fixes the display names for topic last poster or topic author 
    132 add_filter('topic_last_poster','bb_anon_filter_poster',10,2); 
    133 add_filter('get_topic_author','bb_anon_filter_poster',10,2); 
    134 function bb_anon_filter_poster($last_poster, $poster_id) { 
    135         if ($poster_id == bb_get_option('bb_anon_user_id')) 
    136                 return __('Anonymous'); 
     132add_filter('topic_last_poster','bb_anon_filter_poster'); 
     133add_filter('get_topic_author','bb_anon_filter_poster'); 
     134add_filter('post_author', 'bb_anon_filter_poster'); 
     135function bb_anon_filter_poster($last_poster) { 
     136        if ($last_poster == 'Anonymous' || $last_poster == 'anonymous') 
     137                return bb_anon_get_user_text(); 
    137138        else 
    138139                return $last_poster; 
     140} 
     141 
     142function bb_anon_get_user_text() { 
     143        return ($user_text = bb_get_option('bb_anon_user_text')) ? $user_text : "Anonymous"; 
    139144} 
    140145 
     
    164169                                <p>By default if the plugin is enabled the users can create new posts. Selecting yes above will let users create new topics also.</p> 
    165170                        </div> 
     171                <label for="bb_anon_user_text"> 
     172                                Name for the 'Anonymous' users  
     173                        </label> 
     174                        <div> 
     175                                <input type="text" value="<? echo bb_anon_get_user_text(); ?>" name="bb_anon_user_text" id="bb_anon_user_text" /> 
     176                                <p>This will be the text show as the name of the poster or author</p> 
     177                        </div> 
    166178                <p class="submit"> 
    167179                  <input type="submit" name="bb_anon_submit_options" value="Update Options" /> 
     
    186198                } 
    187199 
     200                bb_update_option('bb_anon_user_text',$_POST['bb_anon_user_text']); 
     201 
    188202                $goback = add_query_arg('bb-anon-options-updated', 'true', wp_get_referer()); 
    189203                bb_safe_redirect($goback);