BuddyPress Group Email Subscription
[resolved] white screen on email options (10 posts)

  1. Christine
    Posted 4 years ago #

    Hi there

    I just wanted to report a bug I've just come across.

    I'm getting a white screen of death: after going into a group and going to email options and selecting an option, I press save settings and it takes me to a white screen.

    I hit the back button and went to the home page of the group and it had saved my options ok, but the white screen is a bit weird.
    What could be causing this?


  2. bruce-s
    Posted 4 years ago #

    Same problem here...

    I'm using Custom Community Theme

  3. surajitray
    Posted 4 years ago #

    Yeah having the same problem...

    I get a page not found on saving the settings

    whats more after the error , if you just press enter on the same URL the confirmation appears saying that the settings were saved.

    This is really weird. It seems after changing the setting the script dies somewhere.

  4. surajitray
    Posted 4 years ago #

    ok found the problem

    it is in the function (file : bp-activity-subscription-functions.php)
    function ass_update_group_subscribe_settings()

    has a line at the end of the function which goes
    bp_core_redirect( wp_get_referer() );

    now the form for the settings is posted to the same url
    BUT !!! as per docs of wp_get_referer()

    Return Values
    False on failure. Referer URL on success. If page "refered" (form posted) to itself, returns false (because $_SERVER['HTTP_REFERER'] == $_REQUEST['_wp_http_referer'])

    so the wp_get_referer() returns false !
    which means it results in a page not found error

    solution ?

    put this in your functions.php
    (dont have one ? find how to get one in your theme ...)

    // update the users' notification settings
    function pain_in_the_ass_update_group_subscribe_settings() {
            global $bp;
            if ( bp_is_groups_component() && bp_is_current_action( 'notifications' ) ) {
                    // If the edit form has been submitted, save the edited details
                    if ( isset( $_POST['ass-save'] ) ) {
                            //if ( !wp_verify_nonce( $nonce, 'ass_subscribe' ) ) die( 'A Security check failed' );
                            $user_id = bp_loggedin_user_id();
                            $group_id = $_POST[ 'ass_group_id' ];
                            $action = $_POST[ 'ass_group_subscribe' ];
                            if ( !groups_is_user_member( $user_id, $group_id ) )
                            ass_group_subscription( $action, $user_id, $group_id ); // save the settings
                            bp_core_add_message( sprintf( __( 'Your email notifications are set to %s for this group.', 'bp-ass' ), ass_subscribe_translate( $action ) ) );
                            bp_core_redirect( $_SERVER['HTTP_REFERER'] );
    remove_action( 'bp_actions', 'ass_update_group_subscribe_settings' );
    add_action( 'bp_actions', 'pain_in_the_ass_update_group_subscribe_settings' );

    Voila ... the pain is gone ...

  5. bruce-s
    Posted 4 years ago #

    Excellent - thank you - will test and get back - do you think this solution will find it's way into the plugin too?

  6. bruce-s
    Posted 4 years ago #

    Works fine for me...

  7. Christine
    Posted 4 years ago #

    Cool, I'll have a go with that code thanks :)

  8. Christine
    Posted 4 years ago #

    Works thanks.

  9. Boone Gorges
    Plugin Author

    Posted 4 years ago #

    Which version of the plugin are you using? The latest version has a fix for this (here's the changeset: https://github.com/boonebgorges/buddypress-group-email-subscription/commit/8b7dcbfdd8672fec9f00fd94d940b7d391fb68db)

  10. Christine
    Posted 4 years ago #

    I've updated to the latest version. It works fine now- thank you :-)

    I'll get rid of the function then.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • BuddyPress Group Email Subscription
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic