Closed (duplicate)
Project:
User Relationships
Version:
6.x-1.0-rc3
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Jan 2010 at 15:36 UTC
Updated:
7 Nov 2011 at 23:04 UTC
I have setup my user relationship module and everything is working out fine but I would love to have a default value for my content types in a way that the user doesn't have to choose who to post to. Otherwise, the people the content should be posted to should be the same to all users. Please help
Comments
Comment #1
johnlinux commentedA link to another post will help too please. I hope my issue is understood here.
Comment #2
johnlinux commentedComment #3
alex.k commentedPlease check the solution in http://drupal.org/node/358363
Comment #4
johnlinux commentedThanks alex.k for your comment.
/node/add/blog?edit[user_relationship_node_access][view][1]=1 puts a check on the friends checkbox and that is what I want. but is there a way to change on the views settings so as the end user does not see any check boxes at all??
Please advice. thanks
Comment #5
alex.k commentedYou can hide the chechbox via CSS (css_injector module), or implement a hook_form_alter to turn the checkbox into a hidden element.
Comment #6
johnlinux commentedokay let me try out the css_injector. is there a place I can get help on the hook_form_alter? im not so familier with API.
Comment #7
alex.k commentedhttp://api.drupal.org/
Comment #8
adam_c commentedI would like a more technical solution (which dosnt mean installing another module such as prepopulate), after looking through the code in user_relationships_node_access.module I found that on line 189 it specifies:
$defaults = isset($permissions[$action]) ? $permissions[$action] : array();
So i infer from this that it checks for existing permissions and sets that to populate the checkboxes, and if no existing permissions are set then it uses an empty array.
My question is... what key value notation would you add to the array to set a particular checkbox such as 'global' permission. I though it may be something like:
$defaults = isset($permissions[$action]) ? $permissions[$action] : array('gid'=>'GENERAL_PUBLIC');
but this does not seem to do it.
Any pointers on this?
thanks
Comment #9
3dloco commentedHello,
I'd like to know how to set the default value. I've tried 3 different methods using hook_form_alter, hook_FORMID_alter, and Rules Form and it is not working for me. Currently I have for
1. Using hook_form_alter
2. Using hook_FORMID_alter
3. Using Rules Form
Appreciate any help you can provide.
Thanks,
KH
Comment #10
MrTrojborg commentedDid you guys ever find a solution to setting the checkboxes checked by default which not involves setting up the prepopulate module?
/*** EDITED ***/
Found the ugly solution myself by adding default values in the URNA module array('1' => '1') instead of the empty array
Still would like to know how to alter this in a theme or own module
/*** END EDIT ***/
Kind regards,
MT
Comment #11
mrf commentedMarking this as a duplicate since we have a newer issue with working code for this now.
See #1273550: Allow users to set default node access settings.