Custom user role not working as expected

I’ve defined a custom user role in functions.php called “Dashboard Admin” with the capabilities defined below. The site has a number of custom post types- all with capability post– and I’d basically like to lock down this role’s capabilities to only creating/editing/deleting posts (of any type), and not pages, managing categories or any other higher level admin tasks. For some reason, using the array below, when logging in as this user type one can only create new posts and “Submit for review” and not open or edit any existing posts of any post type- what am I missing here? Thanks in advance!

$  result = add_role(     'dashboard_admin',     __( 'Dashboard Admin' ),     array(         'read'                   => true,         'publish_posts'          => true,         'edit_posts'             => true,         'edit_others_posts'      => true,         'edit_published_posts'   => true,         'delete_posts'           => true,         'delete_others_posts'    => true,         'delete_published_posts' => true,         'read_private_posts'     => true,         'edit_private_posts'     => true,         'delete_private_posts'   => true,         'upload_files'           => true,         'publish_pages'          => false,         'edit_pages'             => false,         'edit_others_pages'      => false,         'delete_pages'           => false,         'delete_published_pages' => false,         'delete_others_pages'    => false,         'manage_categories'      => false,         'install_plugins'        => false,         'activate_plugins'       => false,         'update_plugins'         => false,         'edit_plugins'           => false,         'delete_plugins'         => false,         'edit_dashboard'         => false,         'switch_themes'          => false,         'edit_theme_options'     => false,         'create_users'           => false,         'list_users'             => false,         'edit_users'             => false,         'delete_users'           => false,         'promote_users'          => false,         'remove_users'           => false,         'customize'              => false,         'manage_options'         => false,         'delete_site'            => false,         'import'                 => false,         'export'                 => false,     ) ); 

Print custom field in user edit form in block

Following code prints user edit form in block:

function notifikacie_custom_block_info() {  $  blocks['user_profile'] = array(    'info' => t('User profile edit'),    'cache' => DRUPAL_NO_CACHE,  );   return $  blocks; }  function notifikacie_custom_block_view($  delta = '') {   $  block = array();        global $  user;       module_load_include('inc', 'user', 'user.pages');       $  block['subject'] = t('Fill your profile');       $  block['content'] = drupal_get_form('user_profile_form', $  user);    return $  block; } 

But it does not print custom fields created in admin/config/people/accounts/fields. How do I print those custom fields?

User or group column is populated with incorrect values when adding data from CSOM

I am working on a console application that updates list items using managed CSOM. I have a user or group column in this list that can contain multiple values. Now, I am using below code to update the value of this column:

// Get the user   User newUser = web.EnsureUser("LoginName");   context.Load(newUser);   context.ExecuteQuery();   FieldUserValue userValue = new FieldUserValue();   userValue.LookupId = newUser.Id;  // Update the list item   listItem["User"] = userValue; 

The issue is if I assign the value of user1 to this column, the value that I see after the column is updated is another user; like user2. I don’t know why it is populating this code with some other user?

Any idea on this issue?

InfoPath 2013 Getting current user details error

I have SharePoint server 2013 and a custom list I want to get current user details in InfoPaht form 2013

I followed post from: https://spvee.wordpress.com/2013/04/10/auto-populate-user-information-in-infopath-with-claims-based-authentication-part-1-of-3/

but when I preview my form I get bellow error:

The SOAP response indicates that an error occurred on the server:  Server was unable to process request. ---> Attempted to perform an  unauthorized operation. 

when I open the form in browser I get bellow error:

 An error occurred while trying to connect to a Web service.    An entry has been added to the Windows event log of the server.   Log ID:5566    Correlation ID:b620719d-1f52-d035-bad8-74b03605738f  -------------------------------------------------------------------------------- An error occurred while trying to connect to a Web service.   An entry has been added to the Windows event log of the server.   Log ID:5566   Correlation ID:b620719d-1f52-d035-bad8-74b03605738f 

I am the site collection administrator I have full access to site but I don’t know why I get this error.

i need to get a user id from a query result

am querying from my User table using the user name, how do i get the user id from the query object User.where(user_name: “john”)

my goal is to get the User id: 5, i thought it was as easy as (.id), but thats not working

=> #<ActiveRecord::Relation [#<User id: 5, user_name: "john", user_city: "India", created_at: "2019-01-19 18:02:32", updated_at: "2019-01-19 18:02:32">]>