As requested, I'm making a new issue regarding the upload dependency. My purpose for asking in the other issue was so that I won't have to use the upload module any longer. It's no longer necessary but there is still a dependency, it would be great if that could be removed.

Thanks.

CommentFileSizeAuthor
#24 spacer.gif43 bytesdoublejosh

Comments

Richard Blackborder’s picture

Status: Active » Closed (won't fix)

The upload module *is* still required though. I didn't just forget to remove the dependency.

The image library part of the module uses it and will not function without it.

ManyNancy’s picture

But what about for people who don't want to use upload? I thought you said you were supporting that...

Richard Blackborder’s picture

You don't have to actually use upload, but you do have to enable it.

ManyNancy’s picture

Is it possible to make use of the image library optional? Because I really really don't like the upload module.

Thanks a lot.

Richard Blackborder’s picture

Use of the image library is optional.

The only thing that is not optional here is that you have to enable the upload module on the modules page. That's it. You don't have to actually use the upload module at all.

ManyNancy’s picture

Status: Closed (won't fix) » Active

The upload module is being deprecated and won't be in D7.

In d6 enabling adds bloat, and horrible forms to the UI, confusing administrators... especially since it's not actually being used.

Please reconsider removing the dependency again. Thanks for making a great module.

Richard Blackborder’s picture

Status: Active » Closed (won't fix)

It is being used to upload badges. It provides a feature other users want.

Points about D7 modules are only relevant to D7 modules.

ManyNancy’s picture

I don't see how removing the dependency would remove the feature? The feature would still be there?

The point about D7 is that the community has decided that the upload module shouldn't be used any more.

henrijs.seso’s picture

Status: Closed (won't fix) » Active

I agree with ManyNancy. Can't image upload be completely optional and text only badges be used? In form of <span class="user_badge badge_name">Badge title</span>. This way more advanced users could keep their drupal installation clean and still use all features of this module by defining css styles for those badge spans.

Just wrap everything in function user_badges_images_form in if (module_exists('upload')) and else return something like 'Image upload disabled. Please enable Upload module.' No need for dependency.

will install, test and provide a patch.

UPDATE. Installed and tested module, indeed this dependency is not good. Thy can't there be text badges?

nancydru’s picture

Title: Removing the upload dependency » Support text badges
Priority: Normal » Minor

It might be possible.

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

I need someone (or more is better) to go into user_badges.admin.inc and find function user_badges_edit_form_validate. Just a few lines down, you will see

  elseif (!$form_state['values']['imageurl'] && !$form_state['values']['image']) {
    form_set_error('image', t('You need to either enter an image URL or select an image from the library. Your badge needs an image.'));
  }

Either comment out the form_set_error or delete those three lines altogether. Then test your text badges. They work for me.

Let me know so I can commit a more complete fix (or an option).

ManyNancy’s picture

Not using this anymore, I'm creating badges as nodes, hopefully entities in D7.

nancydru’s picture

This was inadvertently committed and now backed out. A more complete solution is needed with a setting and checking at the upload points.

Rob_Feature’s picture

I'm running into this as well...I have a client who wants to be able to use text instead of images as user badges. I'm envisioning the core module doing text, then a second module called "user_badge_images" or something supplying the image portion.

Sure, I realize that requires more work, but it would be ideal.

nancydru’s picture

@Rob_Feature: try the change above, please. I don't think an add-on for images is ideal: there are only a handful of people out of 1,700 users asking for this; so I believe most users would prefer images. But I do agree that text badges is a good idea.

henrijs.seso’s picture

D7 port will be perfect time to move to text only + add optional image badges (actually, since badges could be fieldable entities where users could add image field themselves (they could build organic group on each badge for that matter) and image attach is killed as I understand, no separate image badges module would be necessary :) Life will be better with D7

nancydru’s picture

I'm still looking for decent field documentation. I'm also waiting for someone to try my code above. I would prefer to have most D6 issues fixed and in the wild for a few weeks before starting 7.x.

nancydru’s picture

I'm also waiting for someone to try my code above. If the issue languishes for another two weeks, I will consider it no longer desirable.

Rob_Feature’s picture

NancyDru: I was going to give it a shot then I realized that I was overthinking it...I could simply use a CCK text field on my profile instead of userbadges. It would work for my current needs (which don't integrate with userpoints, etc).

doublejosh’s picture

+1 I'd like to see text based user badges as well.
*EDITED

Reasons I see:

  1. Providing an icon for quick expert recognition as well as text for learner understanding is a pretty core design principal.
  2. Sprites become possible when CSS is used to display badges... and small icon type images REALLY should be sprites.
  3. When allowing many badges, just background color text badges becomes increasingly more appropriate.
  4. A common scenario is to have 2-4 categories of badge icons plus a text badge title.

Suggested output:
If the title of the badge was shown along with the badge image this could go either way with just CSS help.
Would suggest this HTML...

<span class="badge"><img src="PATH/FILE.gif" />BADGE TITLE</span>

Then to remove text by default module CSS could include...

span.badge { display:none; }
span.badge img { display:inline; }

Solutions enabled:

  1. Out of the box it would appear as it does now.
  2. To go all text, admins could upload a 1px gif.
  3. To use CSS sprites the same 1px gif would work.
  4. To use both icon and text, themers could override with span.badge { display:inline; }

Workable?

nancydru’s picture

See #11 and let me know how it works for you.

doublejosh’s picture

Whops, left out the title in the HTML sample above! Edited.

@NancyDru, since that code is just the validation for images within badges, you still need text output with a wrapper.
I'm suggesting getting text in there as well and perhaps even using a spacer graphic. Seems the quickest route to our goal.

Looking for how to create a theme function now.

doublejosh’s picture

Looks like it's theme_user_badge() surprise surprise! *edited

Bummer is that's it's 34 lines to override when all that's needed to do it transform the two outputs...
return l($image, $href, array('html' => TRUE)); //1045 ...into...

return '<span class="badge">' .
  l($image, $href, array('html' => TRUE, 'attributes' => array('title' => $badge->name . ' badge' ) )) .
  $badge->name .'</span>';

AND
return $image; //1034 ...into...

return '<span class="badge">'. $image . $badge->name .'</span>';
doublejosh’s picture

StatusFileSize
new43 bytes

And a spacer gif so other don't have to generate it.

henrijs.seso’s picture

spacer.gif? that sounds very wrong. Where it is used exactly?

doublejosh’s picture

Since this module requires an image be uploaded (as it's the whole badge) these were my suggestions for a workaround to get whatever you need with just a theme function.

The right way would be for the module to allow three modes...

  1. Image only
  2. Image and text
  3. Text only

This seems like it would require an optional upload field and an checkbox.

mermemladeK’s picture

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

I am also interested in text badges BUT for 7.x-2.x. Any news on this?
NancyDrew, if you need people testing you can count on me, although I don't have coding skills (PHP).

mermemladeK’s picture

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

Oops, restoring the version User Badges for which this issue was open.