Notice: Trying to get property of non-object in userpoints_flag_flag() (line 145

Comments

Leeteq’s picture

What is the status here, does it work only with Flag 1.x, and not with Flag 3.x or 2.x?

Tim Williams Scavenger’s picture

Issue summary: View changes

@vishy_singhal It's just a notice, not even a warning. Nothing to worry about and yes, it works with Flag 2.x & 3.x.

Anybody’s picture

Status: Active » Postponed (maintainer needs more info)

@Issue author: Please check out the 7.x-1.x-dev version. It's currently hidden on the module page. If the problem still exits, please tell us a bit more about the problem.

bdlangton’s picture

I get the same issue dealing with Flag 3.9. The problem is that this module implements hook_flag() as:

function userpoints_flag_flag($action, $flag, $content_id, $account) {

While the flag module defines hook_flag_flag() as:

/**
 * Act on an object being flagged.
 *
 * @param flag_flag $flag
 *  The flag object.
 * @param int $entity_id
 *  The id of the entity the flag is on.
 * @param $account
 *  The user account performing the action.
 * @param $flagging_id
 *  The flagging entity.
 */
function hook_flag_flag($flag, $entity_id, $account, $flagging) {

}

This is actually quite strange, as your module implements hook_flag() which doesn't exist anymore, yet it is being called. I wonder if since 'userpoints' module is enabled it is taking your function as if the 'userpoints' module is implementing hook_flag_flag(). Either way, hook_flag() doesn't exist, so this function would need updated to properly implement hook_flag_flag(), and also implement hook_flag_unflag().

bdlangton’s picture

Status: Postponed (maintainer needs more info) » Active
kreynen’s picture

Anytime I read something like "as your module implements" I want to flip a table. This code is licensed as GPL and shared on Drupal.org so that anyone else can continue development.

This is our module. Anyone who wants to contribute can make a request to be added as a co-maintainer. I scratched NAR's itch and moved on. @Anybody made the request 2+ years ago and made the initial changes to be compatible with the 3.x branch of Flag.

Obviously improvements continue to be made to both userpoints and flag. I'm happy to add anyone who can demonstrate they have the technical skills to improve the project as a co-maintainer and turn the project ownership over to any co-maintainer who shows they will manage the project well.

bdlangton’s picture

Excuse me for using a word that you don't like. I understand that it's open source and anyone can contribute. I was running into the same problem as the original poster and the issue wasn't explained so I did that. I would be more than happy to dig deeper and provide a patch when I have time. I didn't have time to dig deeper when I posted but wanted to get information out there for anyone's (including mine) reference.

bdlangton’s picture

This is fixed in 7.x-3.0-alpha1 so I'm not sure that it needs to be addressed here.