Robin W (@robin-w)

Forum Replies Created

Viewing 25 replies - 7,701 through 7,725 (of 10,839 total)
  • In reply to: forum martinique

    Robin W
    Moderator

    @robin-w


    Robin W
    Moderator

    @robin-w

    the 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


    Robin W
    Moderator

    @robin-w

    now amended and in Version 1.9 together with hide avatar and shorten freshness options

    In reply to: Add Custom User Roles

    Robin W
    Moderator

    @robin-w

    šŸ™‚

    In reply to: Add Custom User Roles

    Robin W
    Moderator

    @robin-w

    if 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 Roles

    Robin W
    Moderator

    @robin-w

    it’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 Roles

    Robin W
    Moderator

    @robin-w

    don’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 Roles

    Robin W
    Moderator

    @robin-w

    Would 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 Roles

    Robin W
    Moderator

    @robin-w

    Hope 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 Roles

    Robin W
    Moderator

    @robin-w

    well 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!


    Robin W
    Moderator

    @robin-w

    oops, yes I should code it to go to that, I’ll do an amend !

    In reply to: Add Custom User Roles

    Robin W
    Moderator

    @robin-w

    ok, 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 Roles

    Robin W
    Moderator

    @robin-w

    ok, 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 Harry

    So 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

    Step by step guide to setting up a bbPress forum – part 5

    In reply to: Add Custom User Roles

    Robin W
    Moderator

    @robin-w

    there 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.


    Robin W
    Moderator

    @robin-w

    ok, 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’t


    Robin W
    Moderator

    @robin-w

    great – glad you’re fixed !

    In reply to: Change author link

    Robin W
    Moderator

    @robin-w

    ok, can you explain or give an example of what you mean by the website user url?


    Robin W
    Moderator

    @robin-w

    Don’t know what you did before but use my plugin

    https://wordpress.org/plugins/bbp-private-groups/


    Robin W
    Moderator

    @robin-w


    Robin W
    Moderator

    @robin-w

    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


    Robin W
    Moderator

    @robin-w

    since it is a wordpress role that would let you see the users, then the subscriber role will prevent you doing this.

    I think it would be a useful thing to have but don’t know anything that currently does this, sorry !

    In reply to: Change author link

    Robin W
    Moderator

    @robin-w

    Can I just clarify what you are after

    I presume you are allowing anonymous posting?

    ā€“ if the author is not anonymous, use the user_url
    ā€“ else use the comment website url

    so for the first – as it is now?
    and for the second, can you give an example of what you want it to link to (and what it does now to save me having to alter my site to find out!)


    Robin W
    Moderator

    @robin-w

    This could be an issue with your rewrite rules. To fix this try resetting your permalinks. In your WordPress Administration Screens navigate to Settings>Permalinks, select a different permalink structure and save. Then select your preferred permalink structure and save again.

    In reply to: 404 Page Not Found

    Robin W
    Moderator

    @robin-w

    try resetting your permalinks

    In your WordPress Administration Screens navigate to Settings>Permalinks, select a different permalink structure and save. Then select your preferred permalink structure and save again.

    In reply to: Change forum username

    Robin W
    Moderator

    @robin-w

    this is a buddypress question I reckon – try their forum

Viewing 25 replies - 7,701 through 7,725 (of 10,839 total)