Show Sidebar Log in
Commons In A Box Logo
  • Home
  • About
    • Project Team
    • Logos and Graphics
  • Showcase
    • CBOX Classic Showcase
    • CBOX OpenLab Showcase
  • Demo
  • Get Started
  • Documentation
    • Technical Guide
    • CBOX Classic Guide
    • CBOX OpenLab Guide
  • Support Forums
    • CBOX Classic
    • CBOX OpenLab
    • Developers Forum
  • News

Group Admins

  • Profile picture of Scott Voth

CBOX Classic Support

Public Group active 3 months, 4 weeks ago

This group provides support for Commons In A Box Classic, our original software for community-building. Register for an account or log in to commonsinabox.org, then join the group and post your question here.

Group Blog Links Redirect to Login Page

  • This topic has 15 replies, 3 voices, and was last updated 1 year, 2 months ago by Paul Schacht.
Viewing 15 posts - 1 through 15 (of 16 total)
1 2 →
  • Author
    Posts
  • February 24, 2024 at 6:30 pm #9209
    Paul Schacht
    Participant

    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 1 year, 2 months ago by Paul Schacht.
    • This topic was modified 1 year, 2 months ago by Paul Schacht.
    February 26, 2024 at 3:39 pm #9212
    Boone Gorges
    Keymaster

    Hi 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 #9213
    Paul Schacht
    Participant

    Thanks 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,
    Paul

    Attachments:
    You must be logged in to view attached files.
    February 27, 2024 at 4:21 pm #9215
    Boone Gorges
    Keymaster

    For 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 returning 1, and/or get_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 #9217
    Paul Schacht
    Participant

    I’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 #9218
    Ray
    Keymaster

    Hi 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 #9219
    Paul Schacht
    Participant

    Hi 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 1 year, 2 months ago by Paul Schacht.
    • This reply was modified 1 year, 2 months ago by Paul Schacht.
    February 28, 2024 at 2:54 am #9222
    Ray
    Keymaster

    Hi 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 #9223
    Paul Schacht
    Participant

    I 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 #9224
    Ray
    Keymaster

    The 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 #9225
    Paul Schacht
    Participant

    I’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 1 year, 2 months ago by Paul Schacht.
    February 29, 2024 at 5:33 pm #9227
    Ray
    Keymaster

    On 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 in wp-config.php, wp-content/plugins/bp-custom.php, wp-content/themes/cbox-child, or in wp-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 #9228
    Paul Schacht
    Participant

    Thanks, 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 #9229
    Boone Gorges
    Keymaster

    Very 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 #9230
    Ray
    Keymaster

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

  • Author
    Posts
Viewing 15 posts - 1 through 15 (of 16 total)
1 2 →
  • You must be logged in to reply to this topic.
Log In
Group logo of CBOX Classic Support
  • Home
  • Forum
  • Announcements
  • Docs
  • Members 287
  • Send Invites

Groups

Newest | Active | Popular | Alphabetical
  • Group logo of CBOX Classic Support
    CBOX Classic Support
    287 members
  • Group logo of CBOX Pioneers
    CBOX Pioneers
    71 members
  • Group logo of CBOX Developers
    CBOX Developers
    40 members
  • Group logo of CBOX OpenLab Support
    CBOX OpenLab Support
    22 members
  • Group logo of CBOX-OL Testing Partners
    CBOX-OL Testing Partners
    12 members

CBOX has its roots in the CUNY Academic Commons, which in turn was made possible through funding from The City University of New York itself.

CUNY Logo

CUNY Academic Commons Logo

City Tech logo

The Commons In A Box was made possible through the generous support of the Alfred P. Sloan Foundation.

Alfred P. Sloan Foundation Logo

NEH Logo

The CUNY Graduate Center has directly contributed to the CUNY Academic Commons, housing the project since its inception, and has contributed to CBOX through its GC Digital Initiatives.

CUNY Graduate Center Logo

CUNY Graduate Center Digital Initiatives Logo

Powered by Commons In A Box
css.php
Skip to toolbar
  • About WordPress
    • WordPress.org
    • Documentation
    • Learn WordPress
    • Support
    • Feedback
  • Log In
  • Register