Tusk
Tusk

Reputation: 723

How to make an administration page in Drupal? Is it even possible?

Let's say I'm making a blog in Drupal 7, and I want my end user to see a link: "Add Post", and when he clicks on that link he can add a new content. But instead of the default administration page, is it possible to create a new one, which has just the post title, tags, message and etc?

I've been searching for 2 days now, founding nothing about where to start/how to start a specific administration page instead of the default one.

Upvotes: 2

Views: 4609

Answers (4)

Benoît Pointet
Benoît Pointet

Reputation: 898

You will have to create a specific module for that which will:

  • define the blog post editing form you want to have
  • define a page through a hook_menu function that includes the form
  • define a menu entry for it in the administrative menu
  • etc.

You should really get a little more into extending drupal by reading some pro drupal 7 book. At least start reading http://drupal.org/node/1074360

Another very good starting point is the drupal "examples" module, which provides example code for most things your modules need to do: http://drupal.org/project/examples

Upvotes: 4

JurgenR
JurgenR

Reputation: 386

Every add/content_type is a form. Forms can be altered with hook_form_alter or hook_form_id_alter.
If you want to have different fields that are shown for different roles, first see if it could be done on the admin/people/permissions page, if not write extra if conditions inside the form_alter.

e.g. check user role:

global $user;

// Check to see if $user doesn't have the administrator role. if (!in_array('administrator', array_values($user->roles))) { // Alter the form }

You can check the form variables with dpm($form) when the Devel modules is enabled.

Upvotes: 0

James Shields
James Shields

Reputation: 339

You could probably do all you need to by adding a template for the blog posting page to your theme. This lets you customise the display of the form, without needing to get too deep into Drupal programming.

Alternatively, you could create a module to replace the default blog submission form with one if your own design.

The theming and module design guides on the Drupal website give lits if detail on both these approaches.

James

Upvotes: 1

Anas Kh
Anas Kh

Reputation: 1

you can have a different theme for management section, you can have multiple permissions depending on role, you can customize any page using ***node.tpl

Upvotes: 0

Related Questions