• ResolvedPlugin Contributor jomo

    (@jonathanmoorebcsorg)


    Sorry this does still occur after the last update: if you attempt to open a buddypress url when not logged in, or more commonly, the login has timed out, in this case you are attempting to refresh or navigate at eg https://mysite.com/groups/mygroup you then get:

    Notice: Undefined offset: 0 in /wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php on line 29

    Warning: Cannot modify header information – headers already sent by (output started at /wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php:29) in /wp-includes/pluggable.php on line 1179

    (sorry can’t reopen previous call)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor jomo

    (@jonathanmoorebcsorg)

    A bit more specific, this only happens for the home url of the group.

    See the BuddyPress codex:
    https://codex.buddypress.org/developer/the-bp-global/

    $bp->action_variables array
    Action variables are all the remaining sections of the URL after $bp->current_action. Each section (chunks of the URL between forward slashes) become an item in the array. For example the URL https://example.org/members/andy/groups/my-groups/leave/15 the values leave and 15 would each be items in the action_variables array.

    So where the url is the root of the group then action_variables will be intentionally empty so this code can be expected to fail.

    Plugin Contributor jomo

    (@jonathanmoorebcsorg)

    apart from a try block, a more explicit check avoids the problem:

    if ( $bp->current_action == 'feed' ){
    	$isBuddyPressFeed = true;
    }elseif (count($bp->action_variables)>0){
    	if ($bp->action_variables[0] == 'feed'){
    		$isBuddyPressFeed = true;
    	}
    }

    (I write it out longhand because I feel it is clearer)

    However I’m not sure whether this feed check is that useful at all, for example with the feed check enabled, if you try a url like https://mysite/groups/mygroup/feed
    if you are not logged in you get the results like:

    <b>Notice</b>: Undefined index: PHP_AUTH_USER in <b>/home/inkston/public_anglochina/wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php</b> on line <b>75</b><br />
    <br />
    <b>Notice</b>: Undefined index: PHP_AUTH_PW in <b>/home/inkston/public_anglochina/wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php</b> on line <b>76</b><br />
    <br />
    <b>Warning</b>: Cannot modify header information – headers already sent by (output started at /home/inkston/public_anglochina/wp-includes/class-wp-query.php:3884) in <b>/home/inkston/public_anglochina/wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php</b> on line <b>81</b><br />
    <br />
    <b>Warning</b>: Cannot modify header information – headers already sent by (output started at /home/inkston/public_anglochina/wp-includes/class-wp-query.php:3884) in <b>/home/inkston/public_anglochina/wp-content/plugins/lh-private-buddypress/lh-private-buddypress.php</b> on line <b>82</b><br />
    <h2>You need to be logged in to view this feed!</h2>

    I’m not sure this is more useful than not having the check

    Plugin Author shawfactor

    (@shawfactor)

    Howdy, Ive added these changes, you are right again, works for me but maybe test it for yourself

    pete

    Plugin Author shawfactor

    (@shawfactor)

    I’m hoing to resolve this as I am pretyy sure it is fixed

    any issues please let me know

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Undefined offset: 0 in /wp-content/plugins/lh-private-buddypress/lh-private-budd’ is closed to new replies.