Search Results for 'code'
-
AuthorSearch Results
-
February 23, 2015 at 5:38 pm #158806
Robkk
Moderatorthat plugin probably still works its just not maintained by the developer anymore
its still here for anyone to fork though https://github.com/mravaioli/wp-modal-login
there are also many alternatives for a modal popup form
this plugin assigns menu items without additional code plus it has a facebook login option
https://wordpress.org/plugins/zm-ajax-login-register/
there is also others with captcha support
wordpress.org/plugins/ajax-bootmodal-login/
and also a very simple one but would need to activate the CSS class option in the menu settings
wordpress.org/plugins/simplemodal-login/installation/
there is also cool tutorial for developers that could probably just hook up the bbPress shortcodes
http://www.blueleafstudio.net/create-responsive-pop-login-box-wordpress/
February 23, 2015 at 5:16 pm #158805Topic: Display categories on all pages
in forum Troubleshootingryplittle
ParticipantI am new to bbPress development and have been searching for how to do this for a while now, so I figured I’d ask here.
I am wanting to display a loop of all of the forum categories on every page of the forum (as a type of navigation). I am able to display it in the forum root, but when it goes into a category, the loop becomes the forums rather than the categories.
In loop-forums.php, for example, I have the following code:
<?php do_action( 'bbp_template_before_forums_loop' ); ?> <ul id="forum-subhead-nav"> <?php while ( bbp_forums() ) : bbp_the_forum(); if (bbp_is_forum_category()) { ?> <li> <a class="bbp-forum-title button-link" href="<?php bbp_forum_permalink(); ?>"><?php bbp_forum_title(); ?></a> </li> <?php } ?> <?php endwhile; ?> </ul>I was wondering if someone can help me out so it loops all of the forum categories, and that doesn’t change depending on the forum.
Thanks
February 23, 2015 at 2:23 pm #158797In reply to: Post submission hooks
Robkk
Moderatori tested it out on your site and see its working better
its not really a honeypot field though
how a honeypot field is supposed to be is invisible to the users on your site and is not required for input for the user.
its a hidden input field that if it has any type of dummy information from spam-bots injected , it should stop the next action that the spammer is trying to do.
the way your code is arranged its close to these two plugins
https://wordpress.org/plugins/growmap-anti-spambot-plugin/ ( probably no bbpress compatibility)
https://github.com/studiohyperset/bpress-no-captcha-recaptcha ( still in development)you might want to go to the bbpress nocatpcha plugin (when its done being developed) if you think it works better for what you need.
since you/robin found half the code im going to try to make a honeypot using these two plugins for the other half
wordpress.org/plugins/registration-honeypot/
wordpress.org/plugins/zero-spam/ (i dont know about bbpress compatibility yet)also @s1r0n what do you mean by custom meta tags, like explain exactly how you want it so i can see if a normal seo plugin cant do this already.
February 23, 2015 at 12:43 pm #158794In reply to: Create a forum of type link
Robkk
Moderatorso like post formats but for bbPress post types??
https://codex.wordpress.org/Post_Formats
there is a function below in the post to implement it , but i think it will only show in the back-end of wordpress and is not implemented in the front-end just yet
February 23, 2015 at 9:16 am #158792In reply to: Post submission hooks
s1r0n
ParticipantAh you’ll have to do that again. the code above has a line commented out that shouldn’t be. sorry for the hassle
add_action('bbp_theme_after_topic_form_content','lp_add_honeypot'); add_action('bbp_theme_after_reply_form_content','lp_add_honeypot'); function lp_add_honeypot() { if (is_user_logged_in()) return; ?> <p> <label for="lp_post_honey_pot">I am a robot (yes/no)</label><br /> <input type="text" value="" tabindex="103" size="40" name="lp_post_honey_pot" id="lp_post_honey_pot" /> </p> <?php } //https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/post.php#L0 add_filter('wp_insert_post_empty_content', 'lp_check_honeypot', 10, 2); function lp_check_honeypot($is_empty, $postarr) { if (is_user_logged_in()) return false; if ($postarr['post_type'] == 'topic' || $postarr['post_type'] == 'reply') {//only do this for bbspress if ($postarr['bbp_post_as_submitted']['POST_lp_post_honey_pot'] == 'no') { return false; //treat this post as good } return true; } return false; }I only need this to work for users who are not logged in, guests, so i’ve added a couple of lines to turn this off when users are logged in. if you want to test even registered users just leave those lines in.
When I have a bit of time I’ll look into bbpress errors and find a way to set an appropriate error message.
Have fun and let us know if you use it and it works for you or not
February 23, 2015 at 8:58 am #158790In reply to: One automatic private Forum per User
Robin W
ModeratorI would start with
https://wordpress.org/plugins/bbp-private-groups/
this will give you private forums per group, so you can have a user allocated to a group, and a forum allocated to a group. so you would just have a different group for each user, and just one forum allocated to that group.
Then on registration, you would need to
create a forum
create a private group – probably using the $user_id, so that it is unique
Allocate the private group to the forum
Allocate the private group to the useryou’d use an add_action to user_register to do the above, the example below comes from
https://codex.wordpress.org/Customizing_the_Registration_Form, but you can in effect get wordpress to do anything when the user hits the submit key
//3. Finally, save our extra registration user meta. add_action( 'user_register', 'myplugin_user_register' ); function myplugin_user_register( $user_id ) { if ( ! empty( $_POST['first_name'] ) ) { update_user_meta( $user_id, 'first_name', trim( $_POST['first_name'] ) ); } }so you would need to look at putting code into that function :
create forum – what’s updated in the database when you create a forum – start with bbpress\includes\forums\functions.php and look at what function bbp_new_forum does, you’ll probably need to write a version for the above function.create a private group (for that one see the private groups plugin includes/settings.php and look at the group settings – and for info $rpg_groups = get_option ( ‘rpg_groups’) 😉
allocate private group to forum – (for that one see the private groups plugin includes/meta-box.php and look at $meta = get_post_meta( $post->ID, ‘_private_group’, false );
allocate the user to the group – see includes/user-view_post.php it’s looked up using $check=get_user_meta( $user_id, ‘private_group’,true);Since I’ve now written so much, I am expecting in the spirit of community software, you to share the solution when you get it going, and post the result back here !
February 23, 2015 at 4:01 am #158777In reply to: Post submission hooks
Robin W
Moderatorgreat – thanks for posting back – edited and removed the wrong version code above – some people never read all the way through !
Thanks again
February 22, 2015 at 7:00 pm #158771In reply to: Post submission hooks
s1r0n
Participantoops. had a mistake in code. this one works better
add_action('bbp_theme_after_topic_form_content','lp_add_honeypot'); add_action('bbp_theme_after_reply_form_content','lp_add_honeypot'); function lp_add_honeypot() { if (is_user_logged_in()) return; ?> <p> <label for="lp_post_honey_pot">I am a robot (yes/no)</label><br /> <input type="text" value="" tabindex="103" size="40" name="lp_post_honey_pot" id="lp_post_honey_pot" /> </p> <?php } //https://core.trac.wordpress.org/browser/tags/4.1.1/src/wp-includes/post.php#L0 //add_filter('wp_insert_post_empty_content', 'lp_check_honeypot', 10, 2); function lp_check_honeypot($is_empty, $postarr) { // print_r($postarr);exit; if ($postarr['post_type'] == 'topic' || $postarr['post_type'] == 'reply') {//only do this for bbspress if ($postarr['bbp_post_as_submitted']['POST_lp_post_honey_pot'] == 'no') { return false; //treat this post as good } return true; } return false; }February 22, 2015 at 6:00 pm #158769In reply to: Post submission hooks
s1r0n
ParticipantYa ok i got something figured out. its very basic but you can easily add to this. here’s the code
This basically ads a field call ‘lp_post_honey_post’ with the question “I am a robot”. if the user answers anything other than ‘no’ the post craps out with an error. currently the error message is that the post parameters are wrong, but maybe if somebody can tell me how to set the bbpress error message I can fix that.
You can see the filter in action here
http://www.thelightningpath.com/forums/room/lobby/pre-registration/
There are a few tweaks you could make to this. if you have a plugin like piklist you can easily have a settings page where you could set both the question and the answer. And of course you can change the question in the hard code.
I choose the wp_insert_post_empty_content filter because it fires early on in the wp_update_post routine, saving some CPU cycles.
If somebody wants to help me set this up as a wordpress plugin we could make this a plugin pretty easily. I’m guessing there would be a lot of interest in this.
incorrect code removed ! - correct version belowFebruary 22, 2015 at 4:38 pm #158762In reply to: Post submission hooks
s1r0n
Participantok that’s a start. where can I find the hooks to deal with the post content just before it gets posted into the database. so somebody hits the submit button and I can intercept that submission with what action/filter.
I tried searching the bbs code, but faster if somebody can just say
February 22, 2015 at 4:35 pm #158761In reply to: "bbPress ready theme" means what?
Robkk
Moderatorideas for plugin exploration
there is a plugin section on this site, it basically pulls information from the wordpress.org plugin section on any plugin tagged “bbpress”
i’d say search the plugins section
search the forums on this site so you would find some developed plugins that are not yet on wordpress.org
check some in the list here https://codex.bbpress.org/feature-plugins-tracking/
on gist.github.com/ there are a few snippets in plugin format , especially netweb’s gists https://gist.github.com/ntwb
there are also paid plugins on sites like codecanyon
and there is always google.com
February 22, 2015 at 4:21 pm #158759Robkk
Moderatorsee if this custom CSS can help
.widget_display_topics .avatar { float:none; }February 22, 2015 at 2:23 pm #158754In reply to: Profile page
Robkk
Moderatortry this CSS
.bbpress .vcard .avatar { position: relative; left: auto; top: auto; }February 22, 2015 at 9:46 am #158747Sudar Muthu
ParticipantIs
wp_mailgetting called at least?jeroenkosterr
ParticipantAlready figured it out!
Here is the code i used:
<?php $current_user = wp_get_current_user(); global $current_user; get_currentuserinfo(); if ( is_user_logged_in() ) { echo '<b>Welcome,</b> ' . $current_user->user_login . ''; echo ' '; echo get_avatar( $current_user->ID, 20 ); } else { echo '<b>Welcome,</b> Guest! <a href="http://hardstyle-united.nl/register/">Register</a> or '; } ?> <?php wp_loginout(); ?>February 22, 2015 at 8:53 am #158745In reply to: Rating and Sorting plugin.
Robin W
Moderatorgreat -besy way to learn, I knew nothing of bbpress two years ago !
Come back if you get stuck, and if I can help with quick pointers I will.
In the spirit of community, it would also be great if you shard the solution if you get there, this is occasionally asked for, and I’ll add it to the codex.
key bit is on the topics widget for most recent replies, which you would copy and use
// Order by most recent replies
case ‘freshness’ :
$topics_query = array(
‘post_type’ => bbp_get_topic_post_type(),
‘post_parent’ => $settings[‘parent_forum’],
‘posts_per_page’ => (int) $settings[‘max_shown’],
‘post_status’ => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ),
‘ignore_sticky_posts’ => true,
‘no_found_rows’ => true,
‘meta_key’ => ‘_bbp_last_active_time’,
‘orderby’ => ‘meta_value’,
‘order’ => ‘DESC’,
);
break;that’s where the meta key bit is, so if your plugin stores as ‘_rating’, then that’s what would go in the meta_key line.
jeroenkosterr
ParticipantI am not searching for a plugin actually. Need the php code to show these options.
Maybe its a wordpress thing or maybe its a BBpress thing or maybe both.February 22, 2015 at 4:44 am #158736In reply to: Rating and Sorting plugin.
Robin W
ModeratorMost replied to is already in the topics widget (as most popular), so it would be nicking that query code.
It would not be tons of code to do a rating, as long as the rating system stores the score in post_meta, then a simple query with that meta would do it.
Just that I haven’t got time to code it at the moment.
suggest you
a) look at bbpress rating plugins
b) check that they store scores in post_meta
c) either code yourself (see bbpress/includes/common/widgets) for the widget code,
d) or pay someone to do it http://jobs.wordpress.net/February 21, 2015 at 6:12 pm #158728Topic: Forum Import Tool
in forum Troubleshootingbazaarocommunity
ParticipantI’ve been struggling for a while now to get the forum import tool to run efficiently. I notice that for some forums, the mysql query code is supplied, but for others it is not. It seems that the process would run a lot faster if I performed the entire operation in mysql instead of using the import tool. I have ~2M posts I need to import. Does anyone have the MYSQL queries for converting Xenforo to BbPress?
Thanks!
February 21, 2015 at 12:29 am #158702In reply to: WP 4.1.1 Forum not logging in
jtstables
ParticipantOK, working on it.
Two weeks ago you helped me with an issue under the topic, “Stop users from making topics”.
You had me to change the following code:
<?php
/**
* Single Forum Content Part
*
* @package bbPress
* @subpackage Theme
*/?>
<div id=”bbpress-forums”>
<?php bbp_breadcrumb(); ?>
<?php bbp_forum_subscription_link(); ?>
<?php do_action( ‘bbp_template_before_single_forum’ ); ?>
<?php if ( post_password_required() ) : ?>
<?php bbp_get_template_part( ‘form’, ‘protected’ ); ?>
<?php else : ?>
<?php bbp_single_forum_description(); ?>
<?php if ( bbp_has_forums() ) : ?>
<?php bbp_get_template_part( ‘loop’, ‘forums’ ); ?>
<?php endif; ?>
<?php if ( !bbp_is_forum_category() && bbp_has_topics() ) : ?>
<?php bbp_get_template_part( ‘pagination’, ‘topics’ ); ?>
<?php bbp_get_template_part( ‘loop’, ‘topics’ ); ?>
<?php bbp_get_template_part( ‘pagination’, ‘topics’ ); ?>
<?php elseif ( !bbp_is_forum_category() ) : ?>
<?php bbp_get_template_part( ‘feedback’, ‘no-topics’ ); ?>
<?php endif; ?>
<?php endif; ?>
<?php do_action( ‘bbp_template_after_single_forum’ ); ?>
</div>
Could this have caused the problem when they upgraded WP? LIke I said the forum worked great until the upgrade.
Thanks
February 20, 2015 at 7:29 pm #158695In reply to: how to see forums ?
February 20, 2015 at 7:26 pm #158693In reply to: Multiple create topic forms
Robin W
Moderatorwhy not just have one form, referenced by a button at the top.
function bsp_create_new_topica () { $text='Create New Topic' ; if ( bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_category() ) echo '<div style="text-align: center;"> <a href ="#topic">'.$text.'</div>' ; } function bsp_create_new_topicb () { echo '<a name="topic"></a>' ; } add_action ( 'bbp_template_before_single_forum', 'bsp_create_new_topica' ) ; add_action( 'bbp_theme_before_topic_form', 'bsp_create_new_topicb' ) ;(not tested as its cut down code from one of my plugins)
adds a link which lets you add a link to the top of the page which sends you to the bottom, which you can easily make a button.
add to your functions file https://codex.bbpress.org/functions-files-and-child-themes-explained/
or take the guts into the template you’re amending.
You could probably send it to a collapsing div at the bottom if you tinker
That way you only have one form
February 20, 2015 at 7:08 pm #158690In reply to: Paginate recent topcis page
Robin W
Moderatormy shortcode
[bsp-display-topic-index show=’100′]
in
https://wordpress.org/plugins/bbp-style-pack/
will let you change the number displayed, but only one page I’m afraid !
February 20, 2015 at 6:37 pm #158688In reply to: Show latest reply author name
Robin W
Moderatorok, I’ve just finished coding a ‘latest activity’ widget that should do what you want.
I’ve added it to my bbp-style-pack
https://wordpress.org/plugins/bbp-style-pack/
which you can load to the site and just use (there’s lots of other stuff in there), or if you’re code savvy, you can fork it form includes/widgets.php into your functions file
Hope you enjoy it !
February 20, 2015 at 5:33 pm #158685WilRC
ParticipantI ran into this code:`
<?php
function fix_pagination($args) {
global $wp_query,$bbp;
$max_pages = $bbp->topic_query->max_num_pages;
$page = $bbp->topic_query->paged;
$mybase = get_permalink($wp_query->post->ID);
$args = array (
‘base’ => $mybase.$wp_rewrite->pagination_base.’/%#%/’,
‘format’ => ”,
‘total’ => $max_pages,
‘current’ => $page,
‘prev_text’ => ‘←’,
‘next_text’ => ‘→’,
‘mid_size’ => 1
);
return $args;
}
add_filter(‘bbp_topic_pagination’,’fix_pagination’); ?>`
No luck, pagination dissapeard with this code. -
AuthorSearch Results