Group Blog Links Redirect to Login Page
- This topic has 15 replies, 3 voices, and was last updated 9 months, 3 weeks ago by Paul Schacht.
-
AuthorPosts
-
February 24, 2024 at 6:30 pm #9209Paul SchachtParticipant
At https://sunygeneseoenglish.org, the “Blog” link in the left navigation of each group’s home page redirects to the main site’s login page (when logged out) or to the main site’s dashboard (when logged in, for a user with access to the main site’s dashboard).
The “Blog” link in every group’s left navigation has the form https://sunygeneseoenglish.org/groups/name-of-group/blog/
The blog sites themselves are subdomains: https://name-of-blog.sunygeneseoenglish.org
But the left navigation links should redirect to the subdomain URLs, right?
- This topic was modified 10 months ago by Paul Schacht.
- This topic was modified 10 months ago by Paul Schacht.
February 26, 2024 at 3:39 pm #9212Boone GorgesKeymasterHi Paul – It’s normal for the href attribute of the links to point to /groups/name-of-group/blog. But once you load that page, you ought to be redirected to the group blog’s home page, ie to name-of-blog.sunygeneseoenglish.org.
A few things to check:
– Go to Dashboard > Network Admin > Settings > GroupBlog Setup > Redirect. Ensure that ‘Redirect Enabled To:’ is set to ‘Home Page’.
– What is the privacy setting for the group blogs in question? Are you testing using a user account that has access to visit the site?February 26, 2024 at 7:13 pm #9213Paul SchachtParticipantThanks for the reply, Boone! Redirect is set as it should be under GroupBlog Setup. I’m seeing this behavior on blogs associated with public groups that anyone can join. A logged in user who’s a member of the group gets directed to the Dashboard of the main site, English @ SUNY Geneseo. Ditto for a logged in user who isn’t a member of the group. A user who isn’t logged in gets redirected to the main site landing page, https://sunygeneseoenglish.org
Any other settings I should look at?
Thanks again,
PaulAttachments:
You must be logged in to view attached files.February 27, 2024 at 4:21 pm #9215Boone GorgesKeymasterFor reference, here’s where the redirect happens: https://github.com/boonebgorges/bp-groupblog/blob/565b256ede1f2a8c89c480e78b97753d3257afbe/bp-groupblog.php#L1881
I suspect that
$blog_id
is incorrectly returning1
, and/orget_home_url()
is doing something strange.Have you by any chance updated BP to version 12.0+? You would have to have done this manually, overriding CBOX’s default management of the BuddyPress plugin.
@r-a-y Any thoughts about what might be triggering this redirect behavior? The fact that there *is* a redirect is correct, it’s just that the URL is wrong.February 27, 2024 at 8:11 pm #9217Paul SchachtParticipantI’m running BP 11.4.0 and letting CBOX manage my plugins. I’ve sometimes managed them independently in order to stay abreast of updates, but I knew from some of your messages in the GitHub repo that 12 has significant differences, so I’ve held back.
February 27, 2024 at 10:11 pm #9218RayKeymasterHi Paul,
I notice that if I attempt to visit a page that doesn’t exist on your site (https://sunygeneseoenglish.org/WHATEVER), the URL will redirect back to the homepage instead of landing on the 404 page. I’m guessing a plugin is causing this behavior, which in turn is affecting the groupblog redirect.
It’s possible that a plugin is responsible for this. Can you list the non-CBOX plugins you are using on your site?
February 27, 2024 at 10:37 pm #9219Paul SchachtParticipantHi Ray,
Plugins, in addition to CBOX and its bundled plugins, are
- Akismet
- BP Classic
- Classic Editor
- Collapse-o-Matic
- CommentPress Core
- Markup Markdown
- PDF Embedder
- Post Type Switcher
- WordFence
Thanks,
Paul- This reply was modified 9 months, 4 weeks ago by Paul Schacht.
- This reply was modified 9 months, 4 weeks ago by Paul Schacht.
February 28, 2024 at 2:54 am #9222RayKeymasterHi Paul,
WordFence could be the culprit. Can you try temporarily disabling WordFence and then trying to check the groupblog link?
February 28, 2024 at 8:01 am #9223Paul SchachtParticipantI deactivated WordFence, but the behavior persists. I think the general behavior you were observing earlier — “if I attempt to visit a page that doesn’t exist on your site (https://sunygeneseoenglish.org/WHATEVER), the URL will redirect back to the homepage instead of landing on the 404 page” — was caused by this line in wp-config.php:
<div>define('NOBLOGREDIRECT', 'http://sunygeneseoenglish.org');
</div>
<div>I commented out that line in hopes that it would solve the problem with the blog links, but it didn’t. Commenting it out does, however, cause requests for non-existent pages to bring up the “nothing found” page.</div>February 28, 2024 at 12:39 pm #9224RayKeymasterThe other plugins seem fine to me, but if you want, you can disable them one at a time to see if one of them might be causing the redirect.
Some other potential things to check: Do you have any 3rd-party plugins running on the groupblog that might be causing the redirect? What is the privacy option set to for the groupblog in question?
February 29, 2024 at 4:22 pm #9225Paul SchachtParticipantI’ve deactivated each plugin in turn (except CBOX), and none of the plugins appears to be the cause of the problem.
The problem happens with all groups, whether public or private. The “Blog” link in the left navigation for the group redirects to https://sunygeneseoenglish.org/wp-admin/
- This reply was modified 9 months, 3 weeks ago by Paul Schacht.
February 29, 2024 at 5:33 pm #9227RayKeymasterOn my local installation of CBOX with BP Groupblog enabled, I am not running into the groupblog redirect issue.
Like the
NOBLOGREDIRECT
line, do you have any other code snippets inwp-config.php
,wp-content/plugins/bp-custom.php
,wp-content/themes/cbox-child
, or inwp-content/mu-plugins
?If not and you feel adventurous, you can try some debugging to see if the groupblog redirect URL is what is expected. After this line in
bp-groupblog.php
, add the following debug statement:var_dump( $home_url ); die();
Then go to a sample groupblog URL like
https://sunygeneseoenglish.org/groups/digital-humanities/blog/
and see which URL is outputted in the browser. If it matches the groupblog URL, then BP Groupblog is not the culprit. If you are still getting redirected to the main site, then another piece of code is doing a redirect somewhere.March 3, 2024 at 8:09 am #9228Paul SchachtParticipantThanks, Ray. I debugged as you suggested, and indeed the URL that’s outputted to the browser is the URL for the blog e.g.,
https://dh.sunygeneseoenglish.org
so BP Groupblog is behaving as it should.
I’m not running any must-use plugins and don’t have a bp-custom.php file. I’m using a child theme but haven’t made any recent changes to it.
¯\_(ツ)_/¯
March 4, 2024 at 2:04 pm #9229Boone GorgesKeymasterVery peculiar. Paul, if you’re comfortable with it, you could try (temporarily) running this small redirect logger that I’ve written: https://gist.github.com/boonebgorges/83ad69a81052c5ce43001d7c7523a586 Put it in wp-content/mu-plugins/redirect-log.php. Then, trigger the redirect. You should see a redirect-log.txt file at wp-content/uploads/. Share the relevant entries with us here.
March 4, 2024 at 2:40 pm #9230RayKeymasterHi Paul,
Can you try the following code snippet? https://gist.github.com/r-a-y/bc390ceb5d1872044e05b3aed35431c1
Save to
/wp-content/mu-plugins/wpmu-subdomain-redirects.php
. WordPress, by default, has strict redirect rules and for some reason, does not allow subdomain redirects even on the same domain. The code snippet should bypass this restriction. Boone, we should probably add this to CBOX by default for subdomain network installs. -
AuthorPosts
- You must be logged in to reply to this topic.