Search Results for 'code'
-
AuthorSearch Results
-
October 13, 2015 at 11:13 am #167759
In reply to: BBPress Front-End Add Forum
Robkk
ModeratorThere is a shortcode you can put in a page to allow users to create forums.
[bbp-forum-form]You can also use this PHP code snippet, and place it in your child themes functions.php file or in a functionality plugin to allow admins/keymasters to create a forum right from their bbPress forum profile.
function ntwb_bbp_forum_form() { if ( bbp_is_user_home() && current_user_can( 'edit_others_forums' ) ) { echo do_shortcode( '[bbp-forum-form]' ); } } add_action( 'bbp_template_after_user_profile', 'ntwb_bbp_forum_form' );To delete and edit you have to do it in the backend for now. There are plans to add more frontend moderation tools though.
October 13, 2015 at 4:25 am #167743In reply to: Auto Subscribe
Pascal Casier
ModeratorHi kamenlee,
First of all, you can refer to https://bbpress.org/forums/topic/new-users-auto-subscribe-to-one-forum/ if you know how to code and try from there to automate.
Otherwise you can start with this plugin and perform it manually if somebody registers to your site (if your userbase is not that big) : https://wordpress.org/plugins/bbp-manage-subscriptions/ . The ‘automation’ and ‘bulk options’ are not yet there but should hopefully come in some weeks.
Pascal.
October 12, 2015 at 11:28 pm #167735In reply to: move content in bottom
Robkk
ModeratorIt adds this by default at 480px in the bbPress stylesheet. Should definitely show up unless you have reply threading activated because of some weird bug when it is activated.
#bbpress-forums .bbp-body div.bbp-topic-author, #bbpress-forums .bbp-body div.bbp-reply-author { margin: -15px 10px 10px; min-height: 100px; padding-left: 80px; position: relative; text-align: left; width: 100%; } #bbpress-forums div.bbp-topic-author img.avatar, #bbpress-forums div.bbp-reply-author img.avatar { position: absolute; top: 15px; left: 0; width: 60px; height: auto; } #bbpress-forums .bbp-body div.bbp-topic-content, #bbpress-forums .bbp-body div.bbp-reply-content { clear: both; margin: 10px; padding: 0; }October 12, 2015 at 11:08 pm #167734Robkk
ModeratorI split your topic, since it was kind of off topic.
This is the code I used to have the large avatar like that in the freshness column. This code should replace the bbp-topic-freshness list in loop-single-topic.php that should be copied in your child theme. You may have to style the avatar by floating it to the left and giving it a margin to the right too by using the class bbp-topic-freshness-author-av.
<li class="bbp-topic-freshness"> <span class="bbp-topic-freshness-author-av"><?php bbp_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'size' => 48 , 'type' => 'avatar' ) ); ?></span> <div class="bbp-topic-meta"> <?php do_action( 'bbp_theme_before_topic_freshness_link' ); ?> <?php bbp_topic_freshness_link(); ?> <?php do_action( 'bbp_theme_after_topic_freshness_link' ); ?> <?php do_action( 'bbp_theme_before_topic_freshness_author' ); ?> <span class="bbp-topic-freshness-author"><?php printf( __('by %1$s', 'bbpress' ), bbp_get_author_link( array( 'post_id' => bbp_get_topic_last_active_id(), 'type' => 'name' ) ) ); ?></span> <?php do_action( 'bbp_theme_after_topic_freshness_author' ); ?> </div> </li>October 12, 2015 at 10:58 pm #167732In reply to: How do I display the current users username?
Robkk
ModeratorI just split your reply into a topic so that you can have your own topic about this.
Please do not bump topics, especially topics that are about 8 years old.
If you are using the latest bbPress plugin.
To get the user’s username use
<?php global $current_user; get_currentuserinfo(); echo $current_user->user_login; ?>https://codex.wordpress.org/Function_Reference/get_currentuserinfo
You can also just use the WordPress toolbar.
October 12, 2015 at 10:30 pm #167730In reply to: Cannot login to bbPress forum
Robkk
ModeratorWhere do I add those lines of code?
It is CSS put it in your child themes style.css file, a custom css plugin, or anywhere you can put custom css.
I assume you want me to edit one of the PHP files
No, never edit the plugin core files, unless you are 100% sure you know what you are doing. Since you are a novice, just do not do it.
I don’t know what “multisite” is.
Since you do not know what it is, I am going to assume you do not have it. You do not need it to solve this issue so no need to install any plugins, just curious if you have it. I see it is probably that you have a test enviroment of WordPress because you are planning on migrating to a WordPress/bbPress install from phpBB.
Yes, your deleteme user does appear in the Users list.
Does it have the Participant forum role too?
Alright, so I assume you’re talking about Peter’s Login Redirect plugin, and I assume I’ll need to edit the settings under Settings -> Login/logout redirects, correct?
You seem to be getting that together. Not sure why you are redirecting to the forums especially a specific forum, but yeah you got it.
I created a test Subscriber user, which in fact is redirected upon logging in, but isn’t logged in (of course that code you recommended still needs added in).
The code I gave you helped remove the bullet list displaying in your forums.
Again thank you for trying to help Robkk, but I would definitely like it if you could be a bit more descriptive in what I need to do to fix this login problem
We still have to troubleshoot what is causing the user to not seem to be have access to the forums.
Try some of these troubleshooting steps listed in this guide to see if it could be theme/custom theme related like if you copied the bbPress customizable templates into your child theme and edited them and messed something up on accident, check to see if a plugin could be causing an issue, you can check to see if caching could be an issue by flushing cache from your site, if you edited the bbPress and ever do not remember what you edited you can reinstall a fresh version of the plugin to see if it fixes the issue also.
Do not just go deleting cache files from WordPress or code in bbPress.
October 12, 2015 at 9:19 am #167720In reply to: Bulk-move bbPress topics
Mei Ling
ParticipantHello,
We have done this… we are still testing it. Be careful use VPS:
<?php
/**
* Now that you have your custom column, it’s bulk/quick edit showtime!
* The filters are ‘bulk_edit_custom_box’ and ‘quick_edit_custom_box’. Both filters
* pass the same 2 arguments: the $column_name (a string) and the $post_type (a string).
*
* Your data’s form fields will obviously vary so customize at will. For this example,
* we’re using an input. Also take note of the css classes on the <fieldset> and <div>.
* There are a few other options like ‘inline-edit-col-left’ and ‘inline-edit-col-center’
* for the fieldset and ‘inline-edit-col’ for the div. I recommend studying the WordPress
* bulk and quick edit HTML to see the best way to layout your custom fields.
*/
add_action( ‘bulk_edit_custom_box’, ‘manage_wp_posts_be_qe_bulk_quick_edit_custom_box’, 10, 2 );
//add_action( ‘quick_edit_custom_box’, ‘manage_wp_posts_be_qe_bulk_quick_edit_custom_box’, 10, 2 );
function manage_wp_posts_be_qe_bulk_quick_edit_custom_box( $column_name, $post_type ) {switch ( $post_type ) {
case ‘topic’:
switch( $column_name ) {
case ‘bbp_topic_forum’:
?><fieldset class=”inline-edit-col-left”>
<div class=”inline-edit-col”>
<label>
<span class=”title”>Deplacer dans le forum</span>
<span class=”input-text-wrap”>
<select name=”deplacer”>
<option value=”Null”></option>
<?php /* recuperation des forums “forum” */
$args = array(
// ‘post_parent__not_in’=> array( 0 ) ,
‘post_type’ => ‘forum’
);
$forums = new WP_Query( $args );
// boucle de test affiche en debug id et titre forum
if ( $forums->have_posts() ) {
while ( $forums->have_posts() ) {
$forums->the_post();
echo ‘<option value=”‘.$forums->post->ID.'”>’.get_the_title() . ‘</option>’ ;
}
}
wp_reset_postdata();?></select>
</span>
</label>
</div>
</fieldset><?php
break;
}
break;
}
}/**
* When you click ‘Quick Edit’, you may have noticed that your form fields are not populated.
* WordPress adds one ‘Quick Edit’ row which moves around for each post so the information cannot
* be pre-populated. It has to be populated with JavaScript on a per-post ‘click Quick Edit’ basis.
*
* WordPress has an inline edit post function that populates all of their default quick edit fields
* so we want to hook into this function, in a sense, to make sure our JavaScript code is run when
* needed. We will ‘copy’ the WP function, ‘overwrite’ the WP function so we’re hooked in, ‘call’
* the original WP function (via our copy) so WordPress is not left hanging, and then run our code.
*
* Remember where we wrapped our column data in a <div> in Step 2? This is where it comes in handy,
* allowing our Javascript to retrieve the data by the <div>’s element ID to populate our form field.
* There are other methods to retrieve your data that involve AJAX but this route is the simplest.
*
* Don’t forget to enqueue your script and make sure it’s dependent on WordPress’s ‘inline-edit-post’ file.
* Since we’ll be using the jQuery library, we need to make sure ‘jquery’ is loaded as well.
*
* I have provided several scenarios for where you’ve placed this code. Simply uncomment the scenario
* you’re using. For all scenarios, make sure your javascript file is in the same folder as your code.
*/
add_action( ‘admin_print_scripts-edit.php’, ‘manage_wp_posts_be_qe_enqueue_admin_scripts’ );
function manage_wp_posts_be_qe_enqueue_admin_scripts() {// if code is in theme functions.php file
wp_enqueue_script( ‘manage-wp-posts-using-bulk-quick-edit’, trailingslashit( get_bloginfo( ‘stylesheet_directory’ ) ) . ‘js/bulk_quick_edit.js’, array( ‘jquery’, ‘inline-edit-post’ ), ”, true );// if using code as plugin
//wp_enqueue_script( ‘manage-wp-posts-using-bulk-quick-edit’, trailingslashit( plugin_dir_url( __FILE__ ) ) . ‘js/bulk_quick_edit.js’, array( ‘jquery’, ‘inline-edit-post’ ), ”, true );}
add_action( ‘save_post’, ‘save_deplacer’);
function save_deplacer() {
global $wpdb;if( $_GET[‘post_type’]=’topic’ && $_GET[‘bulk_edit’]=’Mettre à jour’){
$post_ids= $_GET[‘post’];
$forum_id = $_GET[‘deplacer’];
foreach($post_ids as $post_id){$wpdb->query(“UPDATE $wpdb->posts SET post_parent = $forum_id WHERE ID = $post_id “);
}
}
}
/*echo ‘'; print_r($post_type); echo '
‘;
die();Array
(
[s] =>
[post_status] => all
[post_type] => topic
[_wpnonce] => dcfdf56a2d
[_wp_http_referer] => /public/wptest/wp-admin/edit.php?post_type=topic&paged=1
[action] => edit
[m] => 0
[bbp_forum_id] =>
[paged] => 1
[mode] => excerpt
[_status] => -1
[tax_input] => Array
(
[topic-tag] =>
)[Deplacer] => 39
[bulk_edit] => Mettre à jour
[post_view] => excerpt
[screen] => edit-topic
[post] => Array
(
[0] => 43
[1] => 41
)[action2] => -1
)*//**
* Step 3: display an admin notice on the Posts page after deplacer
*/
add_action(‘admin_notices’, ‘custom_bulk_admin_notices’);
function custom_bulk_admin_notices() {
global $post_type, $pagenow ;if( $_GET[‘post_type’]=’topic’ && $_GET[‘bulk_edit’]=’Mettre à jour’){
$messages = array();
$messages[] = bbp_admin_repair_forum_meta();
$messages[] = bbp_admin_repair_topic_meta();
$messages[] = bbp_admin_repair_freshness();
$messages[] = bbp_admin_repair_reply_menu_order();
$messages[] = bbp_admin_repair_forum_topic_count();
$messages[] = bbp_admin_repair_forum_reply_count();
$messages[] = bbp_admin_repair_topic_reply_count();
$messages[] = bbp_admin_repair_topic_voice_count();
$messages[] = bbp_admin_repair_user_topic_count();
$messages[] = bbp_admin_repair_user_reply_count();//if($pagenow == ‘edit.php’ && $post_type == ‘topic’ && isset($_GET[‘deplacer’])) {
$messageori = sprintf( _n( ‘Topic déplacé.’, ‘%s topics déplacés.’, $_REQUEST[‘deplacer’] ), number_format_i18n( $_REQUEST[‘deplacer’] ) );
foreach ($messages as $message){
echo'<div class=\”updated\”><p>’.$message[1].'</p></div>’;
}
echo “<div class=\”updated\”><p>{$messageori}</p></div>”;
}
}?>
October 12, 2015 at 5:31 am #167715In reply to: Cannot login to bbPress forum
names_are_useless
ParticipantThank you for trying to help Robkk.
Where do I add those lines of code? I assume you want me to edit one of the PHP files (click “Edit” for bbPress plugin). I just tried adding it to “bbpress/bbpress.php” (since its the first php file that comes up) at the end of the file. I received a “Parse error: syntax error, unexpected ‘-‘, expecting ‘(‘ in /var/www/vhosts/laysofalthas.com/epochgames/wordpress/wp-content/plugins/bbpress/bbpress.php on line 933”. There’s a bunch of other php files, and I have no idea where I’m supposed to put that code snippet (novice here), so I’m just going to delete that code and wait for further instructions.
I don’t know what “multisite” is. Looking through the plugin list, I see several (Multisite Toolbar Additions, Multisite Global Search, etc). Would you recommend I add one of them? Can you give me the specific name of one?
Alright, so how can I fix it so “yoursite.com/wordpress/wp-login.php” leads to “yoursite.com/wp-login.php” instead?
Yes, your deleteme user does appear in the Users list.
Alright, so I assume you’re talking about Peter’s Login Redirect plugin, and I assume I’ll need to edit the settings under Settings -> Login/logout redirects, correct? I have now set the “administrator” role to go to the URL “yoursite.com/wordpress/wp-admin/” and it works perfectly, so thank you. I have also set it so Subscribers are redirected to “http://epochgames.co.uk/forums/forum/test/” when they login. I created a test Subscriber user, which in fact is redirected upon logging in, but isn’t logged in (of course that code you recommended still needs added in). Can’t say I’m overjoyed that I have to change the URL to the forums every time I want to login as an administrator account, but at least I can get to the Dashboard now without having to memorize the URL.
Again thank you for trying to help Robkk, but I would definitely like it if you could be a bit more descriptive in what I need to do to fix this login problem. I am very much a novice still with WordPress.
October 12, 2015 at 4:28 am #167714Topic: How do I display the current users username?
in forum Themessidbait
ParticipantWhen I put this code header.php file of my wp theme, i get this error 500 – Internal server error.
October 11, 2015 at 12:46 pm #167707In reply to: Cannot login to bbPress forum
Robkk
ModeratorThis fixes the list issue.
#bbpress-forums li { list-style: none !important; }I created a user called “deleteme” and I see the issue you are talking about.
Do you have multisite enabled or at least a subsite for testing.
the wp-login.php page leads to yoursite.com/wordpress/wp-login.php instead of just yoursite.com/wp-login.php.
Check it out right now to see if I am even a user to just the yoursite.com site. If I am see that I am even have a forum role like participant.
The redirect to the home page is because of some piece of code in bbPress for the frontend login forms. You can easily fix this by setting it where Admins can go the Admin and other users redirect to the home page using the plugin you have already installed.
October 11, 2015 at 10:56 am #167703mvaneijgen
ParticipantI have a small problem. I want to show the most popular topcis on my home page, but now I am running for a while and this feature is kinda killing my SEO performance. This is because there is one topic fairly popular on my forum and has been for over a few months now and because this is represented on the home page Google has picked up on it and this topic is showing up in most of my test search results.
Now I still want to have this feature, but make it a bit more fair for the other topcis and show the most popular topcis that has stated in the previous few days (lets say 30). Is there a shortcode/feature or function that could achieve this?
October 11, 2015 at 6:08 am #167697In reply to: Remove NoFollow from BBPress Posts
Robkk
ModeratorI think there is an issue with the
bbp_make_clickable()function that is causing this especially the part that leads to the function_make_url_clickable_cb()in WordPress.bbp_make_clickable()is in\bbpress\includes\common\formatting.php_make_url_clickable_cb()is in\wp-includes\formatting.phpWill make a trac ticket once I gather the information to write down.
October 11, 2015 at 4:49 am #167694In reply to: If is the frontpage of the forum
Robkk
ModeratorDoes your SEO plugin allow allow you to edit the titles and descriptions of custom post type archives? Most SEO plugins do. And in them you look for forum archive to edit the front page of the forums.
Here is the bbPress conditionals if you are using something custom.
October 10, 2015 at 6:58 pm #167686crzyhrse
ParticipantI second Robert’s perspective… I’ve been looking for a way to do this for a while… If I knew php code well enough I’d offer to help out, but alas, I don’t…
October 10, 2015 at 6:44 pm #167685In reply to: style my forum like yours
Robkk
ModeratorYou can try this instead. This hides the “this forum contains … topics… and” description that is blue on top of forums.
add_filter( 'bbp_get_single_forum_description', '__return_false' ); add_filter( 'bbp_get_single_topic_description', '__return_false' );You can try this CSS for the reply/topic form text areas.
#bbpress-forums fieldset.bbp-form textarea { border: 1px solid #ccc; }Anything else you want on this site I am sure there has already been a topic about so searching the forums might be best.
October 10, 2015 at 4:47 pm #167679Robkk
ModeratorI am starting to think that filter may not be the best way to translate content. It was widely used though and was recommend a few times in these forums.
While trying to find the bbPress string swap plugin that was a bbPress plugin that use to do this exact thing fine. I came upon this that lead me to find the alternative to the gettext filter and using
global $l10n;https://github.com/justintadlock/hybrid-core/issues/49
Here is an example with BuddyPress and I am sure there is a way to make this kind of thing work with bbPress.
October 10, 2015 at 3:58 pm #167676Robkk
ModeratorTry to ask Robin for the code snippet he uses in the plugin. He had a separate plugin that did it, but I am not entirely sure it still works.
October 10, 2015 at 3:56 pm #167675Robkk
ModeratorThis might be custom development for now. You may need to hire a developer for this type of functionality.
Here is a guide to help people create custom user roles with custom capabilities.
The whole each user gets a private forum thing could be possible in the plugin bbPress Private Groups but I am not entirely sure. Having specific roles have their own forum is possible with the plugin though, a group of users not sure about just 1 specific user to each forum.
Upgrading the role after they have done something is custom development also.
October 10, 2015 at 3:47 pm #167674In reply to: Reply text area
Robkk
ModeratorDoes this CSS help any?? If it doesn’t add !important to it.
#bbpress-forums div.bbp-the-content-wrapper textarea.bbp-the-content { max-width: 100%; height: auto; }October 10, 2015 at 3:47 pm #167673In reply to: Bulk-move bbPress topics
Pascal Casier
ModeratorFor this ticket, I have the logic on paper what is needed and part of the code already in one of my projects. But need to finish some stuff for the association first.
For the participation part, I’m helping in the forum and will stick to that for now. But any bbPress developer can have a look at my code of course to get inspiration 🙂
But we can have a chat about it, no problem.
Pascal.October 10, 2015 at 3:32 pm #167671In reply to: Bulk-move bbPress topics
Robkk
ModeratorAny contributions to that ticket would be much appreciated.
Any other participation in the bbPress project would be much appreciated also.
October 10, 2015 at 3:27 pm #167670In reply to: Adding a border to topic and rply text boxes.
Robkk
ModeratorYou can also try something like this too.
#bbpress-forums fieldset.bbp-form textarea, #bbpress-forums fieldset.bbp-form select, #bbpress-forums fieldset.bbp-form input { border: 1px solid #ccc; }October 10, 2015 at 3:25 pm #167669In reply to: URGENT – Freshness Name doesn’t update
Robkk
ModeratorWhat does the plugin do?
You can send me the plugin in a zip to my email so I can see what the actual code does, and see if there is a possible fix for it too.You can send the plugin to the email listed here.
October 9, 2015 at 1:10 pm #167652Topic: Not able to open sticky post in new forum
in forum Troubleshootingtrusso
ParticipantSite: http://www.levelupsolutionscenter.com
Theme: ZippyCourses by Social Trigger
Wordpress: Latest release
bbforums: 2.5.8 (Latest)I have installed the plugin for bbforums. No issues setting it up. I have created a post that I want to remain at the top of the forum. It is titled, Getting Started. I made it ‘sticky’ believing that this would allow it to be there at the top regardless of what others put in the forum.
When I go in to test as a user who has purchased a course, the user can get to the forum but cannot see the sticky post content. Just the listing in the forum. I set access to participant and open, with automatic membership.
I read your documentation and created a forum registration page and put in your shortcode.
Do users need to register with the forum first to see the content of a post?
If they do and I have the registration page, I can put it in the menu. Is that what I need to do to get registration to people? Is there anything special I need to know to make registration go through and access be granted? Special in setting up the access page?Question really is: how does a user of the educational material get to see the forum questions/posts?
Thank you!
October 9, 2015 at 11:17 am #167645In reply to: You must be logged in to reply to this topic
mica123
ParticipantJust to let you know that I was testing it all day. I removed Robkk’s redirect code to see if there would be the same problem with Peter’s Redirect plugin and it is the same. So I am at my wits’ end.
-
AuthorSearch Results