Prepopulate Content Type Args when going to /admin/content in Drupal 7 - drupal

I created a Drupal site. The admins who will be using the site for content management have no Drupal knowledge and I have been tasked with making this as easy as possible for them. I'm creating an admin control panel and I want a quick link that takes them to the admin content page, but with the "content type" prefilled. For example, for content I have pages, events, resources, and testimonials. I want to provide them with a quick link for editing content type EVENTS only. So it would go directly to admin/content with the type filter set to "events". The URL does not currently add args or anything like that.
Anyone know of a way to do this?

yes you can do this- just use this module: Drupal admin views which supports a REGULAR VIEW for admin/content. The View is set to use ajax though- just remove this option and save it and call /admin/content then. There you will see the resulting filters in the URL (you can even set their keys to a value you like inside the view). Set back to use ajax (if you like) and use the keys in the URL for type it's simple just call /admin/content?type=YOURTYPE

Related

Drupal 6.x Add More Module - No end to adding more

Simple question for all of you here dealing with Drupal 6.x...
With Drupal's Add More module, is there a way to configure my webform so that there is no limit on how many of a specific fields I can add more of?
Please see my image for example:
For example, I'd like to enable the user to add as many titles as they would like. Is that doable?
Unfortunately, it's not currently possible to add unlimited "add another" functionality with webforms. And if this functionality does become a reality someday, I doubt it will be backported to the Drupal 6 version of the module. From the webform modules author (quicksketch):
there is no progress on this subject. The ability to support multiple
values requires a tremendous amount of re-architecting, including
changes to the way CSVs are generated, analysis, the database
structure, and the UI (both for administrators and users). I wouldn't
expect this feature to be added any time soon.
See this thread for more information:
http://drupal.org/node/354381
I would suggest using a node and the CCK module plus rules and views to collect this information.
Assumptions:
Anonymous users can fill out the current form
You need some way of retrieving the data that is submitted
Regular users of the site should not be able to view submissions
Very loose directions:
Create a content type and add all of the fields that your current webform contains to it. CCK has the ability to store unlimited values out of the box. On the field settings page, inside the Global Settings fieldset, select "Unlimited" for the "Number of Values" field.
Give anonymous users permission to Create [your-new-content-type] Content on the Role Permissions page.
Using the Rules module, create a new triggered rule that fires on "Content is about to be viewed" with an condition "Content has type [your-new-content-type]" and an action of redirect to homepage (or a custom error page that you created). (Note: this is a bit of a performance hit. There are better ways to restrict access to this content type, but for the sake of this tutorial, this was the easiest to explain)
Using the Views module, create a new view with Style set to Table. Add each of the fields in [your-new-content-type] in the fields section. Under "Access" choose "role" and select the role that is assigned to your user. Add a "page" display, give it a Path and save. This is the page you will use to view submissions.
Optional:
Use the Rules module to send yourself (or the submitter) an email when a node of [your-new-content-type] is created.

Drupal 7- How to make a custom module for only front page?

so..I created page--front.tpl.php in my theme directory and it works fine.
now, how do I make a variable that can be used in the page--front.tpl.php?
I can write my php codes inside page--front.tpl.php, but I think there is a better way.
added:
on the front page, I am going to query video and news nodes ONLY. That is why I want to make a new module for only front page.
any suggestions?
I'm not sure what you are trying to achieve here, but OK. You have two options: one is what you're doing now. Write your custom PHP in page--front.tpl.php and you'll be fine. The other is ditching the file and working only with page.tpl.php.
The variable $is_front tells you whether you're on the front page. You can write custom PHP in a conditional block: if ($is_front) { ... }.
Also, you can create a custom block (a view, perhaps, depending on your needs) and set its display restrictions to "only on the listed pages" - and list there. You'll have a custom view loaded only on the front page.
All you need to do have a custom front page is configure your front page in the site information settins (admin/settings/site-information in D6).
Creating a module to display that content is then a completely different thing.
What I would really suggest is looking at Views if you don't know it already. That allows you to build lists of things (nodes, users, ...) and expose them as pages, blocks, rss feeds and much more. You can create a list of nodes with types video and news, expose that as a page and then just point your front page to the path of your view.
you might try using the views module to create your list of videos and nodes. You can set a views page to be your homepage in the site settings.

How to create a custom form in drupal

I need help on how to create a 'custom form' using the same fields provided by cck.
Drupal gives you the ability to add fields to 'nodes' and how to theme their output. But I would like to be able to post a data from my own form (that pops-up) and sends data to the drupal database using the same drupal cck.
How do I access the specific form inputs to add data to my content types ? because the default form is kind of 'ugly' and loads on different page(without ajax).
Help would be much appreciated
There are several routes you could go down.
The easier option is to use the Webforms module. While this gives you similar fields to cck, they are not exactly the same, and if you have a module that implements a specific cck field type, it won't be available to webforms.
The second choice is to write your own module using the forms api. This can mean a lot of learning, add it takes time to get up to speed, but ultimately you have total control over how your form will look and behave. The forms api doesn't give you exactly the same fields, but all the tools are there to create them. Sometimes you need to hack open a module to find out haw a specific field is implemented.
A third option would be to use cck itself. You could create a content type and add the field types you want on your form. You would them give users permission to create but not view or edit the content type. The form submissions would them be nodes on your website. This would make me slightly nervous, so make sure all your permissions are correct!
The second part of your question: you can use a theme file to override the appearance of most forms and make them pretty.
James

Drupal arguments in a menu

By default on a page I have the following menu:
Profile /profile
Albums /album
Awards /awards
Going to any of those pages will load the page default.
If I go to a page on my site such as /mycontent/1 I wish to change a the menu to be the following.
Profile /profile/1
Albums /album/1
Awards /awards/1
I want to pass the argument (nid) to the menu. Is this possible?
Update
The selected answer does do what I asked. I however have changed how I am doing things to use Panels to display the content. I am then using some CSS and JavaScript to hide and show content. With views caching it seems to be working well.
Yes,use arg(0),arg(1), or arg(2) depending on which variable you want to use. It will use the path like the indexes of an array (0/1/2/3/4/etc...). Drupal will send you these variables as they were before the path was aliased if that is something that has been applied to it. Why are you passing the variable? There is probably a better way to do it the "Drupal" way..
Actually I am working on this same problem currently where I need to translate an aliased path: dept/profile/1 to load node/1223/profile/1 where 1 is the ID of the profile to show.
What I am using now is the URL Alter module and implementing the hook it gives to enable this feature. If you are interested in this maybe we can see if it is possible to get module out with a GUI.
My thread on this that is active now: Using module: url_alter and it's hook: hook_url_outbound_alter()
I am using a node that houses a panel which has a view inside it, for reasons that are site specific.

How to embed a node on homepage in Drupal 6?

How can I embed a node on the front page in Drupal 6. The node basically has the image upload field along with title and description. I want it to some how appear on the homepage alongwith a "views" which shows the uploaded images at the bottom.
What I want is to give the users an ability to create content which is right now available at .../node/photo/add. I want to somehow show this box which lets one create content i.e. upload photo with title and description on the homepage.
It's basically just an attempt at creating something like imageshack as an experiment.
I am pretty n00b when it comes to drupal so please be more descriptive.
Jukebox's solution works as a point-and-click method. If you want to do it with code, it's more like this:
create a glue module Handbook | Example Blog Post
turn it on in admin/build/modules
create a menu item using hook_menu() that will become the page
embed the node with node_view()
embed the view (blog post)
in admin/settings/site-information set your page to the
You can use the Node Blocks module to, well, turn your node into a block. This means that you can go to the /admin/build/block page and place your node in a particular region.
After installing the module, edit the Content Type of the node you want to turn into a block. Under Workflow Settings, Available As Block, choose Enable.
Now you can go to /admin/build/block and you can see some new blocks. Just choose the one you want and place it in the region of your choice. You can also configure that block's visibility settings from there as well.
If your planning on having a more complicated home page at any point in the future I'd highly recommend using Panels to do this. It will allow you to arrange your front page with views and nodes in a grid method.

Resources