Home › Forums › Community Forum › BP redirect not working for create Blog
Tagged: buddypress, create blog, redirect
This topic contains 48 replies, has 5 voices. Last updated by David Hunt 4 years, 4 months ago.
Page 2 Of Topic Replies
Author | Replies |
---|---|
Author | Replies |
Posted: Friday Aug 24th, 2012 at 10:58 am #22981 | |
|
|
Thanks Cristian. Let’s hope Jason can shed light! I won’t do anymore fiddling now until I hear from you. |
|
Posted: Saturday Aug 25th, 2012 at 6:31 am #23038 | |
|
|
Cool. Since you did customized this one a bit already, it’d still be good to do a clean test installation as I mentioned before, and test how a clean WP, BP, s2 behave with the setup you want. See if it’s the same as what you have in this customized installation, to rule out the customizations as the source of the problem, basically. |
|
Posted: Monday Aug 27th, 2012 at 8:50 am #23168 | |
|
|
Hi Cristian, for an S2 Level 1 member (when the membership level 1 blog allowance is set to 0) I get 404, not a redirect to options. for an S2 member (who has exceeded their membership level blog allowance) I get 404, not a redirect to options. I think the thing to do now is get a clear instruction as to what the software should do in these two scenarios. Thanks. David |
|
Posted: Monday Aug 27th, 2012 at 6:49 pm #23209 | |
|
|
Thanks for the heads up on this thread.My investigation of this installation turned up the following issues.
Correct. In the case of BuddyPress, the /create/ URL will result in a 404 error introduced by BuddyPress itself, whenever access to create blogs is not possible for the current user (for any reason). So if s2Member is configured NOT to allow blog creation access, BuddyPress will interpret this as a 404 error, because the page used to create a new blog does not even exist in the eyes of BuddyPress. As you mentioned, this is the expected behavior.
This would also be the expected behavior. s2Member will redirect the user to the Membership Options Page, because they do not have access (i.e. in this case there IS a URI Restriction implemented within s2Member), and therefore s2Member will intervene, by redirecting anyone without access. However, what’s NOT working properly, is the redirection URL itself, which in this case results in a 404 error. Upon a deeper investigation, I find this URL /membership-options/ no longer exists. It appears that you renamed this page to /options/ instead, which does work properly. I updated your s2Member General Options, and s2Member now has the right Membership Options Page (i.e. /options/, instead of /membership-options/). Please let me know if problems persist. |
|
Posted: Tuesday Aug 28th, 2012 at 7:43 am #23261 | |
|
|
Hi Jason, re: 2. With URI restriction /microsite/create/ – RESULT = S2 tries to redirect them with this url but fails to complete redirection. This was happening because the url length with /membership-options/ was exceeding Apache url length limit. I found that when I renamed this to /options/ I could get away with this BUT Cristian advised me to use the hack in mu http://paste.pagelines.com/3n4 That fixed left me with this final 404 issue, which is importent for me to resolve, to make sure users get sufficient feedback when they reach their membership blog allowance to upgrade their membership. 404’s: for an S2 Level 1 member (who has used their membership level blog allowance, if blog allowance set to 1) I get 404, not a redirect to options. Please let me know what you’d like me to do. I’m still not absolutely clear from your notes what the software should do in these use cases. Kind regards, David |
|
Posted: Friday Aug 31st, 2012 at 5:53 am #23663 | |
|
|
Hi Jason & Cristian, can you task me with a lead on making some progress on this. Kind regards, David |
|
Posted: Saturday Sep 1st, 2012 at 9:31 pm #23810 | |
|
|
Hi David, Can you try changing your Membership Options Page to a different page, saving, and then switching it back? s2Member caches it’s options, so the slug for the page may not have changed when Jason saved the options. Let me know if that fixes it. |
|
Posted: Sunday Sep 2nd, 2012 at 5:12 am #23839 | |
|
|
Hi Bruce, I’ve done as you’ve said, changed options page and saved, then set back o options and re saved. Still no change, I get /create/ if user hasn’t exceeded their allowance and 404 if they have. |
|
Posted: Sunday Sep 2nd, 2012 at 9:28 pm #23885 | |
|
|
Hi David, Sorry for the delayed response
Thanks for clearing that up. Jason explained this occurrence above, as a way of BuddyPress protecting its blog creation page. s2Member does not have any control of this, as s2Member only protects content based on Membership Levels / Custom Capabilities. If you’d like to change this, you’ll need to hook into BuddyPress. I believe that the functionality of the /create/ page is within buddypress/blogs/create.php. Does that answer your question? |
|
Posted: Monday Sep 3rd, 2012 at 4:19 am #23911 | |
|
|
ok, can I have some help here then. Is there a way to get S2 to throw up anything that I can catch or use to redirect members either to the S2 options page or a custom pro form to upgrade their S2 membership? It seems a bit crude that S2 promotes the support of ‘Maximum Blogs Allowed’, but user gets a 404 when the allocation is exceeded. How have other customers responded to this? Any leads appreciated. *I know I’ve mentioned this before, I’m getting this from debug:
|
|
Posted: Tuesday Sep 4th, 2012 at 6:54 pm #24081 | |
|
|
Hi David, Sorry for the delayI took another look at the BuddyPress code for the /create/ page, and it appears that it is actually controlled by the BuddyPress theme you are running. In the default BuddyPress theme, when the user accesses the create blog page, they are given the message “Site registration is currently disabled”. I would take a look into the file within your theme called /blogs/create.php, and run a search for 404. If there is a trigger for the 404 page, you can post the code here, within a reply to this post and we’ll see if we can fix it.
A lot of people would conditionally hide links to the registration page using something like
s2Member only controls the “On/Off switch” for the BuddyPress site creation functionality. Therefore, if your theme gives the user a 404 if it is off, then the same will happen when they run out of “credits” to create a site.
I’m going to look into this within the following day and see what might be happening here within s2Member’s code (I’m not familiar with this occurrence). If I cannot get you a resolution for this within the next 1-2 days I’ll contact Jason once again to get his opinion on it. Thanks for your patience. |
|
Posted: Tuesday Sep 4th, 2012 at 8:01 pm #24088 | |
|
|
Hi David From my last post:
Investigation Complete.From looking at the file /includes/classes/cache.inc.php, it appears that the variable I’m going to contact Jason about changing the code slightly within this file so that the above error does not show up within the debug, as it is not affecting anything. |
|
Posted: Wednesday Sep 5th, 2012 at 3:29 am #24124 | |
|
|
Hi Bruce, thanks for looking into this. Here’s my create php http://paste.pagelines.com/6co Let me know if you need more. Full access was provided with the original pro support contact on this thread. |
|
Posted: Wednesday Sep 5th, 2012 at 3:53 pm #24202 | |
|
|
Hi David, Thanks for the informationI have uploaded the following code to your website within an s2hacks.php file in /wp-content/mu-plugins/ I tested this on your site and it seems to be working correctly. Let me know if you have any issues.
For other users having this problem:
I will be creating a Knowledge Base Article on this within 1-2 weeks outlining ways to overcome BuddyPress’s 404 error here. If you have any further problems, please reply here. :) |
|
Posted: Wednesday Sep 5th, 2012 at 6:48 pm #24211 | |
|
|
Hi Bruce, Id tried to bite into the code using a redirect @line31 in create.php but didn’t have any success with wp_redirect( ‘/microsites/create’, 302 ); exit; OK, next step? |
|
Posted: Wednesday Sep 5th, 2012 at 8:32 pm #24227 | |
|
|
Hi David, Sorry, I had forgotten to re-upload the file. Should work now. |
|
Posted: Wednesday Sep 5th, 2012 at 8:55 pm #24234 | |
|
|
Hi Bruce, Fantastic, it works! While this is fresh in your mind, how easy is it to use/edit that snippet and grab the members existing S2 level, and then redirect to specific url or anchor, based on the pro form thats relevant for their requirements. I don’t see an immediate way for front end status to let a user know they are S2 Level 1 etc and they need XXX. I think this would create a better user experience if this can be done, eg. http://screencast.com/t/6MjJgZQM4U |
|
Posted: Wednesday Sep 5th, 2012 at 9:28 pm #24239 | |
|
|
Hi David, s2Member does pass variables as an array in the URL of the page when it has to redirect users to the Membership Options Page. However, it does require some PHP within your Membership Options Page to make use of these variables. You can find information on these variables within your Dashboard under s2Member->API / Scripting->Membership Options Page / Variables. Let me know if you need any help with setting something up. :) Another Thought:You may want to put a $_GET[] variable on the end of the URL the script I posted to be able to tell when a user is just directly accessing the Membership Options Page, and when they have been redirected through that script. |
|
Posted: Thursday Sep 6th, 2012 at 8:09 am #24303 | |
|
|
Hey Bruce, thanks for the heads up. So, I get we can use the S2 variables in an edited version of the redirect in our current hack. Can you take a moment to advise how I can edit options page, or other bespoke redirect page to facilitate the desired ‘land on specific’ S2 pro upgrade form. Does it simplify the issue if I use the hack to land on new bespoke pages, just with one necessary pro form for desired upgrade, rather than use the /opions/ page? |
|
Posted: Thursday Sep 6th, 2012 at 10:59 pm #24446 | |
|
|
Hi David,
I wrote a quick article on using the Membership Options Variables here with some sample code that you can use to get started. I’ll update it soon to add some detail to some more things that might help you, and other s2Member users using WordPress MultiSite.
That’s really up to you, but I would suggest just adding:
to the end of the redirect URL, which you could use within /options/ just the same as s2Member’s normal functionality. Doing the above would save time with the code on the Membership Options Page, but still wouldn’t let users know why they were redirected, which is what you’re trying to do, by what I understand. |
|
Posted: Friday Sep 7th, 2012 at 12:30 pm #24538 | |
|
|
Hi Bruce, thanks so much for these directions. To clarify, the ultimate desire would be to inform users why they’ve been directed away from the /create/ page to an upgrade form, so they know what’s going on. I’ll go and dig into your suggestions, please keep me updated if you have further insights. |
|
Posted: Friday Sep 7th, 2012 at 1:27 pm #24548 | |
|
|
Hi David,
I’ll definitely post back here when I have updated my KB article. If you’d like to redirect users to your specific form, you could do so through a PHP hack (using header(‘ Location: http://url-to-form/ ‘);exit();), OR through JavaScript on your Membership Options Page using the info I provided in the KB article. I’ll update the article to show how to do that as well. |
|
Posted: Friday Sep 7th, 2012 at 2:41 pm #24556 | |
|
|
great, I look forward to the kb. To create some consistency and not dupe pages, I’ve decided to go with two top level pages, using pro forms, which works beautifully for logged in and logged out/non members; s1>s2 http://domain.com/pro-registration/ I’ve nested that under the Pricing tab, so hopefully user will be familiar with the member levels and respective privileges. Nearly there. |
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.