surajitray
Forum Replies Created
-
for the broken link guys … 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
(string|boolean)
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 errorsolution ?
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 ) ) return; 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 …
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
(string|boolean)
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 errorsolution ?
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 ) ) return; 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 …
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
(string|boolean)
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 errorsolution ?
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 ) ) return; 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 …
Could this be related to the last buddypress upgrade ?
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.
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.
Forum: Plugins
In reply to: [BP Profile as Homepage] [Plugin: BP Profile as Homepage] for Buddypress 1.5You can use the following hack in your functions.php in your current theme folder. If there is no functions.php – create one and put the following code in it.
Be warned this is one of those hacks done with a machete – crude and has to be checked for compatibility after an upgrade. It works with stock WordPress 3.3.2 and Buddypress 1.5.5.
As an extra this function also replaces “Home” on the button with “My Profile”, as well as highlighting the same (using css classes). You can comment out those lines if you dont want this.
/[43 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]