Changeset 5 for trunk/bb-includes/template-functions.php
- Timestamp:
- 12/27/2004 11:22:22 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/bb-includes/template-functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/template-functions.php
r3 r5 12 12 13 13 function login_form() { 14 return; 14 global $current_user; 15 if ($current_user) { 16 echo "Welcome, $current_user->username! <a href='/user/$current_user->user_id'>View your profile »</a> 17 <small>(<a href='" . get_option('uri') . "bb-login.php?logout'>Logout</a>)</small>"; 18 } else { 19 require( ABSPATH . '/bb-templates/login-form.php'); 20 } 21 } 22 23 function post_form() { 24 global $current_user; 25 if ($current_user) { 26 require( ABSPATH . '/bb-templates/post-form.php'); 27 } else { 28 echo "<p>You must login to post."; 29 require( ABSPATH . '/bb-templates/login-form.php'); 30 } 15 31 } 16 32 … … 69 85 echo apply_filters('forum_name', get_forum_name() ); 70 86 } 71 87 function get_forum_id() { 88 global $forum; 89 return $forum->forum_id; 90 } 91 function forum_id() { 92 echo apply_filters('forum_id', get_forum_id() ); 93 } 72 94 function get_forum_name() { 73 95 global $forum; … … 107 129 108 130 // TOPICS 131 function get_topic_id() { 132 global $topic; 133 return $topic->topic_id; 134 } 135 136 function topic_id() { 137 echo apply_filters('topic_id', get_topic_id() ); 138 } 139 109 140 function topic_link() { 141 echo apply_filters('topic_link', get_topic_link() ); 142 } 143 144 function get_topic_link() { 110 145 global $topic, $bb; 111 if ( $bb->mod_rewrite ) 112 $link = $bb->path . $topic->topic_id; 113 else 114 $link = $bb->path . "topic.php?id=$topic->topic_id"; 115 116 echo apply_filters('topic_link', $link); 146 147 if ( get_option('mod_rewrite') ) 148 $link = get_option('path') . $topic->topic_id; 149 else 150 $link = get_option('path') . "topic.php?id=$topic->topic_id"; 151 152 return apply_filters('get_topic_link', $link); 117 153 } 118 154 … … 170 206 171 207 function get_post_author() { 172 global $post; 173 return apply_filters('post_author', $post->poster_name); 208 global $bbdb, $user_cache; 209 $id = get_post_author_id(); 210 if ( $id ) : 211 if ( isset( $user_cache[$id] ) ) { 212 return $user_cache[$id]->username; 213 } else { 214 $user_cache[$id] = $bbdb->get_row("SELECT * FROM $bbdb->users WHERE user_id = $id"); 215 return $user_cache[$id]->username; 216 } 217 else : 218 return 'Anonymous'; 219 endif; 174 220 } 175 221
Note: See TracChangeset
for help on using the changeset viewer.