In follow-up to the discussion at http://drupal.org/node/869770, I've created this issue so that we can work on the Drupal 7 port of userpoints_flag. We're creating specific issue threads for sub-modules that integrate with other contrib modules.

--Ben

Comments

hadsie’s picture

Just curious if any work has begun on this yet. I'll probably take a stab at it.

- Scott

BenK’s picture

No work has begun on this yet, so your help would be very welcomed! We've been working more recently on the D7 port of Userpoints itself. If you ever need to discuss you can often find Berdir or myself in IRC at #drupal-games.

--Ben

hadsie’s picture

Status: Active » Needs review
StatusFileSize
new2.77 KB

Ok, here's a tarball of my module. I'm also using github (based on a fork from the userpoints_contrib d7 code), so if it's easier I can also just do a pull request there.

Btw, it might make sense to create a D7 branch in CVS just so that tickets can be assigned to D7 instead of these sorts of things needed to be assigned to the 6.x codebase.

berdir’s picture

Status: Needs review » Needs work

Unfortunately, the git mirror of userpoints_contrib is messed up, many files are missing there.

Try to provide a diff against CVS and upload a patch, then I can easier review your changes.

Also, instead of providing a description, you should implement hook_userpoints_info(), see http://drupal.org/node/993376

hadsie’s picture

@Berdir, should I be doing this against HEAD? If you guys are working from CVS now then maybe it would make sense to create a 7.x branch of the code? (We could then tag these issues with version 7.x instead of 6.x).

berdir’s picture

Use DRUPAL-6--1 for now. I'll create a DRUPAL-7--1 branch soon :)

For creating a patch however, it doesn't matter if there is a branch yet or not :) you need to patch against the current Drupal 6 version anyway.

BenK’s picture

@hadsie: Any update on this? Can you post a patch as requested by Berdir? We're getting closer to creating an official branch, but the plan is to initially only include those sub-modules that are functioning pretty well already. The rest will come later. So if you can get us a patch to look at soon, we can get userpoints_flag in the first wave of commits.

--Ben

gilgabar’s picture

Status: Needs work » Needs review
StatusFileSize
new12.58 KB

Here is a patch that implements the userpoints_flag changes from #935504: Userpoints_flag - specify which flags earn points for 7.x.

berdir’s picture

Status: Needs review » Needs work

Thanks for the patch, feedback below.

+++ b/userpoints_flag/userpoints_flag.info
@@ -1,7 +1,6 @@
-core = 6.x
+core = 7.x
 dependencies[] = userpoints
-dependencies[] = flag
-
+dependencies[] = flag

I think the other modules are missing this too, but I guess it would be helpful to add a configure=admin/config/people/userpoints/settings line to all modules that have settings, to make it easier to find them and know that they do have settings.

+++ b/userpoints_flag/userpoints_flag.install
@@ -1,17 +1,24 @@
+/**
+ * Implements hook_install().
+ */
+function userpoints_flag_install() {
+  drupal_set_message(st('User Points Flag API has been successfully installed.'));
+  drupal_set_message(st('You can configure the User Points Flag API module on the <a href="@url">User Points settings page</a>.', array('@url' => url('admin/config/people/userpoints/settings'))));
+}

Because then we can drop this thing here, not necessary anymore then.

+++ b/userpoints_flag/userpoints_flag.install
@@ -1,17 +1,24 @@
+    ->execute();
 }
\ No newline at end of file

Can you add an empty new line after this?

+++ b/userpoints_flag/userpoints_flag.module
@@ -148,20 +155,20 @@ function userpoints_flag_flag($action, $flag, $content_id, $account) {
-            'operation' => 'Flag '. $flag->title,
-            'description' => t('Flag: @content_type @content_id.',array('@content_type'=> $flag->content_type, '@content_id'=> $content_id)),
+            'operation' => 'Flag ' . $flag->title,
+            'description' => t('Flag: @content_type @content_id.', array('@content_type' => $flag->content_type, '@content_id' => $content_id)),

Please update this to use a machine-readable name and then provide a nicer description using hook_userpoints_info(), see http://drupal.org/node/993376.

For the description, I'd say we can at least use entity_label($entity_type, $entity_id), maybe we can even integrate which flag you were using?

Edit: Because "Flag" might be confusing to the user, he probably hasn't "flagged" it, but "bookmarked" or something like that.

+++ b/userpoints_flag/userpoints_flag.module
@@ -169,13 +176,13 @@ function userpoints_flag_flag($action, $flag, $content_id, $account) {
-            'operation' => 'Flag Author '. $flag->title,
-            'description' => t('Flag author: @content_type @content_id.',array('@content_type'=> $flag->content_type, '@content_id'=> $content_id)),
+            'operation' => 'Flag Author ' . $flag->title,
+            'description' => t('Flag author: @content_type @content_id.', array('@content_type' => $flag->content_type, '@content_id' => $content_id)),

Same here.

Powered by Dreditor.

gilgabar’s picture

Status: Needs work » Needs review
StatusFileSize
new16.46 KB

Made the requested updates. It depends on a patch to userpoints in #1082088: Add 'description arguments' to hook_userpoints_info. It adds arguments to hook_userpoints_info description callbacks. It was necessary to pass along the flag title.

BenK’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Status: Needs review » Needs work

The last submitted patch, userpoints_flag-d7-871116-10.patch, failed testing.

taecelle’s picture

Hey to all and happy new year!

I've got the problem with flag and userpoints, but only if flag ISN'T global. Then i cannot grant points when some user flags comment. I applied patch and it works good, but doesn't solve my problem.

Any idea or help?

LCG’s picture

Component: Code » Miscellaneous

Hello there.

Is there something new about the port of Userpoints Flag for Drupal 7?
I tried the .tar.gz in #3. I can change options in Userpoint configuration but the points are not earned when a node is flagged.

Thank you

LCG’s picture

Nevermind, it works. I didn't understand well explanations of the options. . .

kreynen’s picture

Project: User Points Contributed modules » Userpoints Flag [D7]
Status: Needs work » Needs review

After discussing this with @Berdir, I've moved userpoints_flag to http://drupal.org/project/userpoints_flag

kreynen’s picture

Version: 7.x-1.x-dev » 7.x-1.0-beta1
Status: Needs review » Fixed

Since several people have enabled the module and we were able to quickly fix a few issues with their configurations, I rolled beta1 of the D7 version of userpoints_flag today. Considering this issue fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

berdir’s picture

Ok, removed the module from the 7.x-1.x branch, do you intend to add the 6.x-1.x version as well?