Skip to:
Content
Pages
Categories
Search
Top
Bottom

Change Title of Forum Index page?

  • @valarcher

    Participant

    Hi – I’m trying to change the title of my forum index page. I tried item 3 method 2 at:

    Step by step guide to setting up a bbPress forum – Part 1


    — saving my index page as /members (not /forums) as per WP settings, and then tried to give members page in wordpress the title “Private Forums” (instead of title Members). It displays as “Private Forums” (not “Members”) in the breadcrumb. But still on main index page, it displays only the title “Forums.”

    I’m using the shortcode [bbp-forum-index] on /members page as I have text above and below it.

    What can I add to functions.php that will force that index page to display the title “Private Forums”?

    Thank you!

Viewing 16 replies - 1 through 16 (of 16 total)
  • @robin-w

    Moderator

    hmm.. I’d suspect maybe a theme issue – some themes will intercept what they see as a ‘archive’page and allocate a title to it.

    what theme are you using?

    @valarcher

    Participant

    Hi Robin – I’m using astra, it’s id=”post-9486″ and
    <h1 class=”page-title ast-archive-title”>Forums</h1>

    Is there a way in functions.php to tell astra to display that title as “Private Forums”?

    While I’ve got your attention πŸ™‚ is there a way in functions.php to tell everything in [bbp-forum-index] to be:
    {width:100%;}

    I need my blog archives set to 3-col but Astra treats blog and forum archives as the same, so to get forum index to display full-width, I have to set my blog archives to 1-column in Astra settings.

    Please could you give me the php for functions.php that will display [bbp-forum-index] as width:100% so it over-rides the 3-column setting I need in astra for blog archives?

    @robin-w

    Moderator

    so for your first, try this

    add_filter( 'get_the_archive_title', 'rew_amend_forums' , 10 , 3) ;
    
    function rew_amend_forums ($title, $original_title, $prefix ) {
    	if ($title == 'Forums') $title = 'Private Forums' ;
    return $title ;
    }

    for your second, this is really one for Astra – I could spend many hours looking for an answer is their code.

    but based on your previous post you could try

    #bbpress-forums {width:100%;}

    @valarcher

    Participant

    Hi Robin – thanks million for renaming title. That php works perfectly. Sadly the other problem of 1/3-col doesn’t work addressing #bbpress-forums. It works if I target the entire page, then every forum title like this:
    #post-9486,#bbp-forum-9475,#bbp-forum-9473,etc {width:100%;}
    but the moderator doesn’t have access to css so won’t be able to add every forum to css when she creates it.

    I’ll carry on hounding astra for solution. Otherwise worst case scenario I just set blog archives to 1 column.

    While I have you… your code here:
    /** bbPress: add description under forum titles
    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/ */

    function rw_singleforum_description() {
      echo '<div class="bbp-forumpage-content">';
      echo bbp_forum_content();
      echo '</div>';
    }
    add_action( 'bbp_template_before_single_forum' , 'rw_singleforum_description');

    You have the first echo as “bbp-forum-content” but by changing it to “forumpage-content”, we’re able to target the description on index page and description on forum page separately in css, eg. on forum pages I have it red bold and centered, whereas on index page I have it in regular left-aligned text.

    Thanks million for all the work you put into the codex! I’m not keen on installing plugins such as your style pack, so codex is really helpful finding just the php I need.

    Do you perhaps have any solution to this code? I’m trying to grey out the user’s email on their profile page so they can’t update it. But I need users to update other info like website and bio. However with code below, if I test writing words in bio (as a logged in participator, not as keymaster) and try saving it, I get “Error: Please enter an email address.” I can see the email greyed out there.

    Do you know a way to fix it so ONLY the email and role can NOT be changed (although role does not even display on a participant user’s page) and everything else can be edited? (except for username of course)

    /** bbPress/WP: prevents subscriber from changing email (greyed out)
    https://www.role-editor.com/hide-disable-wordpress-user-profile-fields/ */

    add_action('admin_init', 'user_profile_fields_disable');
    function user_profile_fields_disable() {
    global $pagenow;
    // apply only to user profile or user edit pages
    if ($pagenow!=='profile.php' && $pagenow!=='user-edit.php') {
    return;
    }
    // do not change anything for the administrator
    if (current_user_can('administrator')) {
    return;
    }
    add_action( 'admin_footer', 'user_profile_fields_disable_js' );
    }
    /**
    * Disables selected fields in WP Admin user profile (profile.php, user-edit.php)
    */
    function user_profile_fields_disable_js() {
    ?>
    <script>
    jQuery(document).ready( function($) {
    var fields_to_disable = ['email', 'role'];
    for(i=0; i<fields_to_disable.length; i++) {
    if ( $('#'+ fields_to_disable[i]).length ) {
    $('#'+ fields_to_disable[i]).attr("disabled", "disabled");
    }
    }
    });
    </script>
    <?php
    }

    I know nothing about php – other than simple stuff like seeing I can change forum-content to forumpage-content!

    @valarcher

    Participant

    ignore this reply – don’t know how to delete it!

    @robin-w

    Moderator

    I will, presume you found the ‘save’ action

    @valarcher

    Participant

    Hi Robin – do you perhaps have any solution to that code? I’m trying to grey out the user’s email on their profile page so they can see it but not be able to update it (same as username). But I need users to update other info like website and bio. That code above does not allow *any* edits to profile page. So my users are unable to write anything into their bio if I use that code.

    @robin-w

    Moderator

    so is this wordpress profile or bbpress profile- in essence give me the url of your profile page

    @robin-w

    Moderator

    @valarcher

    Participant

    >wordpress profile or bbpress profile ?? There’s a bbpress profile? When I installed bbpress into astra wordpress theme, it displays the normal wordpress profile page when a person clicks on their name in the upper right, e.g. I added you as a forum participant:

    login at: https://greensmoothie.com/forums

    It’s that email I’d like to prevent users from changing.

    Where’s the bbpress profile?

    @robin-w

    Moderator

    that is the wordpress profile.

    so you will fix that part by

    Profile & Dashboard fields [Modify/Disable/Remove]

    There is also a bbpress profile, but you are using the astra theme, and there is a bug which astra know about which stops it working – it just goes to a page with a permanent loop

    https://wordpress.org/support/topic/bbpress-user-profile-broken-on-latest-update/

    you get to a bbpress profile by clicking the username in the forums.

    You can turn this off using

    bbp style pack

    once activated go to

    dashboard>settings>bbp style pack>Profile

    @valarcher

    Participant

    oh dear I was hoping not to use any plugins. I prefer just to add to functions.php but everything I’ve tested on this page so far, does not work: https://wordpress.stackexchange.com/questions/11717/prevent-users-from-changing-their-email-address.

    Astra has promised they’ll fix that bug with their next upgrade but then that would mean installing two plugins, so I’ll give up at this point. I’ll just remind users not to change their email.

    @robin-w

    Moderator

    ok, that is of course your choice, not sure why you are against plugins though?

    @valarcher

    Participant

    I believe they slow down site loading, and often plugins are no longer supported with wordpress upgrades, where php in functions.php works forever so far in my experience πŸ™‚

    @robin-w

    Moderator

    plugins rarely make any difference to site performance, servers are too fast nowadays. But of course it is individual choice, and I have no desire to look judgmental.

    Anyway hope you are all ok now, and enjoy your site πŸ™‚

    @valarcher

    Participant

    yes thanks Robin for your incredible help — couldn’t have done it without you!

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar