? ? Success

User tests: Successful: Unsuccessful:

avatar HelgeSverre
HelgeSverre
20 May 2015

Added a helper method for getting the title of a group by its id.

I've not found any method to do this in the Joomla documentation so i put it it.

This example will echo out the title of every group that a user is in:

Example

// Get the JUser object of the current user
$user   = JFactory::getUser();

// Get an array of the group id's that the current user is in.
$groups = JAccess::getGroupsByUser($user->id);

// Loop through each group id
foreach ($groups as $groupId) {
    // Print out the title of that group
    echo JAccess::getGroupTitle($groupId);
}
avatar HelgeSverre HelgeSverre - open - 20 May 2015
avatar joomla-cms-bot joomla-cms-bot - change - 20 May 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 20 May 2015
Category ACL Libraries
avatar zero-24 zero-24 - change - 20 May 2015
Status New Pending
avatar zero-24
zero-24 - comment - 20 May 2015

@HelgeSverre I have just send you a quick CS PR.

Can you add some example code for the testers?

avatar zero-24 zero-24 - change - 20 May 2015
Labels Added: ?
avatar HelgeSverre
HelgeSverre - comment - 20 May 2015

@zero-24 Sure

This example will echo out the title of every group that a user is in:

Example

// Get the JUser object of the current user
$user   = JFactory::getUser();

// Get an array of the group id's that the current user is in.
$groups = JAccess::getGroupsByUser($user->id);

// Loop through each group id
foreach ($groups as $groupId) {
    // Print out the title of that group
    echo JAccess::getGroupTitle($groupId);
}
avatar zero-24 zero-24 - change - 20 May 2015
The description was changed
Status Pending Ready to Commit
Easy No Yes
avatar zero-24
zero-24 - comment - 20 May 2015

Thanks @test successful :+1:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6994.

avatar zero-24 zero-24 - test_item - 20 May 2015 - Tested successfully
avatar zero-24 zero-24 - change - 20 May 2015
Status Ready to Commit Pending
avatar jwaisner
jwaisner - comment - 23 May 2015

@test

Patch works as intended.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6994.

avatar jwaisner jwaisner - test_item - 23 May 2015 - Tested successfully
avatar zero-24 zero-24 - change - 24 May 2015
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 24 May 2015

RTC Thanks :smile:


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6994.

avatar zero-24 zero-24 - change - 24 May 2015
Labels Added: ?
avatar HelgeSverre
HelgeSverre - comment - 26 May 2015

What does RTC stand for?

avatar zero-24
zero-24 - comment - 26 May 2015

What does RTC stand for?

Ready to commit. So the changes works as expected and a maintainer need to take a decision to include or not :smile: Thanks


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6994.

avatar zero-24 zero-24 - close - 11 Jul 2015
avatar mbabker
mbabker - comment - 11 Jul 2015

Added a unit test for the method and merged to 3.5-dev via 7620400

avatar mbabker mbabker - change - 11 Jul 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-07-11 14:50:39
Closed_By mbabker
avatar mbabker mbabker - close - 11 Jul 2015
avatar zero-24 zero-24 - change - 14 Oct 2015
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment