Express Object Name Mask, User Name instead of ID, and Author, how?

Hey Folks,

So in some cases I care about setting a useful Name Mask for some Express Objects, so that when humans read Express Entries (administrative staff) they can see human-readable information.

However, when I try to use two particular methods, they’re not quite as “useful” to humans as possible, and one of them just doesn’t even seem to “work”.

It’s also worth noting the Name Mask aspect does not appear to be in Concrete CMS documentation at all.

BTW this is in my dev environment which is running Concrete CMS v8.5.7 currently

  1. When I add %author% no info is actually presented. No user ID or whatever, nothing. I would, of course, prefer to see the Username for this, but I’m not sure what syntax to use for that, and I don’t even see why %author% isn’t working. What’s up with that and what syntax should I use?
  2. When I reference a user-selector attribute, it gives me the user ID, but I would prefer to present the UserName instead. And I really do not know what syntax I should, or even can, use. What should I use for this?

Thanks! :slight_smile:

Hey @BloodyIron

1.) Does this thread help? Seems like there’s a pretty thorough explanation of Name Mask there. If so, I can see about incorporating it into some docs as well.

2.) Can you use the User ID to instantiate a User Object using the getByUserID method and then call getUserName on it?

Hi @EvanCooper

  1. Which link?
  2. I’m not talking in PHP, I’m talking in the Dashboard interface where you add the Name Mask. Like when you edit the Express Object via Dashboard. So AFAIK php methods don’t “work” there.

1.) Whoops, edited to include the link in that post.
2.) Ah, gotcha. I will take a look there.

1 Like

I doubt you can display anything but simple attributes values added to that object.
Here take at look at source code:

only id, attributes from object and associations will be converted from %placeholder% to string.

User selector attribute always returns ID (not username), so you would need to override that file to implement that specific logic (returning username instead id).

Not sure what “author” is, but it should be a handle of attribute added to that Express object.

2 Likes

Yeah I suspected as such, but wasn’t sure if I was missing something.

I’m of the understanding “author” is the user that is logged in when submitting an Express Form, or creating an Express Entry for an Express Object. When retrieving Entry values in PHP ->getAuthor() from an Express Entry matches the above description (user who made the Entry, so to say).

I was hoping to make something a touch human-friendly in some Dashboard areas, but maybe I just need to make my own “admin pages” or something instead, heh.

Thanks for hearing me out!

So I’ve opened a relevant github issue : Express - Name Mask - Support Core Properties in better ways, eg "Author" · Issue #11520 · concretecms/concretecms · GitHub

I think this would be worth having, since seeing only userIDs in the dashboard is pretty useless for humans.