Joomla: How to set user group access permission for article post? - joomla

I got several user groups with special rights and categories.
Example:
Classes: A, B, C.
Teachers: A, B, C.
Now if "Teacher A" creates an article within his categorie (A) via frontpage he's able to select a permissionlevel for this article (Group A, B, C access).
Is it possible to hide this "access level selection" and give an automatic access level, in this case "access level a", when posting into categorie a?
Thanks for any usefull help! :)

I've done something similar in the past on a client project. I ended up creating a template override for the edit layout by copying components/com_content/views/form/tmpl/edit.php to templates/mytemplate/html/com_content/form/edit.php. Then, I moved the fields around and hid the regular access level selection container. Then, I performed some logic to get the logged in user to determine what access level they should be selecting, and set that in a hidden field right before the closing form tag, so that when it got submitted, the form would take that value. The field I used looked like this:
<input type="hidden" name="jform[access]" value="YOUR_GROUP_ACCESS_ID" />
So, as Dmitry said, it does take a little bit of work, but it's not too difficult.

You can hide "access level selection" overriding submit form layout. But for sure some coding will be needed to give an automatic access level. That's not an easy task...

Related

Hikamarket - How to edit the "Vendors' add product" form

I'm wondering how can I drop some of fields in the Vendors' add product form. Ex. I'd like to remove "acl", "weight", "currency" ect.
I tried to turn them off in Access Level setting of Hikamarket. But it didn't work. Also, I edited the PHP files but after doing that, the form gives errors that there's no entry to save...
I found the solution. I'd edited Vendor's access level. But didn't get to the result. Now, I edited Product access level in Market > configuration > access level.
Now I got the field I need and have dropped the rest of the fields.

Is it possible to create a user group in Joomla 2.5 that includes everyone that is NOT a member of a particular group?

I have two similar pages that need a menu link. Page 1 is shown to members of Group A. Page 2 is shown to everyone who is not a member of Group A. I have a "Guest" group which would include everyone who is not logged in. But some users are members of group A and Group B. I cannot figure out how to only show one link to them, based on whether they are a member of Group A or not. If I create an access level that includes only Group A and one that includes every other group and someone is in both groups, they will see both links, which is redundant since the pages are different versions of the same page. Any ideas?
We've got a similiar situation, and they way we got around it is to have another Usergroup called "GroupNotA". Then, we have a user plugin that we configure the UserGroups that are in play, and use the OnUserAfterSave event to insure everyone is conditionally in the correct user groups as shown in the code snippets below. With that, we can user menu items, etc. that are available to GroupA and GroupNotA.
myUserPlugin.xml
<field name="usergroup_a" type="usergroup" label="Group A" multiple="false" />
<field name="usergroup_not_a" type="usergroup" label="Group Not A" multiple="false" />
myUserPlugin.php
public function onUserBeforeSave($oldUser, $isnew, $newUser)
{
$UserGroupA = $this->params->get('usergroup_a');
$UserGroupNotA = $this->params->get('usergroup_not_a');
if(in_array(UserGroupA, $newUser['groups'])){
// Use IS in Group A - do nothing?
}else{
// Use is NOT in Group A - Add to group $UserGroupNotA
// add/remove from array $user['groups']
}
A word of caution though, the natural inclination was to use JUserHelper::addUserToGroup(), but it triggers OnUserAfterSave() again, so we went with direct manipulation of the Groups array.
A sample user plugin is installed with Joomla at plugins/user/example.php, and full documentation is available at Plugin/Events/User. Good Luck.
Note I just realized that we do this during a new user registration, so I'm altering the answer to use the event onUserBeforeSave(). I'm not sure that it will work as I originally suggested or not, but at least you have a starting point and the pieces to accomplish a solution.

Changing Views in a Module pops me into the Admin Skin

This question has probably been the most covered question in all of DotNetNuke's lifetime but I'm going to ask it here in StackOverflow because I need an answer, a really good one that doesn't make me look the other way. Thanks in advance to all DNN experts.
I've researched many ways of making this work for me and i've seen Michael Washington's solutions (Panels, MultiViews, ...) and Will's (Strohl) blog post on DotNetNuke's personalization engine through setting SkinSrc which is useful, as well as reading through Default.aspx's code which has given me more insight, however, i'm still faced with the problem that calling EditUrl()/NavigateUrl() brings me to a page with a single module in admin skin or a page with nothing respectively.
The specific version is DotNetNuke 6.0.1 (DNN). This Module has 4 other views in addition to the main view which I desire to navigate through sequentially. e.g.
Begin Checkout -> Collection of Delivery Details -> Confim Order
Have you found a solution?
I want to achieve
1) Module loads with other modules around. No module isolation
2) Views in a module that don't Preload e.g. Page_Load in each view gets called when the Module loads up
Help!
Assuming you are asking this as the module developer, the solution is to not use DNN's mechanism for specifying a control. So, you can't use EditUrl or specify the ControlKey in the NavigateURL call (which both generate "ctl=mycontrol" in the URL). Instead you need to have your module display your various controls based on the Query String parameters. So, you'll generally have a control in your module who's primary purpose is to dynamically load other controls based on the query string. So, for instance:
You will start with your control that lists items. You'll have a "Buy Now" button for each item. The hyperlink for each item can be generated by calling
NavigateURL(TabID, "", "View=BeginCheckout", "itemid=" & id, "mid=" & mid)
2.) On the page load of the handler control, it looks to see if anything is specified for the "View" Querystring parameter. If not it displays the listing control, if so, it displays the corresponding control.
Dim controlPath As String
Dim path as String = "~/DesktopModules/MyModule/Controls"
Select Case Request("View")
Case "BeginCheckout"
ControlPath = path + "BeginCheckout.ascx"
Case "DeliveryDetails"
ControlPath = path + "DeliveryDetails.ascx"
Case "ConfirmOrder"
ControlPath = path + "ConfirmOrder.ascx"
Case Else
ControlPath = path + "ItemList.aspx"
End Select
If System.IO.File.Exists(Request.MapPath(controlPath)) Then
placeholder.LoadControl(controlPath)
Else
Throw New Exception("Unable to load selected template. Please go into module settings and select a list and details template.")
End If
Most of the advanced modules for DNN do something along these lines so there's plenty of sample code out there. I would guess some of the core modules do something similar. I adapted the code above from Efficon's Articles module for DotNetNuke.

Displaying specific content to specific user in Joomla 1.5

To be short, It's a website for an investigations lab.
I need to display specific content (lab report) to specific user. Users will be given a username and a password when leaving and will be asked to login on the website to access his/her report with the credentials given to him.
So , it's a "specific content" for "specific user" - Moving to 1.6 is not an option.
I have a solution in mind but involve a lot of core hacking and will take some time ... If any one been in a similar situation or have an idea in mind I would appreciate your help.
Ok, this can be done but it's going to take a little trickery to get there. First, you are going to need a way to post the lab reports and associate them with a user. I would use K2 for this since you can add the report as an attachment to an item. You can also add extra fields to K2, which would be the next step. You'll need an extra field where you can enter a user ID number that you will use to determine if a user is allowed to view the content.
There are several steps you will need to take to now filter the content so only the associated user can see it.
You will need to get the user ID once the user is logged in:
$user =& JFactory::getUser();
$usr_id = $user->get('id');
You'll need a menu item that links to a K2 Category where all the lab reports go.
You'll need a subtemplate with a modified category_item.php for that category that only displays the associate reports:
if($this->item->extra_fields[USER_ID_EXTRA_FIELD_NAME]==$usr_id){
all the category item stuff
}
You'll need a subtemplate with a modified item.php for the category that again blocks users other than the associated user, basically the same code as #3 to either display the content or an error message.
The only other way I can think of that you can accomplish this would be to use an ACL component with a group for each user.
The K2 method with subtemplates would not require any core hacks and will work with a little work.
You can achieve what you want with Flexicontent http://www.flexicontent.org/ and Flexiaccess
Flexicontent is a K2 type component and I use them interchangeably. With Flexiaccess you can create items that are only available to certain users.
No hacks required.
Bad News: That cant be done with standard Joomla 1.5 (without hacking)
Good News: You can use one of the free or commercial Extensions for Joomla to accomplish that. I would suggest for example:
Admin-User-Access
http://extensions.joomla.org/extensions/access-a-security/backend-a-full-access-control/9040
Or you can search for yourself:
http://extensions.joomla.org/extensions/access-a-security/backend-a-full-access-control

Convert Order into custom entity 'X'

Issue is :
I have one system Entity called 'Order' and another custom entity 'X'. I am looking for some kind of same functionality as available on Quote called 'Convert into Order'. I want the same functionality on Order form that there will be some button on it and when i click on it, it will create instance of entity 'X' and not only this, it will also transfer all the mapping attributes of Order and 'X', on the 'X' form.
Can any one share his experience or step to implement this?
Many thanks.
You would have to use JavaScript and call CRM web services on click of new button.
So you don't have to map your attributes of your entities in JavaScript, you could use InitializeFromRequest to achieve same result. I have used this way to programmatically qualify/disqualify leads and convert them to contact, account and opportunities.
There is a nice sample code for this on CodePlex:
http://www.codeproject.com/KB/cs/CRM_30___EntityMoniker.aspx
Please note, this code has a bug. Check Ronalds post for quick fix:
http://ronaldlemmen.blogspot.com/2008/09/convert-lead-to-contact-account-andor.html
Yuo could do this using an on demand triggered workflow. just create a workflow targting the order entity, have the first step create a new entity X by copying the valuses from the passed in order entity.
if you want the option to do this to show under the more actions menu instead of teh workflows one then you can edit the isv.config file.

Resources