How to restrict the profile generation / users / name / replies /
-
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!
-
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.
Nobody saw, not even the author himself.
I removed the themes and profiles, but replies cannot find the generation source ((ok, so you want no-one to see anything in profiles – yes?
Nearly. The author himself can still edit own profile.
But look lists of topics and answers is superfluous.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.phptransfer this to your pc and edit
and save
create a directory on your theme called ‘bbpress’
ie wp-content/themes/%your-theme-name%/bbpresswhere %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.phpbbPress 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.phptake out all the code between the 2 ‘do_action’ lines
That should get you there
Thank you very much Robin!
Already night for us, but I’ll be back tomorrow to say how it works.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 differentFully updated bbpress (removed homemade files) add advice change fils to child theme, – but nothing has changed again, user’ replies can be seen everyone.
I think we need to work on the content-single-reply.php file :))
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
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.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 /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' ); }
Sorry, it doesn’t work again.
This time I even changed the theme to default 21. It didn’t help too (.can you just define wat exactly you mean by ‘doesn’t work’ – ie I put this in here click that and this happens
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.Does this code work for you?
If so, I will look on my side myself.
You’ve done so much for me.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?
and is your site in english ?
just moment ๐
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.https://imhodom.ru/wp-content/uploads/2021/12/kak1.jpg
syntax
That is highlight values in red?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' ); }
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 addressesI 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! :))
- You must be logged in to reply to this topic.