Search Results for 'code'
-
AuthorSearch Results
-
April 15, 2008 at 4:23 am #61280
In reply to: Extending the Private Forums Plugin
Detective
MemberI finally made a custom “private forum” (note the single noun) plugin:
define('FORO_STAFF', 22);
add_filter('get_posts_where', 'ryuuko_staff_where_posts');
function ryuuko_staff_where_posts($where) {
if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
//var_dump($where);
$where .= " AND p.forum_id <> '" . FORO_STAFF . "' ";
}
return $where;
}
add_filter('get_topics_where', 'ryuuko_staff_where_topics');
function ryuuko_staff_where_topics($where) {
if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
$where .= " AND t.forum_id <> '" . FORO_STAFF . "' ";
}
return $where;
}
add_filter('get_forums', 'ryuuko_staff_forums');
function ryuuko_staff_forums($forums) {
if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
$where .= " AND t.forum_id <> '" . FORO_STAFF . "' ";
$forum_key = -1;
foreach ($forums as $key => $forum)
if (intval($forum->forum_id) == FORO_STAFF) {
$forum_key = $key;
break;
}
unset($forums[$key]);
}
return $forums;
}
add_action('bb_forum.php_pre_db', 'ryuuko_forum_redirect');
function ryuuko_forum_redirect($forum_id) {
if (!bb_is_user_logged_in() || !bb_current_user_can('moderate')) {
if ($forum_id == FORO_STAFF) bb_die("No puedes ver esto!");
}
}Maybe it’s useful for someone. The constant FORO STAFF is the id for the private forum. In this case, only users with the ‘moderate’ capability can see the forum.
April 15, 2008 at 3:48 am #64311In reply to: Rewriting?
chrishajer
ParticipantWhat is in http://example.com/ ?
What is in http://example.com/folder/ ?
I know what’s in http://example.com/folder/bbpress/
April 14, 2008 at 2:12 pm #3199Topic: Rewriting?
in forum Installationhaagendazs1
MemberHi everyone,
Currently my forum is located in something like:
example.com/dir/forum/
But I want to rewrite it to be like this:
example.com/forum/
Since WordPress can do that, I was hoping bbPress can too, but I’m not sure how. Is there some setting I can change?
Also secondary to that is that if there is no setting for such an option, can I just move the “forum” directory out of “dir” and into the root, and change the “bbPress address” to force it to physically be like “example.com/forum/” or would that screw things up?
Thanks a lot everyone
April 14, 2008 at 1:40 pm #64309In reply to: how to change install settings
haagendazs1
Membernevermind I just figured it out! it’s in the bb_topicmeta table in the database. thanks everyone!
April 14, 2008 at 5:54 am #3197Topic: Dutch translation
in forum Installationbruinfelix
MemberI’am currently working on a Dutch translation file for bbPress, zo maybe today, otherwise today it will be come available
April 14, 2008 at 2:05 am #64249In reply to: Change Gravatar Size?
citizenkeith
ParticipantThanks Rune. I actually don’t like to hack admin files… Wyvn’s suggestion did the trick. I just made note of the change so I can do it again when I upgrade next.
Maybe you can submit that for a future version of bbPress.
April 14, 2008 at 12:23 am #64203In reply to: Role Integration Problem
skehoe
Membersam is there any way I can edit the role map code to account for this. Changing the prefix could cause a lot of problems.
April 13, 2008 at 11:09 pm #3195Topic: Latest Post in Forum List
in forum Themesberfarah
MemberI want to be able to add the latest post made in a forum section on the front page (and everywhere it lists forums).
If I try to do that, it will just keep repeating the value for the first throughout the list.
It’s on this site, if it makes a difference
Thanks in advance for any help
April 13, 2008 at 11:03 pm #64248In reply to: Change Gravatar Size?
Bloggsbe
MemberWell, if you like to hack you admin files, you can add the following code to the options-general.php file just after line 143, making this code start on line 144;
<label for="avatars_size">
<?php _e('Gravatar Size:'); ?>
</label>
<div>
<select name="avatars_size" id="avatars_size">
<?php
$selected = array();
$selected[bb_get_option('avatars_size')] = ' selected="selected"';
?>
<option value="16"<?php echo $selected[16]; ?>><?php _e('16 px'); ?></option>
<option value="32"<?php echo $selected['32']; ?>><?php _e('32 px'); ?></option>
<option value="36"<?php echo $selected['36']; ?>><?php _e('36 px'); ?></option>
<option value="48"<?php echo $selected['48']; ?>><?php _e('48 px'); ?></option>
<option value="80"<?php echo $selected['80']; ?>><?php _e('80 px'); ?></option>
<?php
unset($selected);
?>
</select>
</div>And in the bb-includes/template-functions.php file, after line 1198 you can add this;
$size = bb_get_option('avatars_size');
Then you can change the size in the admin section, and the correct size will show with the posts.
Or you can download the edited files here
—
Rune
April 13, 2008 at 8:24 pm #62868In reply to: Expanding User Profile Details
Detective
MemberIt is really easy to add profile fields.
First, you need to print the fields you need:
add_action('extra_profile_fields', 'print_extra_fields');
function print_extra_fields($user_ID) {
/* get the current values for that user, and print your form items */
}
add_action('profile_edited', 'process_extra_fields');
function process_extra_fields($user_ID){
/* here, $_POST contains the new field values. so you can do things like bb_update_usermeta($user_ID, 'your_field', $_POST['your_field']); ... */
}Please correct me if i’m wrong. I don’t remember the action names. But this works
I use it in WP and BBP.
April 13, 2008 at 6:58 pm #63027In reply to: where can i grab variables like ‘slugs’ and post url
_ck_
ParticipantI believe you are looking for the functions
bb_get_option
andget_post_link
.April 13, 2008 at 6:53 pm #63116In reply to: Forumula for converting wordpress plugins
_ck_
ParticipantWell some are far easier than others.
First look for $wpdb and change to $bbdb
Then you have look at things like
get_option
and other functions and see if they can easily use thebb_get_option
or otherbb_
version of the function.But even if the alternative function exists you have to be sure that it’s doing what you want. Things that relate to users are similar but things that relate to posts have to be change to topics and then there is comments vs posts.
April 13, 2008 at 6:25 pm #64053In reply to: Only key holders add topics
_ck_
ParticipantAha! I think it’s this simple. Make yourself a mini-plugin and install it containing this:
global $bb_roles;
$bb_roles->remove_cap('member','write_topics');If you don’t know how to make a plugin, it might be possible to just put those two lines into your template’s
header.php
April 13, 2008 at 6:16 pm #64052In reply to: Only key holders add topics
_ck_
ParticipantUnlike WordPress I don’t believe bbPress has an easy way to do role management (yet). There is a privilege built-in for
bb_current_user_can( 'write_topics' )
which means it is technically possible to control who can start topics by taking away that role privilege from the “member” role.In theory a small plugin should be able to do this – I’ll take a look at how it might be done as an exercise in learning more about bbPress roles…
April 13, 2008 at 6:14 pm #64154In reply to: Prblem upgrading
Sam Bauers
ParticipantSorry, that should have been:
$bb->wp_table_prefix = 'wp_';
April 13, 2008 at 5:39 pm #64220In reply to: BBpress Admin for WordPress
_ck_
ParticipantSounds interesting but:
Fatal error: Call to undefined function: bb_option() in wp-content/plugins/bbpress-admin/bbpress-options-admin.php on line 38
Is this for people who has bbPress running INSIDE WordPress, instead of just stand-alone integration?
April 12, 2008 at 11:34 pm #64101In reply to: PRIORITY #1: ImageFile Attachments
woodsnwind
Memberyes, please, file attachment is valuable for my implementation. I’ll take it as a plugin or hardwired.
April 12, 2008 at 11:17 pm #58948In reply to: User-editable Custom Titles
citizenkeith
ParticipantHmm…. not sure to how to change that code without getting errors (I’m running 0.9.0.1 on this particular forum).
function get_profile_info_keys() {
return apply_filters(
'get_profile_info_keys',
array('user_email' => array(1, __('Email')), 'user_url' => array(0, __('Website')), 'from' => array(0, __('Location')), 'occ' => array(0, __('Occupation')), 'interest' => array(0, __('Interests')))
);
}
function get_profile_admin_keys() {
global $bbdb;
return apply_filters(
'get_profile_admin_keys',
array($bbdb->prefix . 'title' => array(0, __('Custom Title')))
);
}April 12, 2008 at 10:02 pm #64247In reply to: Change Gravatar Size?
citizenkeith
ParticipantThanks Wyvn. It would be nice if there was something in the Admin menu to change this, but for now I’ll just change that file.
April 12, 2008 at 7:11 pm #64029In reply to: avatars in wordpress and bbpress
affacat
Memberto better illustrate my issue, my current code for the profile page is:
if ( avatarupload_get_avatar(ID) ) {
avatarupload_display($user->ID);
} else {
echo bb_get_avatar( $user->ID );
}
which means if uploaded avatar exists then display it, else get gravatar.
but what i really want is:
if uploaded avatar exists then display it, else if gravatar exists then display that, but if neither exists then display the avatar upload default avatar.
Right now it displays gravatar default instead. which isn’t my first choice since avatar upload would give me control over the default image which is better for obvious reasons.
April 12, 2008 at 4:38 am #64120feelie75
MemberThis is the code that was making the call and getting the return false returned to it, thus resulting in this error:
if (!$bbdb->db_connect(‘SHOW TABLES;’)) {
$this->step_status[1] = ‘incomplete’;
$this->strings[1][] = __(‘There was a problem connecting to the database you specified.
Please check the settings, then try again.’);return ‘error’;
}
db_connect was returning false when it detected $this->$dbhname was undef. So by removing the return false when that happened, the db_connect call then succeeded and all was happy
.
To answer the other person, I’m hosting on localhost. I have an old PowerPC Mac running OS X 10.4.11 or something. It’s a spare computer; thought I’d stick a forum on it and learn some php.
April 12, 2008 at 12:59 am #64239In reply to: WPMU with BBpress on Subdomain
arlene476
MemberThere is an answer here, https://bbpress.org/forums/topic/require_oncepathtowp-blog-headerphp
Saying:
Put in the full path from the server root instead of the relative path.
But I don’t know how to code it and what line to place it
April 11, 2008 at 9:54 pm #64212In reply to: using bb_users with integrated setup
precious-forever
Memberthis order: WP 2.3, bbpress 0.8 (no integration with plugins at that time!), WP 2.5, bbpress 0.9
I patently waited with integration until 0.9 was out since I did not understand the whole thing before. And everything seems to work fine. Just as soon as I add the WP_ prefix setting to my bbpress config, it seems as if bbpress can only access the WP users anymore (with the correct role mapping i set up etc.).
maybe I should just ask all registered users to reregister after integration, since the forum is pretty new anyway
April 11, 2008 at 7:23 pm #63631chrishajer
ParticipantSorry, I forgot I was talking about tags.php specifically. Here’s a tags URL.
http://www.riversideinfo.org/forum/tags.php?tag%3Dtif
is what’s in the sitemap.
curl -I "http://www.riversideinfo.org/forum/tags.php?tag%3Dtif"
returns a 302 header.
If you unencode it, and then curl -I:
curl -I "http://www.riversideinfo.org/forum/tags.php?tag=tif"
returns a 200 header.
Maybe it’s just the urlencoding of the = that causes it to redirect? That’s the only difference between the two URLs here.
April 11, 2008 at 7:18 pm #63630chrishajer
ParticipantHere’s an example of a URL in the sitemap.
http://www.riversideinfo.org/forum/topic.php?id%3D3%26page%26replies%3D1
If you do a
curl -I http://www.riversideinfo.org/forum/topic.php?id%3D3%26page%26replies%3D1
you get a 302 header back. If you URL unencode the URL and do a curl -I, you get back a proper 200:curl -I "http://www.riversideinfo.org/forum/topic.php?id=3&page&replies=1"
I am not using permalinks or slugs, and that plugin author doesn’t seem to have updated it since I installed it long ago. I actually turned it off a while ago because of the amount of time it was taking to generate the sitemap for 5000 posts.
http://boakes.org/talk/topic/31
So, I guess the question is, why does that first URL trigger a 302? Maybe the sitemap plugin is creating URLs that are poorly formed?
-
AuthorSearch Results