Search Results for 'code'
-
AuthorSearch Results
-
August 12, 2015 at 11:08 pm #165331
In reply to: Getting only one comment
Robkk
Moderatorthe
bbpress.phptemplate looks fine to me.There might be other custom functions for bbPress somewhere though? or cache?
Try some troubleshooting. See if it is a plugin issue, issue is only present in your custom theme, and maybe run the repair tools to recalculate.
August 12, 2015 at 10:10 pm #165329In reply to: Limit tags to a pre-defined list?
23creative
Participantits been a while and im not 100% sure this will work (in terms of sanitation checks) but if you change
$html[] = '<select class="chzn-select" multiple="multiple" name="bbp_topic_tags[]" id="bbp_topic_tags">'; foreach($tags as $tag){ $selected = ''; if (in_array($tag->name, $selectedTagsArray)) { $selected = 'selected="selected"'; } $html[] = '<option '.$selected.' value="'.$tag->name.'">'.$tag->name.'</option>'; } $html[] = '</select>';to
foreach($tags as $tag){ $selected = ''; if (in_array($tag->name, $selectedTagsArray)) { $selected = 'checked="selected"'; } $html[] = '<input '.$selected.' type="checkbox" name="bbp_topic_tags" value="'.$tag->name.'">'.$tag->name; }i haven’t tested it but it should get you close
August 12, 2015 at 9:41 pm #165326In reply to: List subscribers of a forum
Robkk
Moderator@casiepa Thanks for creating a plugin to solve this problem for users. It is greatly appreciated. I have a few questions though.
How do I use it??
The setting are confusing me a little bit, and it doesn’t seem to show the subscriptions, but I do not really know where to manage them in the plugin. I just see a list of users with a button that says `[has role]’. I also do not think your plugin works for sub-forums/child forums of categories.
How does it work exactly??
I try to set it up, but I am still confused. Also there are a few errors while activating it with debug set to true in my wp-config.php file.
define('WP_DEBUG', true);August 12, 2015 at 7:40 pm #165322August 12, 2015 at 6:09 pm #165320Leng7881
ParticipantLog’s who knew? From further examination due to the log telling me to look I found that I have a gh_ in front of the function name when declaring it. There error is also in your updated code above. Now that I took that out it works great. Here is the code without the minor syntax error and thank you for this.
function post_published_create_topic( $ID, $post ) { $checkduplicate = get_post_meta( $ID, 'gh_topic_created',true); if ( empty( $checkduplicate ) ) { $author = $post->post_author; $name = get_the_author_meta( 'display_name', $author ); $title = $post->post_title; $permalink = get_permalink( $ID ); $excerpt = $post->post_excerpt; $subject = sprintf( '%s: %s', $name, $title ); $message = sprintf ('[b]%s[/b]' . "\n" . 'By %s' . "\n\n" . '[i]%s[/i]' . "\n\n" . 'View: %s' . "\n\n", $title, $name, $excerpt, $permalink ); $tags = wp_get_post_tags( $ID, array( 'fields' => 'names' ) ); $new_post = array( 'post_title' => $subject, 'post_content' => $message, 'post_parent' => 72, 'post_status' => 'publish', 'post_type' => 'topic' ); $topic_meta = array( 'forum_id' => $new_post['post_parent'] ); $topic_id = bbp_insert_topic($new_post, $topic_meta); if ( !empty( $topic_id ) ) { add_post_meta($ID, 'gh_topic_created', 'true', true); $term_taxonomy_ids = wp_set_object_terms( $topic_id, $tags, 'topic-tag' ); bbp_update_forum(array('forum_id' => 72)); } } } add_action( 'publish_post', 'post_published_create_topic', 10, 2 );August 12, 2015 at 5:13 pm #165318In reply to: bbPress URL Rewrite shenanigans
Jake Hall
ParticipantAs I expected, was something to do with the rewrite rules. Was a very simple fix, I simply started messing with the rewrite until it worked. This is how mine works flawlessly should anyone have the same issur and somehow stumble across this thread.
Note: This is for lighttpd. This is not an Apache or Nginx solution.
# This is mainly a fix for bbPress and its functions url.rewrite = ( "^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0", "^/(.*)\.(.+)$" => "$0", "^/(.+)/?$" => "/index.php/$1" ) }All I did here was remove the additional forward slash within each rule.
Now my links work perfectly!
August 12, 2015 at 1:44 pm #165316Topic: Get next and previous page in wp_header
in forum TroubleshootingMartin Babinec
ParticipantI’d like to add
<link rel="prev" href=".." />and<link rel="next" href=".." />tags into<head>of bbpress forum page. So I need to get links for the next and previous pages of my forum. It has to be outputed inwp_headaction but in that time the bbPress class is not initialized yet, so I cannot get any information from that. Can you help me?August 12, 2015 at 10:56 am #165314ghoush
ParticipantAre you getting any error messages in your error logs? This code, unmodified, is working fine for me on 4.2.4.
August 11, 2015 at 10:11 pm #165304In reply to: Can’t modify a post forum (users nor admin)
Robkk
ModeratorI tried the theme and plugins with bbPress and I didn’t come across any issues.
I am kind of thinking it could be the index.php in your url causing the issue, but I am not really sure.
https://codex.wordpress.org/Using_Permalinks#PATHINFO:_.22Almost_Pretty.22
Since I am not 100% sure, you can try some troubleshooting to see if you can find the solution to your problem.
August 11, 2015 at 9:25 pm #165302Leng7881
ParticipantI got the id from the Reveal ID’s thank you for that. I am trying to get this to work on my website which currently is on a localhost so can’t send you to it. I have put the code in the functions and changed the number to 72 (my forum id), however, when I post it does not create a new topic in that forum. I have been poking around trying to get it to work and have found that some places say the publish_post is deprecated and others that say to ignore that it still works. I’m currently using wordpress version 4.2.4 and here is the code I put in my functions.
function gh_post_published_create_topic( $ID, $post ) { $checkduplicate = get_post_meta( $ID, 'gh_topic_created',true); if ( empty( $checkduplicate ) ) { $author = $post->post_author; $name = get_the_author_meta( 'display_name', $author ); $title = $post->post_title; $permalink = get_permalink( $ID ); $excerpt = $post->post_excerpt; $subject = sprintf( '%s: %s', $name, $title ); $message = sprintf ('[b]%s[/b]' . "\n" . 'By %s' . "\n\n" . '[i]%s[/i]' . "\n\n" . 'View: %s' . "\n\n", $title, $name, $excerpt, $permalink ); $tags = wp_get_post_tags( $ID, array( 'fields' => 'names' ) ); $new_post = array( 'post_title' => $subject, 'post_content' => $message, 'post_parent' => 72, 'post_status' => 'publish', 'post_type' => 'topic' ); $topic_meta = array( 'forum_id' => $new_post['post_parent'] ); $topic_id = bbp_insert_topic($new_post, $topic_meta); if ( !empty( $topic_id ) ) { add_post_meta($ID, 'gh_topic_created', 'true', true); $term_taxonomy_ids = wp_set_object_terms( $topic_id, $tags, 'topic-tag' ); bbp_update_forum(array('forum_id' => 72)); } } } add_action( 'publish_post', 'post_published_create_topic', 10, 2 );Any help on why this wouldn’t work for me would me much appreciated.
August 11, 2015 at 7:16 pm #165298In reply to: Change font size
Robkk
ModeratorThis is the default font-size in the bbPress stylesheet. You can overwrite the statment or install a plugin like bbp style pack which I think would take care of this for you.
#bbpress-forums { background: 0 0; clear: both; margin-bottom: 20px; overflow: hidden; font-size: 12px; }August 11, 2015 at 6:35 pm #165297In reply to: Inserting Forum Element on Front Page
Robkk
ModeratorAugust 11, 2015 at 6:21 pm #165295In reply to: Alternative to “You must be logged in…”
Robkk
ModeratorYou can copy the
form-topic.phpinto your theme/child theme into a folder called bbpress to customize the file used on your site.You can scroll all the way to the bottom of the file, and replace the current message
<div id="no-topic-<?php bbp_topic_id(); ?>" class="bbp-no-topic"> <div class="bbp-template-notice"> <p>You must be <a href="<?php echo site_url('/wp-login.php') ?>">logged in</a> or <a href="<?php echo site_url('/wp-login.php?action=register') ?>">registered</a> to create new topics.</p> </div> </div>August 11, 2015 at 5:53 pm #165293In reply to: Showing Profile Information
Robkk
ModeratorIn BBpress each user has the ability to edit their profile users/USER/edit/
Here they can add their name, their website link and their bio by default. However, this information is never actually displayed on their profile. Why is this?The bio should show.
https://bbpress.org/forums/profile/robkk/
As for most of the other fields, not sure really. I know though they are just going off of WordPress’s profile fields, and whatever is added to that though. I don’t know why the devs haven’t put at least website there. Maybe it is easy for spammers to take advantage of that?? First Name and Last Name could make good choices to display on the users profile too.
I will probably make a suggestion to the devs later to add more profile data to the user’s profile.
You can of course display the data in the profile by editing a template or installing a plugin.
Copy
user-profile.phpfrom the bbPress templates in the plugin to your child theme in a folder called bbpress.Just surround the code with conditionals to only display the information when the user has inputted any information.
You have something like this for first name.
<?php if ( bbp_get_displayed_user_field( 'first_name' ) ) : ?> <p class="bbp-user-fname"><?php bbp_displayed_user_field( 'first_name' ); ?></p> <?php endif; ?>YOu can also use the plugin, to display the current fields and also custom fields.
August 11, 2015 at 3:38 pm #165290In reply to: Merge Topics Problem
Robkk
ModeratorTry some troubleshooting especially what is listed for plugins. Deactivate every plugin except bbPress to see if the topics can merge correctly. Activate BuddyPress right after to see if topics merge correctly in groups and normal forums. Next, activate every other plugin one at a time to see what could be causing an issue.
If you still cannot merge topics with only bbPress activated, try the other possible solutions listed like trying a default theme to see if that fixes your issue.
August 11, 2015 at 6:00 am #165280In reply to: bbp_setup_current_user was called incorrectly
Stephen Edgar
KeymasterFor others bumping into this topic, the codex article is here:
August 10, 2015 at 5:26 pm #165270In reply to: bbp_setup_current_user was called incorrectly
mdw
ParticipantI just found the codex article, I will search for what plugin is causing it
August 10, 2015 at 2:45 pm #165264Topic: Getting only one comment
in forum Troubleshootingimemine
ParticipantI am on the latest version of WordPress, but a custom theme ( developer left it half way) so I am fixing it myself.
1) The forum page shows for post the correct numbers. Example
post tite: Voices(5), Posts (6)but inside posts it says
This topic contains 5 replies, has 5 voices
Viewing 1 post (of 1 total)
Then it shows just the main topic, not the replies to it.This is the code for the bbpress.php template
<?php get_header(); ?> <div id="page-left" class="container"> <?php the_content(); ?> </div> <div id="page-right"> <?php get_sidebar(); ?> </div> <?php get_footer(); ?>Seems fine to me, what do you think I missed?
August 10, 2015 at 2:26 pm #165263In reply to: Notice Message and other staff
Robkk
ModeratorRead this, it is a common error usually not associated with bbPress, but other plugins.
August 10, 2015 at 5:13 am #165253In reply to: Limit tags to a pre-defined list?
strategeek
ParticipantIs it possible to change the multiple select form into to separate checkboxes?
I think this line (that was added in fuctions.php) should be rewritten:
$html[] = '<select class="chzn-select" multiple="multiple" name="bbp_topic_tags[]" id="bbp_topic_tags">';August 10, 2015 at 12:48 am #165245In reply to: bbPress URL Rewrite shenanigans
Robkk
ModeratorI could really only find posts that were talking about bbPress v1 standalone. I did find a post that was in 2012, which I think the bbPress plugin was around then. You can study the code and see if it would work.
The page is in another language though.
August 9, 2015 at 1:19 pm #165237In reply to: Re-arrange display of replies data
Robkk
ModeratorYou might have removed/there isn’t a certain piece of code that renders the classes for each topic/reply.
You might be missing this in
loop-single-reply.phpin your custom templates that you placed in your child theme.<?php bbp_reply_class(); ?>Maybe this for topics too in
loop-single-topic.php<?php bbp_topic_class(); ?>August 9, 2015 at 11:50 am #165228In reply to: Re-arrange display of replies data
Robkk
ModeratorCustomize this CSS from bbPress.
#bbpress-forums div.even, #bbpress-forums ul.even { background-color: #fff; } #bbpress-forums div.odd, #bbpress-forums ul.odd { background-color: #fbfbfb; }August 9, 2015 at 11:29 am #165224In reply to: Content is on a wrong position
Robkk
ModeratorI think this custom CSS on your site is causing the issue. Try to find an alternative to what you are trying to do before.
#bbpress-forums .bbp-body div.bbp-reply-content { clear: both; margin: 10px; padding: 0; }August 9, 2015 at 11:22 am #165223In reply to: Auto delete replies after x days/months
Robkk
ModeratorIn this plugin though, it deletes replies by the set hours in the settings. You can edit the code to change the post_status to “publish” instead of “spam”. This might be resource intensive depending on how many replies you have currently on your forums.
Take what I said earlier with a grain of salt, as I don’t really recommend it. Like I said, if you want hire a developer to fix any nooks and crannies that might come up doing this.
-
AuthorSearch Results