Excellent module, but currently I can't use it because I want users to badge themselves, but not be allowed to badge other users. I've tried to do this using CCK and Rules, but it is a very long-winded way of doing it. I wonder if coding the permission might be simple, ie a "change own badge assignments" permission. Thanks.

Comments

nancydru’s picture

Assigned: Unassigned » nancydru

I will look at the possibility.

nancydru’s picture

I can't create a proper patch right now, but hopefully this will get you going. Please report back.

  1. Add 'change own badge assignments' to the permissions list.
  2. In "user_badges_menu" add this before the "user_badges/autocomplete" item:
      // Menu item to allow a user to change their own badge assignments.
      $items['user/%user/edit/badges'] = array(
        'title' => 'Badges',
        'page callback' => 'user_badges_page',
        'page arguments' => array(1),
        'access arguments' => array('change own badge assignments'),
        'type' => MENU_LOCAL_TASK,
        'weight' => 5,
        );
            
  3. Locate "user_badges_page" and replace the comments and beginning of the code
    /**
     * Define the page on user/uid/badges/edit
     * and user/%user/edit/badges.
     *
     * Note: menu system passes user/% as integer,
     * but user/%user as an object (with badges).
     */
    function user_badges_page($uid) {
      if (is_object($uid)) {
        $account = $uid;
      }
      else {
        $account = user_load($uid);
      }
            
  4. Locate 'user_badges_change_form' and change the redirect at the end.
      if (arg(2) == 'edit') {
        $form_state['redirect'] = "user/$uid";  // My account.
      }
      else {
        $form_state['redirect'] = "user/$uid/badges";  // Full admin UI.
      }
            
    Flush the caches (at least the menu cache).
grahammiranda13’s picture

Issue summary: View changes

Hello,

There are 5: user_badges_change_form

There are three: user_badges_page

which ones to change lol