User login

SQL

Removing double spaces in usernames directly in the SQL

A client using the Bulk invite module (by Agaric's David Valdez) had invited hundreds of users with slightly malformed usernames— two spaces between first and last name when there should only be one.

Note that you need to do the change both in the users_field_data table and the users_field_revision table— and you need to clear caches when you're done to see the change on user edit pages, which is where it matters.

Manually replace the body of an Activitystream node

Manually updated twitter feed post:
http://anjaliforberpratt.com/node/1270/edit

after that they should properly have the twitter name in the title, but not in the body.

and by manually updated, i mean activitystream breaks the bloody node edit form somehow.

Since i only want to do D7 development, and this is D6, i bailed pretty early and made the change direct in the live database (after careful investigation of course).

Check if a given uid has a given permission (a query to avoid user_load)

a good D7 query for determining if a user has a specific permission
via agentrickard

what's wrong with user_access('permission', $account) ?

it requires a user_load_multiple() (a user_load to get the roles on the account, turning in the ID is not enough)

which is wasteful if you can do it at the query level

you could see what queries that function runs

it seems like that is a somewhat complicated thing to work out
since users can belong to many roles

how many users is this for at a time? I'd just use user_load() + user_access().

Syndicate content