HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Tempcode question

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#111361 (In Topic #22376)
Avatar

Well-settled

Displaying a member's 1ry usergroup inline

Greetings,

In Comcode pages I quite often make use of the Tempcode symbols {$SITE_NAME) and {$USERNAME} for displaying their current values inline. There isn't (to my understanding) an equivalent symbol for displaying a logged-in user's current primary usergroup, which would be similarly handy for me. I've been struggling unsuccessfully to devise a Tempcode directive that does the job, and which could be likewise typed into the page's editor inline. 

Please, can anyone help me?

Thanks for reading, and thanks in anticipation!
Back to the top
 
Posted
Item has a rating of 5 (Liked by RichT)  
Rating:
#111363
Avatar

It's not documented but try {$GROUP_NAME,0}.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111364
Avatar

Well-settled

Perfect! Very many thanks indeed, Chris.

Although, as you say, the symbol isn't documented (at least in the v9 Tempcode tutorial), it came to my attention yesterday while wading through symbols.php. I tried using it, but to no effect. being unaware of needing to append the "0" value! Silly me, should have thought of trying that. :$

As ever, I'm hugely grateful to you, and can't thank you enough for your never-failing attention to my foibles!

Best regards,

Richard.
Back to the top
 
Posted
Rating:
#111367
Avatar

Well-settled

Hi Chris!

Further to my applying the {$GROUP_NAME,0} symbol, some feedback.

While the symbol works perfectly for users belonging to a single usergroup, for users having a secondary usergroup, it returns the name of their secondary, rather than primary one. This is, of course, contrary to the user's actual logged in status, as correctly displayed in the Personal Stats block. Though of no practical consequence at all, it's a source of potential confusion to the users in question.

Is there a simple workaround to get the symbol's output to display the name of their primary group , without re-coding the PHP for it? 

Incidentally, the output of {$GROUP_ID,0} likewise displays the user's secondary usergroup ID!
Back to the top
 
Posted
Rating:
#111368
Avatar

Try this:

Attachment
sources/ocf_groups.php
» Download: ocf_groups.php (14 Kb, 22 downloads so far)


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111372
Avatar

Well-settled

Hugely appreciated, Chris! All's working just fine now.

Best regards and wishes,
Richard.
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: