Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Error in groups.class.php on line 43 in new installation, BP 1.63 #97

Open
nikushev opened this Issue Jan 25, 2013 · 11 comments

Comments

Projects
None yet
5 participants

On a new installation I receive "Warning: Creating default object from empty value in E:\Etc\www\wp-content\plugins\buddypress-courseware\groups\groups.class.php on line 43"

I receive the same error in courses.class.php on line 347 on course description page.

Media upload and media gallery stop working after courseware activation as well - after deactivation work fine.

The problem is present in the support tab on plugin download - several people are complaining about it.

WP 3.5, BP 1.63, Courseware 0.9.7, PHP 5.4, MySQL 5, Apache, windows 7, localhost

Owner

stas commented Jan 26, 2013

Thank you for the report, I'll take a look asap.

Further examination of the problem proved it to be php 5.4 connected. I've been able to fix groups.class.php by adding:

if ( !isset( $bp->courseware ) || !is_object($bp->courseware)) {
$bp->courseware = new stdClass;
}

just before line 43.

Image upload and media gallery started working, but I still haven't find a way to fix courses.class.php line 347 (on course description page):

$old_course->terms = wp_get_object_terms($old_course->ID, 'group_id' );

and a nasty error "BuddyPress Courseware Error! Cheatin' Uh?" appears after clicking course description inside courseware tab. The only way to reach it without that error is by clicking the "Edit course" button.

shojil commented Apr 6, 2013

hi nikushev from your above mentioned condition I found my solution I was also facing the same problem in groups.class.php at line 43 now the error is fixed and my site is working fine.

This was referenced Apr 6, 2013

Please shojil tell us how do you fix it !
I have the same message for the line 43 and 44
Warning: Creating default object from empty value in /wp-content/plugins/buddypress-courseware/groups/groups.class.php on line 43

Warning: Creating default object from empty value in /wp-content/plugins/buddypress-courseware/groups/groups.class.php on line 44
Thank you

shojil commented Sep 11, 2013

I use an if condition now there will be these lines

    global $bp;
    $bp->courseware->id = 'courseware';
    $bp->courseware->slug = 'courseware';
    $bp->active_components[$bp->courseware->slug] = $bp->courseware->id;

I used put this condition after global $bp;

    if ( !isset( $bp->courseware ) || !is_object($bp->courseware)) {

$bp->courseware = new stdClass;
}

then it get fixed

On Wed, Sep 11, 2013 at 2:55 PM, vespa7681 notifications@github.com wrote:

Please shojil tell us how do you fix it !
I have the same message for the line 43 and 44
Warning: Creating default object from empty value in
/wp-content/plugins/buddypress-courseware/groups/groups.class.php on line 43

Warning: Creating default object from empty value in
/wp-content/plugins/buddypress-courseware/groups/groups.class.php on line 44
Thank you


Reply to this email directly or view it on GitHubhttps://github.com/Courseware/buddypress-courseware/issues/97#issuecomment-24225355
.

Thank you but can you tell me in which file should I add this and at which line. I'm not an expert, but with more details it should be good. Thank you again.

shojil commented Sep 11, 2013

It is groups.class.php in this path

plugins/buddypress-courceware/groups/group.class.php it is link 44

u will fine these lines

global $bp;
$bp->courseware->id = 'courseware';
$bp->courseware->slug = 'courseware';
$bp->active_components[$bp->courseware->slug] = $bp->courseware->id;

put the if condition after global $bp;

if ( !isset( $bp->courseware ) || !is_object($bp->courseware)) {
$bp->courseware = new stdClass;
}

On Wed, Sep 11, 2013 at 3:21 PM, vespa7681 notifications@github.com wrote:

Thank you but can you tell me in which file should I add this and at which
line. I'm not an expert, but with more details it should be good. Thank you
again.


Reply to this email directly or view it on GitHubhttps://github.com/Courseware/buddypress-courseware/issues/97#issuecomment-24227009
.

Thanks a lot, the problem is fixed now!

On Wednesday, September 11, 2013, shojil wrote:

It is groups.class.php in this path

plugins/buddypress-courceware/groups/group.class.php it is link 44

u will fine these lines

global $bp;
$bp->courseware->id = 'courseware';
$bp->courseware->slug = 'courseware';
$bp->active_components[$bp->courseware->slug] = $bp->courseware->id;

put the if condition after global $bp;

if ( !isset( $bp->courseware ) || !is_object($bp->courseware)) {
$bp->courseware = new stdClass;
}

On Wed, Sep 11, 2013 at 3:21 PM, vespa7681 notifications@github.com
wrote:

Thank you but can you tell me in which file should I add this and at
which
line. I'm not an expert, but with more details it should be good. Thank
you
again.


Reply to this email directly or view it on GitHub<
https://github.com/Courseware/buddypress-courseware/issues/97#issuecomment-24227009>

.


Reply to this email directly or view it on GitHubhttps://github.com/Courseware/buddypress-courseware/issues/97#issuecomment-24243571
.

Thank you so much! That fixed it immediately

shojil commented Dec 23, 2013

wellcome :)

On Mon, Dec 23, 2013 at 1:32 AM, zaqstavano notifications@github.comwrote:

Thank you so much! That fixed it immediately


Reply to this email directly or view it on GitHubhttps://github.com/Courseware/buddypress-courseware/issues/97#issuecomment-31095224
.

Owner

stas commented Dec 23, 2013

Guys, @shojil, anyone care to prepare a patch/PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment