Search Results for 'code'
-
AuthorSearch Results
-
October 23, 2021 at 8:53 am #223948
In reply to: Force Sticky Post Order
Robin W
Moderatorok, without knowing what is determining the order, it is hard to give you code to correct.
I’d suggest you play with publish dates of the stickies and ant replies to them to see if you can work out the issue, then come back and I’ll see if I can help further
October 22, 2021 at 2:20 pm #223935In reply to: Force Sticky Post Order
Robin W
Moderatorline 322 of \includes\topics\template.php has the function I think
you’d use a filter to add an ‘order by’ probably using the parse args on line 330
so
add_filter ('bbp_before_add_sticky_topics_parse_args' , 'your_function') ; function your_function ($r) { //add the order you want to sort $r['order_by'] = etc...... }Sorry don’t have time to look at this evening, but come back if you need further help
October 22, 2021 at 2:01 pm #223934In reply to: Force Sticky Post Order
rngeer
ParticipantNada, just going to explain the nature of it to them and dig around later for a code hack if there is one. Thank you so much for the help.
October 22, 2021 at 7:01 am #223920Topic: Force Sticky Post Order
in forum Troubleshootingrngeer
ParticipantHello, this is a request I have to force the order of two sticky posts so that they don’t change when a new comment is added.
Sticky 1
Sticky 2Sticky 2 will move above Sticky one with a new comment, and vice-versa.
Any way in the code to force that sticky order to stay the same all the time.
Thanks in advance.
October 20, 2021 at 4:56 pm #223902In reply to: Change Default Display Name
Robin W
Moderatoruntested, but this should work
add_filter( 'bbp_get_reply_author_display_name' , 'rew_reply_change_to_first_name', 10 , 2 ) ; function rew_reply_change_to_first_name ($author_name, $reply_id) { // Get the author ID $author_id = bbp_get_reply_author_id( $reply_id ); $user = get_userdata($author_id); $first_name = $user->user_firstname; return $first_name ; } add_filter( 'bbp_get_topic_author_display_name' , 'rew_topic_change_to_first_name', 10 , 2 ) ; function rew_topic_change_to_first_name ($author_name, $topic_id) { // Get the author ID $author_id = bbp_get_topic_author_id( $topic_id ); $user = get_userdata($author_id); $first_name = $user->user_firstname; return $first_name ; }Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
October 18, 2021 at 6:15 am #223839Topic: Creating new custom role
in forum Requests & Feedbackangelfire4xx
ParticipantIt seems to be a real struggle to create a new custom role for bbpress 🙁
I’ve been trying out all the different solutions I’ve found online but nothing is working.
All I want to do is to be able to assign the role of Naturopath to some of my forum participants. They would have the same capabilities as the Participant role, just have Naturopath instead of Participant showing under their name in the Forum. The rest of the Participants can continue to show “Participant”.
Can anyone here maybe write the code for me as a paid job?
I have WP 5.8.1
bPress 2.6.6October 14, 2021 at 4:02 pm #223771In reply to: Add Custom User Roles
angelfire4xx
ParticipantGreat tip about code snippets plugin, I didn’t know about that one, thanks!
Sadly the user is still showing up in bbpress as Participant. Although I was able to save the user with a Naturopath role in WP.
October 14, 2021 at 1:43 pm #223770In reply to: Add Custom User Roles
Robin W
Moderatorok, I think it was just loading in the wrong place, try
add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 ); add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 ); function add_new_roles( $bbp_roles ) { /* Add a role called naturopath */ $bbp_roles['bbp_naturopath'] = array( 'name' =>'Naturopath', 'capabilities' =>custom_capabilities( 'bbp_naturopath' ) ); return $bbp_roles; } function add_role_caps_filter( $caps, $role ) { /* Only filter for roles we are interested in! */ if( $role == 'bbp_naturopath' ) $caps = custom_capabilities( $role ); return $caps; } function custom_capabilities( $role ) { switch ( $role ) { /* Capabilities for 'naturopath' role */ case 'bbp_naturopath': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' =>false, // Forum caps 'publish_forums' =>false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => true, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, 'delete_others_replies' => false, 'read_private_replies' => true, // Topic tag caps 'manage_topic_tags' => false, 'edit_topic_tags' => false, 'delete_topic_tags' => false, 'assign_topic_tags' => true, ); break; default : return $role; } }Put this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
October 14, 2021 at 12:36 pm #223767In reply to: Add Custom User Roles
angelfire4xx
ParticipantThanks Robin, I did search and replace tutor > Naturopath and pasted the code at the end of functions.php. I would love to say it worked but…
Naturopath appeared as a forum role selection in the dropdown for each WP User. However when Naturopath was selected for the user and then saved, WP only displayed Role = “No role for this user”, and Capabilities = bbp_Naturopath.
When I tried a test post as that user, BBPress described me as a participant.
So, not there yet, but your help is appreciated 🙂
Linda(PS: I’m looking for the Naturopath role to have the same capabilities as Participant.)
October 14, 2021 at 11:29 am #223766In reply to: Add Custom User Roles
Robin W
Moderator//code to add tutor role add_action ('wp_loaded' , 'load_new_roles') ; function load_new_roles () { add_filter( 'bbp_get_dynamic_roles', 'add_new_roles', 1 ); add_filter( 'bbp_get_caps_for_role', 'add_role_caps_filter', 10, 2 ); } function add_new_roles( $bbp_roles ) { /* Add a role called tutor */ $bbp_roles['bbp_tutor'] = array( 'name' =>'Tutor', 'capabilities' =>custom_capabilities( 'bbp_tutor' ) ); return $bbp_roles; } function add_role_caps_filter( $caps, $role ) { /* Only filter for roles we are interested in! */ if( $role == 'bbp_tutor' ) $caps = custom_capabilities( $role ); return $caps; } function custom_capabilities( $role ) { switch ( $role ) { /* Capabilities for 'tutor' role */ case 'bbp_tutor': return array( // Primary caps 'spectate' => true, 'participate' => true, 'moderate' => false, 'throttle' => false, 'view_trash' =>false, // Forum caps 'publish_forums' =>false, 'edit_forums' => false, 'edit_others_forums' => false, 'delete_forums' => false, 'delete_others_forums' => false, 'read_private_forums' => true, 'read_hidden_forums' => false, // Topic caps 'publish_topics' => true, 'edit_topics' => true, 'edit_others_topics' => false, 'delete_topics' => false, 'delete_others_topics' => false, 'read_private_topics' => true, // Reply caps 'publish_replies' => true, 'edit_replies' => true, 'edit_others_replies' => false, 'delete_replies' => false, 'delete_others_replies' => false, 'read_private_replies' => true, // Topic tag caps 'manage_topic_tags' => false, 'edit_topic_tags' => false, 'delete_topic_tags' => false, 'assign_topic_tags' => true, ); break; default : return $role; } }October 12, 2021 at 4:52 pm #223710Chuckie
Participant@wendylady, also, if you install the “Advanced Editor Tools” plugin you can get your TinyMCE toolbar to show the menu bar. I just tried it. This menu bar has the “Restore last draft” on it.
But I have not added any code to include the “restoredraft” button on the toolbar itself.
But as previously mentioned, the autosave is defaulting to 30 seconds.
October 12, 2021 at 4:24 pm #223709Chuckie
ParticipantHi @wendylady
Thanks for trying the plugin! According to the TinyMCE documentation for autosave it simply states:
This plugin gives the user a warning if they made modifications to the content within an editor instance but didn’t submit the changes.
I notice there is an option
autosave_interval:This option enables you to specify the time the editor should wait between taking snapshots of the current content and saving them to local storage. The syntax is to append the letter s to the end of a number value. For example, “30s” for 30 seconds.
According to the documentation the default is 30 seconds. Since i do not specify this option in my plugin it must be using this default of 30 seconds.
If you don’t mind, could you also re-produce your query in the support forum for the plugin:
https://wordpress.org/support/plugin/add-autosave-fullscreen-to-tinymce/
?
And I can add the same response there.
Does this help?
October 12, 2021 at 10:06 am #223700In reply to: Forum Display
Robin W
Moderatorsorry, copied the wrong link
it should be
[bbp-single-forum id=$forum_id]all the shortcodes are here
October 12, 2021 at 9:56 am #223699In reply to: Forum Display
cryptobeya
ParticipantThank you. I tried that, however it displays the “create new topic” form and not the forum list. Is that shortcode correct?
Coin Forums
Create New Topic in “Coin Forum”
Your account has the ability to post unrestricted HTML content.
Topic Title (Maximum Length: 80):Topic Tags:
Topic Type:
October 12, 2021 at 9:11 am #223696In reply to: Forum Display
cryptobeya
ParticipantThank you, that makes sense. When I add the short code to each page, you say $forum Id = the category. Where can I find the forum Id for the category? Is that just the name of the category?
The name of my category id Coin Forum. What should go in the $forum_id space below?
[bbp-topic-form forum_id=$forum_id]
October 11, 2021 at 2:55 pm #223676MrsJessicaSimpson
Participantadd_filter( 'bbp_get_view_query_args', 'rew_limit') ; function rew_limit ($args) { $args['posts_per_page'] = -1 ; $args['posts_per_page'] = 10 ; return $args ; }Following this, and looking at it: then a bracket ‘]’ might be missing where the (= 10) line is.
Which could explain the unexpected T_FUNCTION error.Got this code running on my site, (in the functions.php file), and it seems to work.
Happy-hacking.
October 9, 2021 at 2:08 pm #223660In reply to: Forum Topics
fenna4498
ParticipantOctober 7, 2021 at 1:30 pm #223630In reply to: Akismet causing “recent topics” problem?
Robin W
ModeratorI need to know what you are using ie
can you just clarify what this is, a widget or shortcode, and which one
October 7, 2021 at 12:38 pm #223628In reply to: Akismet causing “recent topics” problem?
Robin W
Moderator‘Recently Active Topics’
can you just clarify what this is, a widget or shortcode, and which one
October 7, 2021 at 4:49 am #223620aygunoz
ParticipantSo how can I edit this code for [bbp-topic-index] shortcut and Implementation to my WordPress plugin? If you please, Can you explain more bc I didn’t understand exactly what to do :/ Sorry.
Thank you for helpingOctober 7, 2021 at 4:11 am #223619Robin W
Moderatoramended in the original code to add the missing ;
October 7, 2021 at 3:33 am #223616aygunoz
ParticipantOkay, I found the functions.php but I confuse about this code
add_filter( 'bbp_get_view_query_args', 'rew_limit')Bc there are functions but there are not any code like this. So Shall I paste this there too? And after paste what’s gonna be shortcut ?
Thank You!October 7, 2021 at 3:04 am #223613Robin W
ModeratorPut this in your child theme’s function file –
ie wp-content/themes/%your-theme-name%/functions.php
where %your-theme-name% is the name of your theme
or use
October 6, 2021 at 11:54 pm #223610aygunoz
ParticipantWhere shall I put this code? This is what exactly I was looking for :)?
October 6, 2021 at 3:41 pm #223606In reply to: Topic only shows while logged in
Robin W
ModeratorI’d suggest you check out
function bbp_new_topic_handleron line 96 of
includes\topics\functions.php
for how a new topic is created
-
AuthorSearch Results