Forum Replies Created
-
can you tell me what your permalink setting is
dashboard>settings>permalinks
In reply to: Forum Roles Explanation?I can only suggest that you create a new topic using your programme
Then I’d look at everything in the database in wp_posts & wp_postmeta that has that ID
Take a copy of all of this
Then hit the update in the backend and see what has changed
In reply to: Sidebar on a forum page?sections 8 & 9
In reply to: wrong sidebar on topics pagelink/url please
In reply to: forum martiniqueIn reply to: page menu disabled when i change themesthe menu is disables
Should just be a theme setting
go to dashboard>appearance>menus and go to bottom
you’ll need to tick the ‘primary menu’ and save to get it back again
In reply to: Show latest reply author namenow amended and in Version 1.9 together with hide avatar and shorten freshness options
In reply to: Add Custom User Rolesš
In reply to: Add Custom User Rolesif you changed roles, then you might need to reset the default role
dashboard>settings>forums and look for what the default role is
In reply to: Add Custom User Rolesit’s also great when you come back to the code two months later and can’t remember what it does !
In reply to: Add Custom User Rolesdon’t forget you can use
/* xxx */ or
//to make comments throughout your code
// only does a single line
/* this
does
multiple lines
*/so you can have
//Add the Artisan role $bbp_roles['my_custom_role5'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); // Rename the Moderator role $moderator = bbp_get_moderator_role() ; $bbp_roles[$moderator] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); );
In reply to: Add Custom User RolesWould it have been wrong to modify them to say bbp_craftsman
either is fine, they’re just labels under which they are stored in the database, so yes you could, but as you’ll not generally see these it doesn’t matter either way, but if it’s clearer to you, the go ahead and amend !
Keep asking !
In reply to: Add Custom User RolesHope Iām grasping that correctly.
nearly
I scrapped part 2, then
what I actually did was take the final three roles form your original part 1 (I moved the participant one down to make it consistent)
so if you look at the councilman role
Then where you had
$bbp_roles['my_custom_role6'] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster );
This will set a role called my-custom-role-6 to the name and capabilities, and if that role doesn’t exist will create it. WordPress generally doesn’t worry about whether something already exists, if it does it overwrites it, and if it doesn’t it creates it.
Now I could have simply changed ‘my_custom_roles_6 to bbp_keymaster, and it would have changed the existing role bbp_keymaster name and capabilities to what was in that line
But for reasons I won’t bore you with, it is better to call a function which gets that role
hence the new line before
$keymaster = bbp_get_keymaster_role() ;
Then you just use that $keymaster variable set in the line before
In reply to: Add Custom User Roleswell worth getting into php if you plan to do customisation, and yes have a look and see if you can work out what I did.
The key is that a function can only have one ‘return’ command. The WHOLE of the second functioj is one long return command (it starts with it). so I just amended the first one from of creating the final three roles, to calling up the existing roles and then overwriting them
Have fun, and come back with any queries – it was only two years ago that I wrote my first line of php code, and I only do this very part time!
In reply to: Show latest reply author nameoops, yes I should code it to go to that, I’ll do an amend !
In reply to: Add Custom User Rolesok, so the following combines what the first does with what the second does and achieves what you want
/* bbPress Custom Roles */ function add_custom_role( $bbp_roles ) { $bbp_roles['my_custom_role2'] = array( 'name' => 'Craftsman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role3'] = array( 'name' => 'Journeyman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role4'] = array( 'name' => 'Adept', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role5'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); $moderator = bbp_get_moderator_role() ; $bbp_roles[$moderator] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); $keymaster = bbp_get_keymaster_role() ; $bbp_roles[$keymaster] = array( 'name' => 'Advisor', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) // the same capabilities as keymaster ); $apprentice = bbp_get_participant_role() ; $bbp_roles[$apprentice] = array( 'name' => 'Apprentice', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); return $bbp_roles; } add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );
In reply to: Add Custom User Rolesok, quick answers and I’ll come back in a short while
a filter is a way to alter core code without having to change the core files. In effect if a function on the core is called ‘fred’ and writes the word ‘fred’ to your screen, then (as long as the function author has left the right code in there) you can write a filter to change ‘fred’ to ‘bert’ by adding a function (say a function called Bert) that writes ‘bert’ and then ‘add filter(‘fred’,’bert’) tells the system to ignore the fred function and put in the bert function, so it writes bert.
Now you have two filters which are overwriting what the core code in ‘bbp_get_dynamic_roles’ does, so in your original code you only had one filter so was fine.
In your second version, the first filter did the new roles, but the second filter to the same code overwrites the first (thus nullifying it) , so you were just left with the second one working.
bit like
original says write Fred
First filter says write Bert
Second filter says write HarrySo the code writes only Harry
BUT simply combining the two won’t work either as a filter has to return something and only one thing, so the code will quite as soon as it encounters a ‘return’ command.
Since the first half has ‘return $bbp_roles; ‘ it quits at that point and the second half isn’t exectuted.
So we need one function with one return and one filter (you actually can have more than one filter, but that’s more advanced!) – I’ll now go and look at it
see also
In reply to: Add Custom User Rolesthere are two filters in the second example, and the second one wipes out the first !
I tried your original code and it works fine, suggest you post it back and try it again, you may just have missed a character in the copy/paste.
In reply to: Sidebar not displaying with bbPress WP Tweaksok, try
https://wordpress.org/plugins/widget-logic/
use
is_bbpress()
where you want a widget displayed on bbpress pages and
!is_bbpress()
where you don’tIn reply to: Hidden Forums Questionsgreat – glad you’re fixed !
In reply to: Change author linkok, can you explain or give an example of what you mean by the website user url?
In reply to: Hidden Forums QuestionsDon’t know what you did before but use my plugin
In reply to: Importing a large vBulletin forum – in stages?In reply to: Please help, I have a couple of questions.ok,
1. not possible with bbpress as far as I know
2. only admin/keymasters get this priviledge
3. https://codex.buddypress.org/getting-started/installing-group-and-sitewide-forums/
4. If I understand the question correctly, normal users – that is the default ie participants can create topics and replies, but not forums or categories. If you meant something different then come back