3

i have been created 'job' content type, i used 'Devel module' to generate content of 'job' type, but in some 'jobs' its taking anonymous user as a author, but i don't want anonymous user as author, so what should i do to avoid anonymous user as a author?

0

Answer for you question is Yes it do,and you can resolve your problem with following solutions:

The First solution is

  1. Install the views, views_bulk_operations, and admin_views modules.
  2. Go to the content listing (admin/content).
  3. Filter the results to get the nodes you are interested in.
  4. Check the checkboxes next to the node (there is also an option to select all).
  5. Select "Change author" from the operations dropdown and click the "Execute" button.
  6. Select the user you want to change the author to and click the "Next" button.

Admin views uses views bulk operations to override the default drupal administration views with something a lot more useful.

And also another solution is using bulk author update module

  • Can you be more specific about your " Yes it do"? I.e. what you mean by the "it" in it? – Pierre.Vriens Aug 30 '16 at 12:51
0

If you first set your permissions so that only authenticated users are allowed to create content of type 'job', then the Devel module should not be able to create this kind of content. At least that is what I would expect.

However, as per Devel generate not respecting node create persmission (which dates from 2009 and is still active), after tuning your permissions, Devel doesn't seem to work like that. Maybe not the answer you would want to get, but I'm pretty sure that this is the explanation of what happens.

Possible workaround:

I would use the Rules module and create a custom rule that looks like so (in Rules Export format):

{ "rules_change_node_author" : {
    "LABEL" : "Change node author",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "node_insert" : [] },
    "IF" : [
      { "node_is_of_type" : { "node" : [ "node" ], "type" : { "value" : { "job" : "job" } } } },
      { "data_is" : { "data" : [ "node:author:uid" ], "value" : "0" } }
    ],
    "DO" : [
      { "data_set" : { "data" : [ "node:author" ], "value" : [ "site:current-user" ] } }
    ]
  }
}

Some more details about what the above Rule actually does:

  • Rules Event: After saving a node.
  • Rules Conditions:
    • Check if the author's uid = 0.
    • Check if the content type is Job.
  • Rules Action: Update the node's author (i.e. to the user using the Devel module).

If you have the Rules UI enabled, you can simply import the above rule in your own site. If you want to use it for another content type, first adapt the machine name job prior to trying to import this rule (to avoid the import would fail if you don't have a Job content type).

PS: if you've configured your permissions that you do not allow anonymous users to create nodes of type 'Job', I think it is reasonable to assume that it must be that these kinds of nodes were created using Devel.

  • I had done whatever u said but still devel is generating content having anonymous user as author. – user66287 Aug 30 '16 at 12:38
  • @user66287 : can you first let me know if what I had included in what is now revision 2 of your question is yes or no a correct understanding of your question? If so, consider performing a rollback to that version (using the rollback link within the revisions history next to revision 2). Additionally, can you be more specific (= add more details) about the "I had done whatever you said", especially to which permissions you have used (disallowed) for anonymous users. – Pierre.Vriens Aug 30 '16 at 12:49
  • i have set permission to create job to authenticated user only but still its using anonymous user as author. – user66287 Aug 30 '16 at 12:51
  • by default anonymous user have permission to view comments,view published content , i had not changed any permission not added any type of permission other than this. – user66287 Aug 30 '16 at 12:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.