Search Results for 'code'
-
AuthorSearch Results
-
March 6, 2017 at 8:58 pm #182581
In reply to: Inserting text in forum “header”
fastk9dad
ParticipantUpdate: I was able to figure out how to achieve my desired result via CSS by using this code:
.bbppu-mark-as-read:after { content: '|'; padding-left: 10px; padding-right: 10px; }The result:
March 5, 2017 at 6:18 pm #182560Topic: Inserting text in forum “header”
in forum Themesfastk9dad
ParticipantBackground: I have my forum Subscribe link on the right side of the header using
float:right, I am also running Pencil Unread plugin and have enabled the “Mark all as read” option and also usedfloat:rightto prevent it from blending in with the breadcrumbs however now “mark all as read” and “subscribe” are getting up close and personal like this:Mark all as readSubscribe
Ideally I would like to insert a pipe and a couple of spaces between them to follow suit with how the topics page is formatted like this:
Mark all as read | Subscribe
I have searched the forums high and low and haven’t really come up with an answer. I tried looking for the “bbp_template_before_topics_loop” code figuring I could add it to my child theme and modify it at will but turned up empty.
So what is the best way to accomplish this?
March 5, 2017 at 2:04 pm #182554In reply to: 2 User Names with one Role Capability
Kalusha
ParticipantI have now this code into functions
##Name ändern Participant in User Standard User
function my_custom_roles( $role, $user_id ) {
if( $role == ‘Teilnehmer’ )
return ‘Standard User’;return $role;
}
add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles’, 10, 2 );
function my_custom_roles2( $role, $user_id ) {
if( $role == ‘Keymaster’ )
return ‘Michael’;return $role;
}add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles2’, 10, 2 );
function my_custom_roles3( $role, $user_id ) {
if( $role == ‘Zuschauer’ )
return ‘Premium User’;return $role;
}add_filter( ‘bbp_get_user_display_role’, ‘my_custom_roles3’, 10, 2 );
So I change only the names. Now I must to have that the spectator has the same capability as the participants. So I have no code for this found, I have change the capability.php in bbpress core. I know it´s not the best way and after a Update I must change it again but it works. I have no other idea. 🙁
March 5, 2017 at 1:25 pm #182553In reply to: 2 User Names with one Role Capability
Robin W
Moderatorcan you paste the exact code you are using into here, and I’ll check it
March 5, 2017 at 12:45 pm #182551In reply to: 2 User Names with one Role Capability
Robin W
Moderatorfollow this link with a description on how to do this
March 4, 2017 at 2:57 pm #182481In reply to: Allow Participants to Trash / own Topics and Posts
sally
ParticipantHi Robin,
thanks so much for the adapted code, all works yet perfect!!!
Thanks for the Support!
Best Regards
SallyMarch 4, 2017 at 1:33 pm #182467In reply to: Allow Participants to Trash / own Topics and Posts
Robin W
Moderatorok, this code allows participabts to
trash their own replies and
trash their own topics where there have been no replies, once a reply has been posted then they can no longer delete.it does display slightly weirdly when you delete a topic, but it is the best you are going to get from me.
give it a try and see if you still have the admin problems
/*Customize the BBPress roles to allow Participants to trash topics*/ add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 ); function ST_add_role_caps_filter( $caps, $role ){ // Only filter for roles we are interested in! if( $role == bbp_get_participant_role() ) { $newcaps = array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'delete_topics' => true, 'view_trash' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'delete_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); return $newcaps; } return $caps; } add_filter( 'bbp_map_reply_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 ); add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 ); function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){ // apply only to delete_reply and delete_topic if ( $cap == "delete_reply" || $cap == "delete_topic" ){ // Get the post $_post = get_post( $args[0] ); if ( !empty( $_post ) ) { // Get caps for post type object $post_type = $_post->post_type ; // Add 'do_not_allow' cap if user is spam or deleted if ( bbp_is_user_inactive( $user_id ) ) { $caps[] = 'do_not_allow'; // Moderators can always edit forum content } elseif ( user_can( $user_id, 'moderate' ) ) { $caps[] = 'moderate'; // User is particiapte so allow delete } elseif ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) { //allow any reply to be deleted if ($post_type == bbp_get_reply_post_type()) $caps = array('delete_replies') ; //only allow topic delete if there are no replies if ($post_type == bbp_get_topic_post_type()) { $reply_count = bbp_get_topic_reply_count(); if ( $reply_count == 0) $caps = array('delete_topics') ; } // Unknown so do not allow } else { $caps[] = 'do_not_allow'; } } } // return the capabilities return $caps; }March 4, 2017 at 4:28 am #182431In reply to: Allow Participants to Trash / own Topics and Posts
sally
ParticipantHi Robin,
yes, when participant roles delete replies it works. I was thinking, when a participant delete a topic what he creates, and a lot of users reply to this, after he deletes, all the replies are as well deleted, made no sense.
Is it possible, to take out the possibility for participants to delete the topics? They should be only able to delete the replies of them
Regarding the Admin Role:
When i activate the Code in the Dashboard the following happens
1.) yes, thats correct. With activated code as Admin i cannot manage / access the Forums page and cannot create topics and replies, when logged in.
To test then, i opened in the same browser a second Tab and pasted the http://domain.com/forums link and refreshed the browser to see if it works there, but i still get redirected to the Homepage (Landing page)…
Also what is strange, under Dashboard – Admin Menu the Links Forums, Topics and Replies are complete missing …, when deactivating the code they appear again..
Regards
SallyMarch 3, 2017 at 7:22 pm #182427In reply to: Allow Participants to Trash / own Topics and Posts
Robin W
Moderatordeleting replies will redirect to the topic that still exists, so that will work!
deleting topics redirects to the topic which no longer exists, so gets a 404 error which your site directs to the homepage – not sure how to fix that. A moderator can still view the topic, so that is ok. might be able to do some code with a readtopics capability so that an author can view his own closed topics.
on admins – Sorry I still don’t quite understand.
1. so I have a browser tab logged into admin, and showing the dashboard. I then open another tab in the same browser and paste in a forums link and it goes to the homepage – yes ?
2. if so – I can’t replicate
3. Why do you need to do this?March 3, 2017 at 9:50 am #182416In reply to: Allow Participants to Trash / own Topics and Posts
sally
ParticipantYes, the code on top works, only the redirection seems to be the issue..
Role Admin
When code is activated, and I login to the Admin Dashboard, and enter the forums link, I get redirected to the homepage, cannot access / view the forums .
When I deactivate the code, I can access the forums link as Admin..
Participant
Delete Topics
Topics can be trashed and deleted, but after pressing Trash, Participant Role get redirected to homepage
Delete Reply’s
Reply’s can be trashed / deleted without redirection, works fine…
Thx
Regards
SallyMarch 3, 2017 at 9:12 am #182415In reply to: Allow Participants to Trash / own Topics and Posts
Robin W
Moderatorok, whilst out I think I know what the issue is.
Firstly can you confirm that apart from redirecting you to home, the code at the top of this thread works? ie redirection to the wrong place is the only outstanding issue.
If so, the issue is that after you delete a topic, bbpress sends you to back to the topic, which as a moderator you are allowed to see trashed topics, but as a partyicipant you are not. This then will send you to a 404 page, which in your case I think just sends you to home.
So let me look at ways to get around this.
March 3, 2017 at 6:04 am #182413In reply to: bbp-messages
russ8523
ParticipantHi Samuel,
First ley me say that I am a beginner, this being my first WP site. I can not handle code. Secondly, my site has now been completely rebuilt online in a sub directory – the Wamp version was messed up! The site is at https://newsite.hampsteadbowmen.com. I can give you Admin access if you give me a private email? I will copy this into the other thread.Regards,
StewartMarch 3, 2017 at 5:37 am #182411In reply to: bbp-messages
Ismail
ParticipantHello everyone,
Sorry but I just came to discover this thread, I am the author of bbp-messages and there’s now a major update made and it now supports Multisite, the problem that Stewart was reporting.
Also Stewart, the link
wordpress/members1/http:/localhost/wordpress/members1/pretty much seems messed up, so it’s hard to tell whether it is bbP issue or configuration. I think you did not configure your testing environment quite well and also the bbPress link looks filtered by BuddyPress. Next time I’d suggest you edit your hosts file (c:\System32\drivers\etc\hostswith admin permissions using notepad) and add a new entry127.0.0.1 bbpress.devnowbbpress.devwill act like a normal domain and you wouldn’t run into issues while testing or migrating (all you can do is replace.devwith.tldin the db SQL file). Also add the virtual host for Apache http://stackoverflow.com/a/25203499/3910932Thank you Arutam and Robin you’re very helpful. I just wanted to point that this thread continues in wp-org plugin support forums https://wordpress.org/support/topic/messages-upgrade/
Best,
SamuelMarch 3, 2017 at 5:00 am #182410In reply to: Allow Participants to Trash / own Topics and Posts
sally
ParticipantHi Robin,
Thanks for checking the code. Can you help me to get the open issues fixed with the origin code ?
Best Regards
SallyMarch 3, 2017 at 4:48 am #182408In reply to: Allow Participants to Trash / own Topics and Posts
Robin W
Moderatorthough re-reading the thread this morning, I think I have not fixed anything, juts done it another way.
and that doesn’t work either – forget the code above
March 2, 2017 at 6:40 pm #182391In reply to: Allow Participants to Trash / own Topics and Posts
Robin W
Moderatorok, I’ve taken pity and kicked this round for an hour – I expect to be on your Christmas list !!!
This seems to work, although please do some testing for all roles, and check it out.
/*Customize the BBPress roles to allow Participants to trash topics*/ add_filter( 'bbp_get_caps_for_role', 'ST_add_role_caps_filter', 10, 2 ); function ST_add_role_caps_filter( $caps, $role ){ // Only filter for roles we are interested in! if( $role == bbp_get_participant_role() ) { $caps = array( // Primary caps 'spectate' => true, 'participate' => true, // Forum caps 'read_private_forums' => true, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'delete_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'delete_replies' => true, // Topic tag caps 'assign_topic_tags' => true, ); } return $caps; } /*then only allow participants to trash their own topics*/ add_filter( 'bbp_map_reply_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 ); add_filter( 'bbp_map_topic_meta_caps', 'ST_tweak_trash_meta_caps', 11, 4 ); function ST_tweak_trash_meta_caps( $caps, $cap, $user_id, $args ){ // apply only to delete_reply and delete_topic if ( $cap == "delete_reply" || $cap == "delete_topic" ){ // Get the post $_post = get_post( $args[0] ); if ( !empty( $_post ) ) { // Get caps for post type object $post_type = get_post_type_object( $_post->post_type ); //$caps = array(); // Add 'do_not_allow' cap if user is spam or deleted if ( bbp_is_user_inactive( $user_id ) ) { $caps[] = 'do_not_allow'; // Moderators can always edit forum content } elseif ( user_can( $user_id, 'moderate' ) ) { $caps[] = 'moderate'; // User is author so allow edit if not in admin } elseif ( user_can( $user_id, 'participate' ) && ( (int) $user_id === (int) $_post->post_author ) ) { $caps = array(); //$caps[] = $post_type->cap->delete_posts; // Unknown so do not allow } else { $caps[] = 'do_not_allow'; } } } // return the capabilities return $caps; }March 2, 2017 at 11:49 am #182378In reply to: Forum just won’t show up
AiratTop
ParticipantI can open https://airat.biz/forums/ after delete [] in
/plugins/bbpress/includes/forums/functions.phpon lines 1800, 1818, 1832Old: $post_stati[]
New: $post_statiAnd line 1854:
Old: $meta_query[]
New: $meta_queryCan you check it out?
I think this issue with php7 support
Now i have a warning:
[Thu Mar 02 20:46:15.572617 2017] [php7:warn] [pid 23849] [client ip] PHP Warning: array_unique() expects parameter 1 to be array, null given in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php on line 1836March 2, 2017 at 11:40 am #182377In reply to: Forum just won’t show up
AiratTop
ParticipantI have the same problem.
I can’t open page https://airat.biz/forums/ and https://airat.biz/wp-admin/edit.php?post_type=forum
Error 500I saved Permalinks, reinstalled plugin, but pages still don’t working.
bbPress tools also don’t help
/wp-admin/tools.php?page=bbp-repairError log:
[Thu Mar 02 20:33:57.235075 2017] [php7:error] [pid 16265] [client ip] PHP Fatal error: Uncaught Error: [] operator not supported for strings in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php:1800\nStack trace:\n#0 /site_path/wp-includes/class-wp-hook.php(298): bbp_pre_get_posts_normalize_forum_visibility(Object(WP_Query))\n#1 /site_path/wp-includes/class-wp-hook.php(323): WP_Hook->apply_filters(NULL, Array)\n#2 /site_path/wp-includes/plugin.php(515): WP_Hook->do_action(Array)\n#3 /site_path/wp-includes/class-wp-query.php(1681): do_action_ref_array('pre_get_posts', Array)\n#4 /site_path/wp-includes/class-wp-query.php(3238): WP_Query->get_posts()\n#5 /site_path/wp-includes/class-wp.php(617): WP_Query->query(Array)\n#6 /site_path/wp-includes/class-wp.php(735): WP->query_posts()\n#7 /site_path/wp-includes/functions.php(955): WP->main('')\n#8 /home/a in /site_path/wp-content/plugins/bbpress/includes/forums/functions.php on line 1800bbPress 2.5.12
BuddyPress 2.8.1
WordPress 4.7.2
PHP 7.1.2-3+deb.sury.org~xenial+1March 2, 2017 at 9:08 am #182374In reply to: Change query
Robin W
ModeratorI am not sure I understand what it is you are asking
wp-query is a wordpress function
March 2, 2017 at 8:40 am #182372Topic: Change query
in forum Troubleshootingyito
ParticipantIn loop-replies.php, I want to change WP_Query.
But ‘bbp_repliesisbbpress()->reply_query->have_posts();` ,so I don’t know how to change some of WP_Query.Please someone teach me how to.
Wordpress version 4.7.2
bbPress version 2.5.12Robin W
Moderatortry this – it should work but is untested
Please come back and let us know if it does or doesn’t
add_filter ('kal_get_user_role_map()' , 'bbp_get_user_role_map()' ) ; function kal_get_user_role_map() { // Get the default role once here $default_role = bbp_get_default_role(); return (array) apply_filters( 'kal_get_user_role_map', array ( 'administrator' => bbp_get_keymaster_role(), 'editor' => $default_role, 'author' => bbp_get_spectator_role(), 'contributor' => $default_role, 'subscriber' => $default_role ) ); }This goes in your function file
March 1, 2017 at 11:53 am #182341Topic: Edit Profile (pale blue) Fields
in forum Installationruss8523
ParticipantI simply want to edit the wording in the (Pale Blue), fields in the ‘Edit Profile’ section. an example: to change “Your password should be at least ten characters long. Use upper and lower case letters, numbers, and symbols to make it even stronger.” to “eight characters long”. Also the (Pale Blue), name field is empty, just a ‘period’. Where is the code/file located? I’ve searched high and low!?
WP 4.7.2 bbpres 2.5.12 newsite.hampsteadbowmen.com
Any help will be very much appreciated.
February 28, 2017 at 7:40 pm #182320Topic: sidebar
in forum Requests & Feedbackjunglejim620
ParticipantHi bbPress,
From the edit page, I used this shortcode [bbp-forum-index].
Then set full template with no sidebars and from the bottom sidebar I chosen NONE. The page still showing the sidebar?
The main question is, is there anyway making NOT to show the sidebar on the page?
Please advise help, thanks
February 27, 2017 at 2:44 pm #182307In reply to: bbp_get_topic_last_reply_author Functions
John James Jacoby
KeymasterHi Dominik,
It’s great that you’re digging around the code to figure out what functions to use! Can you describe a bit about what you’d like to accomplish? Once we know the end result, we can help you work towards it, step by step.
John James Jacoby
KeymasterUse the
bbp_get_user_role_mapfilter, to map WordPress roles to bbPress roles. -
AuthorSearch Results
