When accounts are activated but the user has not yet logged into the site only Admins can view profile pages. When clicking on activity reports such as 'Joe bloggs created the user profile Joe Bloggs' a regular user will get a page not found error.

Therefore it would be better to have the profile creation report show up only AFTER the new user has logged in for the first time.

Comments

plan9’s picture

Probably a minor tweak needed. Anyone know how to fix this?

jaydub’s picture

Version: 5.x-4.x-dev » 6.x-1.x-dev
Assigned: Unassigned » jaydub
sirkitree’s picture

Issue tags: +activity-6.x-1-2

tagging for next point release.

jaydub’s picture

Issue tags: -activity-6.x-1-2

I'm thinking that it might be easier to remove the item from the activity list at display time rather than have to delay the activity record insert until the user has been created AND has logged in (thus updating the access column of the {user} table.

The relevant code here lies in the user_view_access() function which check for amongst other things whether or not the user has an access time other than 0 as well as the regular checks you'd expect such as 'access user profiles'.

For the sake of my co-developers I'm pasting in a quick implementation of this for review:

In activity module add status and access fields which are expected by user_view_access():

function activity_user_load($uid) {
  static $users;
  if (!isset($users[$uid])) {
    $users[$uid] = db_fetch_object(db_query('SELECT uid, name, picture, status, access FROM {users} WHERE uid = %d', $uid));
  }
  return $users[$uid];
}

In useractivity module add an implementation of hook_activityapi() to check for view access on the users in a useractivity:

function useractivity_activityapi(&$activity, $op) {
  if ($op == 'load' && $activity['data']['module'] == 'useractivity') {
    if ($activity['data']['operation'] == 'insert' || $activity['data']['operation'] == 'update' || $activity['data']['operation'] == 'view') {
      $uid = ($activity['data']['operation'] == 'view') ? $activity['data']['target-uid'] : $activity['data']['uid'];
      if (!user_view_access(activity_user_load($activity['data']['target-uid']))) {
        $activity = array();
      }
    }
  }
}
sirkitree’s picture

Issue tags: +activity-6.x-1-2

retagging

jaydub’s picture

Status: Active » Fixed

committed to CVS.

Status: Fixed » Closed (fixed)
Issue tags: -activity-6.x-1-2

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