Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to restrict the profile generation / users / name / replies /


  • neon67
    Participant

    @neon67

    Hello people!
    I bury the lists generation of all user replies profile via css and robots.txt. But it turns out – Google still looks. I would like to disallow broadcast domain.de/users/name/replies/.

    There is old bbPress Toolkit plugin for that…
    And how take same editing the bbpress file? Or functions.php filter? Tell me who knows. What file and what to remove, then would be moved to the child theme.

    Thanks!

Viewing 25 replies - 1 through 25 (of 28 total)

  • Robin W
    Moderator

    @robin-w

    so you want anyone to be able to see the users profile and topics created, but not replies created – yes ?

    and who can see this – eg no-one, logged in users, the users themselves etc.


    neon67
    Participant

    @neon67

    Nobody saw, not even the author himself.
    I removed the themes and profiles, but replies cannot find the generation source ((


    Robin W
    Moderator

    @robin-w

    ok, so you want no-one to see anything in profiles – yes?


    neon67
    Participant

    @neon67

    Nearly. The author himself can still edit own profile.
    But look lists of topics and answers is superfluous.


    Robin W
    Moderator

    @robin-w

    ok, so using this process for each of the following files in place of xxfilexx.php below

    find
    wp-content/plugins/bbpress/templates/default/bbpress/xxfilexx.php

    transfer this to your pc and edit

    and save

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/xxfilexx.php

    bbPress will now use this template instead of the original

    so template 1.

    \templates\default\bbpress\user-profile.php

    to remove lines 42 & 43 to tale out the counts if you wish.

    then template 2

    templates\default\bbpress\user-details.php

    take out lines 34-60

    then templates

    \templates\default\bbpress\user-topics-created.php
    \templates\default\bbpress\user-replies-created.php

    take out all the code between the 2 ‘do_action’ lines

    That should get you there


    neon67
    Participant

    @neon67

    Thank you very much Robin!
    Already night for us, but I’ll be back tomorrow to say how it works.


    neon67
    Participant

    @neon67

    Everything has been done exactly. The new files in the child theme have been assigned permissions 775. The cache has been cleared. But nothing has changed … I’m trying to understand.
    Perhaps my initiative in the past editing in changing files is the reason …
    Alternatively, redirect to 404 directory / forums / users / * name * / replies /.
    But how to do it – * name * is always different


    neon67
    Participant

    @neon67

    Fully updated bbpress (removed homemade files) add advice change fils to child theme, – but nothing has changed again, user’ replies can be seen everyone.


    neon67
    Participant

    @neon67

    I think we need to work on the content-single-reply.php file :))


    Robin W
    Moderator

    @robin-w

    This function will take all attempts to go to the replies page to whatever url you want

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /users/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') == FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') == FALSE) return ;
    	else wp_redirect( 'https://example.com/some/page' );
    }

    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

    Code Snippets


    neon67
    Participant

    @neon67

    Thanks for your help, take the time – I really appreciate it! But … again nothing happens.

    Have a clean new bbpress, latest version of WordPress, own Ngnix, cleared the cache, checked for syntax errors.
    Little confused https://stackoverflow.com/questions/23614011/if-strpos-serverrequest-uri-true-doesnt-work/23614083 and whether the equation is correct. I can’t figure it out myself.


    neon67
    Participant

    @neon67

    Further study of the code showed that works for all addresses where /users/.
    It closes the profile / forums / users / name /
    And doesn’t work for / forums / users / name / replies /


    Robin W
    Moderator

    @robin-w

    ok try this

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /users/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://example.com/some/page' );
    }

    neon67
    Participant

    @neon67

    Sorry, it doesn’t work again.
    This time I even changed the theme to default 21. It didn’t help too (.


    Robin W
    Moderator

    @robin-w

    can you just define wat exactly you mean by ‘doesn’t work’ – ie I put this in here click that and this happens


    neon67
    Participant

    @neon67

    I paste the code down before the sign ?>
    The first code worked – redirected the address with the word ‘users’.
    The second code doesn’t make any changes by the look.


    neon67
    Participant

    @neon67

    Does this code work for you?
    If so, I will look on my side myself.
    You’ve done so much for me.


    Robin W
    Moderator

    @robin-w

    ok, so if the replies link goes to

    https://mysite.com/forums/user/admin/replies/

    then this

    add_action( 'bbp_template_redirect', 'neon_check_replies');
    
    function neon_check_replies(){
    	//only execute if the url contains both /user/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/user/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://mysite/home' );
    }

    will send anyone clicking the link to the site home page

    what does it do for you?


    Robin W
    Moderator

    @robin-w

    and is your site in english ?


    neon67
    Participant

    @neon67

    just moment ๐Ÿ™‚


    neon67
    Participant

    @neon67

    I pasted the code, but …

    it should look like this
    https://imhodom.ru/forums/users/ox/topics/ – lock ะพr redirect…
    but it doesn’t work like want (that’s want to fix)
    https://imhodom.ru/forums/users/ox/replies/

    Please delete this message as you see.
    The last advice code is inserted and works.


    neon67
    Participant

    @neon67

    https://imhodom.ru/wp-content/uploads/2021/12/kak1.jpg
    syntax
    That is highlight values in red?


    Robin W
    Moderator

    @robin-w

    ok, lets try agian and see if we can get there.

    Your site has

    https://imhodom.ru/forums/users/ox/replies/

    so we need to check for ‘/users/’ and ‘/replies/’

    and we’ll try and up the priority so that other code does not overwrite

    add_action( 'bbp_template_redirect', 'neon_check_replies', 100);
    
    function neon_check_replies(){
    	//only execute if the url contains both /user/ and /replies/, so test for this first
    	if (strpos($_SERVER['REQUEST_URI'], '/users/') !== FALSE  && strpos($_SERVER['REQUEST_URI'], '/replies/') !== FALSE) wp_redirect( 'https://imhodom.ru/forums' );
    }
    

    neon67
    Participant

    @neon67

    Happy new year 2022! we have already arrived.
    but the code doesn’t work again ๐Ÿ™‚
    now your new code is on air .. but .. you can go to the same addresses


    neon67
    Participant

    @neon67

    I think we can celebrate the coming date change. Our programmer went skiing, but he will be back in 2 days and we can probably make a redirect ๐Ÿ™‚
    Thank you for your great participation – Happy New Year Robin! :))

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